From 3c06ee9360f6595319454c7a9f555ee65ec4fc16 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 9 May 2017 12:21:21 -0300 Subject: [PATCH 1/2] Adds slots to admin stream --- .../ModerationQueue/components/Comment.js | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js index e5afd9726..8726cc75c 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/Comment.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/Comment.js @@ -1,16 +1,17 @@ import React, {PropTypes} from 'react'; import timeago from 'timeago.js'; +import {Link} from 'react-router'; import Linkify from 'react-linkify'; import Highlighter from 'react-highlight-words'; -import {Link} from 'react-router'; import styles from './styles.css'; import {Icon} from 'coral-ui'; import FlagBox from './FlagBox'; import CommentType from './CommentType'; +import Slot from 'coral-framework/components/Slot'; +import {getActionSummary} from 'coral-framework/utils'; import ActionButton from 'coral-admin/src/components/ActionButton'; import BanUserButton from 'coral-admin/src/components/BanUserButton'; -import {getActionSummary} from 'coral-framework/utils'; const linkify = new Linkify(); @@ -50,6 +51,10 @@ const Comment = ({actions = [], comment, ...props}) => { {lang.t('comment.banned_user')} : null} +
Story: {comment.asset.title} @@ -62,6 +67,10 @@ const Comment = ({actions = [], comment, ...props}) => { +

{links ? Contains Link : null} @@ -78,9 +87,19 @@ const Comment = ({actions = [], comment, ...props}) => { rejectComment={() => props.rejectComment({commentId: comment.id})} />; })}
+
+
+ +
{ flagActions && flagActions.length ? From 52b0819e7874802182dfa317efb761927a26c81c Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 9 May 2017 14:02:35 -0300 Subject: [PATCH 2/2] Adding example for plugins within the Admin Comment Queue --- .gitignore | 1 + plugins/coral-plugin-mod/client/.babelrc | 14 ++++++++ .../coral-plugin-mod/client/.eslintrc.json | 23 +++++++++++++ .../coral-plugin-mod/client/components/Box.js | 8 +++++ .../client/components/Container.js | 32 +++++++++++++++++++ .../client/components/styles.css | 8 +++++ plugins/coral-plugin-mod/client/index.js | 7 ++++ plugins/coral-plugin-mod/index.js | 4 +++ 8 files changed, 97 insertions(+) create mode 100644 plugins/coral-plugin-mod/client/.babelrc create mode 100644 plugins/coral-plugin-mod/client/.eslintrc.json create mode 100644 plugins/coral-plugin-mod/client/components/Box.js create mode 100644 plugins/coral-plugin-mod/client/components/Container.js create mode 100644 plugins/coral-plugin-mod/client/components/styles.css create mode 100644 plugins/coral-plugin-mod/client/index.js create mode 100644 plugins/coral-plugin-mod/index.js diff --git a/.gitignore b/.gitignore index a619f0988..9f04eb4b8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,6 @@ plugins/* !plugins/coral-plugin-respect !plugins/coral-plugin-offtopic !plugins/coral-plugin-like +!plugins/coral-plugin-mod **/node_modules/* diff --git a/plugins/coral-plugin-mod/client/.babelrc b/plugins/coral-plugin-mod/client/.babelrc new file mode 100644 index 000000000..60be246eb --- /dev/null +++ b/plugins/coral-plugin-mod/client/.babelrc @@ -0,0 +1,14 @@ +{ + "presets": [ + "es2015" + ], + "plugins": [ + "add-module-exports", + "transform-class-properties", + "transform-decorators-legacy", + "transform-object-assign", + "transform-object-rest-spread", + "transform-async-to-generator", + "transform-react-jsx" + ] +} \ No newline at end of file diff --git a/plugins/coral-plugin-mod/client/.eslintrc.json b/plugins/coral-plugin-mod/client/.eslintrc.json new file mode 100644 index 000000000..9fe56bd14 --- /dev/null +++ b/plugins/coral-plugin-mod/client/.eslintrc.json @@ -0,0 +1,23 @@ +{ + "env": { + "browser": true, + "es6": true, + "mocha": true + }, + "parserOptions": { + "sourceType": "module", + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "jsx": true + } + }, + "parser": "babel-eslint", + "plugins": [ + "react" + ], + "rules": { + "react/jsx-uses-react": "error", + "react/jsx-uses-vars": "error", + "no-console": ["warn", { "allow": ["warn", "error"] }] + } +} diff --git a/plugins/coral-plugin-mod/client/components/Box.js b/plugins/coral-plugin-mod/client/components/Box.js new file mode 100644 index 000000000..15f5320b1 --- /dev/null +++ b/plugins/coral-plugin-mod/client/components/Box.js @@ -0,0 +1,8 @@ +import React from 'react'; +import styles from './styles.css' + +export default (props) => ( +
+ Comment Status: {props.comment.status} +
+) \ No newline at end of file diff --git a/plugins/coral-plugin-mod/client/components/Container.js b/plugins/coral-plugin-mod/client/components/Container.js new file mode 100644 index 000000000..712031fdf --- /dev/null +++ b/plugins/coral-plugin-mod/client/components/Container.js @@ -0,0 +1,32 @@ +import React from 'react'; +import Box from './Box'; +import {Button} from 'coral-ui' +import styles from './styles.css'; + +export default class Footer extends React.Component { + constructor() { + super(); + + this.state = { + show: false + }; + } + + handleClick = () => { + this.setState(state => ({ + show: !state.show + })) + } + + render() { + const {show} = this.state; + return ( +
+ + {show ? : null} +
+ ); + } +} diff --git a/plugins/coral-plugin-mod/client/components/styles.css b/plugins/coral-plugin-mod/client/components/styles.css new file mode 100644 index 000000000..59bb63c3d --- /dev/null +++ b/plugins/coral-plugin-mod/client/components/styles.css @@ -0,0 +1,8 @@ +.container { + padding: 0 14px 10px; +} + +.box { + font-size: 12px; + padding: 10px 14px; +} \ No newline at end of file diff --git a/plugins/coral-plugin-mod/client/index.js b/plugins/coral-plugin-mod/client/index.js new file mode 100644 index 000000000..b0ea304f4 --- /dev/null +++ b/plugins/coral-plugin-mod/client/index.js @@ -0,0 +1,7 @@ +import Container from './components/Container'; + +export default { + slots: { + adminCommentDetailArea: [Container], + } +}; diff --git a/plugins/coral-plugin-mod/index.js b/plugins/coral-plugin-mod/index.js new file mode 100644 index 000000000..42d90e144 --- /dev/null +++ b/plugins/coral-plugin-mod/index.js @@ -0,0 +1,4 @@ +const {readFileSync} = require('fs'); +const path = require('path'); + +module.exports = {};