Merge pull request #32 from coralproject/embed-link

Embed link
This commit is contained in:
David Erwin
2016-11-08 14:56:28 -05:00
committed by GitHub
4 changed files with 23 additions and 10 deletions
-3
View File
@@ -1,3 +0,0 @@
{
"basePath": "client/coral-admin"
}
+22 -2
View File
@@ -12,6 +12,8 @@ import {
} from 'react-mdl'
import Page from 'components/Page'
import styles from './Configure.css'
import I18n from 'coral-framework/i18n/i18n'
import translations from '../translations'
class Configure extends React.Component {
constructor (props) {
@@ -40,12 +42,28 @@ class Configure extends React.Component {
</List>
}
copyToClipBoard (event) {
const copyTextarea = document.querySelector('.' + styles.embedInput)
copyTextarea.select()
try {
document.execCommand('copy')
} catch (err) {
console.error('Unable to copy')
}
}
getEmbed () {
const embedText =
`<div id='coralStreamEmbed'></div><script type='text/javascript' src='https://pym.nprapps.org/pym.v1.min.js'></script><script>var pymParent = new pym.Parent('coralStreamEmbed', '${window.location.protocol}//${window.location.host}/client/coral-embed-stream/', {title: 'comments'});</script>`
return <List>
<ListItem className={styles.configSettingEmbed}>
<p>Copy and paste code below into your CMS to embed your comment box in your articles</p>
<input type='text' className={styles.embedInput} />
<Button raised colored>Copy</Button>
<textarea type='text' className={styles.embedInput}>
{embedText}
</textarea>
<Button raised colored>{lang.t('embedlink.copy')}</Button>
</ListItem>
</List>
}
@@ -94,3 +112,5 @@ class Configure extends React.Component {
}
export default connect(x => x)(Configure)
const lang = new I18n(translations)
-4
View File
@@ -14,10 +14,6 @@ module.exports = Object.assign({}, devConfig, {
]
},
plugins: [
new Copy([{
from: path.join(__dirname, '..', 'coral-embed-stream', 'dist'),
to: './embed/comment-stream'
}]),
autoprefixer, precss
]
})
+1 -1
View File
@@ -10,7 +10,7 @@
"pretest": "npm install",
"test": "mocha tests --recursive",
"test-watch": "mocha tests --recursive -w",
"embed-start": "./node_modules/webpack/bin/webpack.js --config ./client/coral-embed-stream/webpack.config.dev.js && ./bin/www"
"embed-start": "npm run build && ./bin/www"
},
"config": {
"pre-git": {