mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
Adding mock comments
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"query": [
|
||||
{
|
||||
"item_id": "assetTest",
|
||||
"type": "asset",
|
||||
"data": {
|
||||
"url": "http://coralproject.net"
|
||||
},
|
||||
"related": {
|
||||
"comment": [
|
||||
"abc",
|
||||
"def"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"item_id": "abc",
|
||||
"type": "comment",
|
||||
"data": {
|
||||
"content": "Sample comment"
|
||||
},
|
||||
"related":{
|
||||
"child": [
|
||||
"xyz"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"item_id": "xyz",
|
||||
"type": "comment",
|
||||
"data": {
|
||||
"content": "Sample reply"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item_id": "def",
|
||||
"type": "comment",
|
||||
"data": {
|
||||
"content": "Another reply"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/* Item Actions */
|
||||
|
||||
import { fromJS } from 'immutable'
|
||||
import mocks from '../../mocks.json'
|
||||
|
||||
/**
|
||||
* Action name constants
|
||||
@@ -88,21 +89,26 @@ export const appendItemRelated = (item_id, property, value) => {
|
||||
* @dispatches
|
||||
* A set of items to the item store
|
||||
*/
|
||||
export function getItemsQuery (query, rootId) {
|
||||
export function getItemsQuery (rootId) {
|
||||
return (dispatch) => {
|
||||
return fetch('/v1/exec/view/' + rootId)
|
||||
.then(
|
||||
response => {
|
||||
return response.ok ? response.json() : Promise.reject(response.status + ' ' + response.statusText)
|
||||
}
|
||||
)
|
||||
.then((json) => {
|
||||
let items = json.results[0].Docs
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
dispatch(addItem(items[i]))
|
||||
}
|
||||
return (items)
|
||||
})
|
||||
// return fetch('/v1/exec/view/' + rootId)
|
||||
// .then(
|
||||
// response => {
|
||||
// return response.ok ? response.json() : Promise.reject(response.status + ' ' + response.statusText)
|
||||
// }
|
||||
// )
|
||||
// .then((json) => {
|
||||
// let items = json.results[0].Docs
|
||||
// for (var i = 0; i < items.length; i++) {
|
||||
// dispatch(addItem(items[i]))
|
||||
// }
|
||||
// return (items)
|
||||
// })
|
||||
console.log('Loading mock data', mocks);
|
||||
let mockData = mocks.query
|
||||
for (var i=0; i < mockData.length; i++ ) {
|
||||
dispatch(addItem(mockData[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ const ReplyButton = (props) => <button
|
||||
className={name + '-reply-button'}
|
||||
onClick={(e) => props.updateItem(props.item_id || props.parent_id, 'showReply', true)}>
|
||||
<i className={name + '-icon material-icons'}
|
||||
aria-hidden={true}>{lang.t('reply')}</i>
|
||||
Reply
|
||||
aria-hidden={true}>reply</i>
|
||||
{lang.t('reply')}
|
||||
</button>
|
||||
|
||||
export default ReplyButton
|
||||
|
||||
+2
-1
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"start": "./bin/www",
|
||||
"embed-start":"node client/coral-embed-stream/dev-server.js"
|
||||
"embed-start": "node client/coral-embed-stream/dev-server.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -45,6 +45,7 @@
|
||||
"exports-loader": "^0.6.3",
|
||||
"immutable": "^3.8.1",
|
||||
"imports-loader": "^0.6.5",
|
||||
"json-loader": "^0.5.4",
|
||||
"pym.js": "^1.1.1",
|
||||
"react": "15.3.2",
|
||||
"react-dom": "15.3.2",
|
||||
|
||||
Reference in New Issue
Block a user