From 871836f636bcba97805b302b3034394a384c729c Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 16 Dec 2016 18:19:05 -0500 Subject: [PATCH 1/5] Adding description field to flags. --- client/coral-embed-stream/style/default.css | 2 ++ client/coral-plugin-flags/FlagButton.js | 27 ++++++++++----------- client/coral-plugin-flags/FlagComment.js | 3 ++- client/coral-plugin-flags/translations.json | 6 +++-- models/action.js | 1 + 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/client/coral-embed-stream/style/default.css b/client/coral-embed-stream/style/default.css index 463c8dc68..bc5ce27bc 100644 --- a/client/coral-embed-stream/style/default.css +++ b/client/coral-embed-stream/style/default.css @@ -241,6 +241,7 @@ hr { .coral-plugin-flags-popup-radio-label { margin:5px; font-size: 14px; + font-weight: 700; } .coral-plugin-flags-popup-counter { @@ -256,6 +257,7 @@ hr { .coral-plugin-flags-other-text { margin-left: 20px; + margin-top: 5px; width: 75%; } diff --git a/client/coral-plugin-flags/FlagButton.js b/client/coral-plugin-flags/FlagButton.js index d0b9cb6b4..57b3d1946 100644 --- a/client/coral-plugin-flags/FlagButton.js +++ b/client/coral-plugin-flags/FlagButton.js @@ -10,10 +10,9 @@ class FlagButton extends Component { state = { showMenu: false, - showOther: false, itemType: '', detail: '', - otherText: '', + description: '', step: 0, posted: false } @@ -30,7 +29,7 @@ class FlagButton extends Component { onPopupContinue = () => { const {postAction, addItem, updateItem, flag, id, author_id} = this.props; - const {itemType, field, detail, step, otherText, posted} = this.state; + const {itemType, field, detail, step, description, posted} = this.state; //Proceed to the next step or close the menu if we've reached the end if (step + 1 >= this.props.getPopupMenu.length) { @@ -42,7 +41,6 @@ class FlagButton extends Component { // If itemType and detail are both set, post the action if (itemType && detail && !posted) { // Set the text from the "other" field if it exists. - const updatedDetail = otherText || detail; let item_id; switch(itemType) { case 'comments': @@ -55,7 +53,8 @@ class FlagButton extends Component { const action = { action_type: 'flag', field, - detail: updatedDetail + detail, + description }; postAction(item_id, itemType, action) .then((action) => { @@ -92,7 +91,7 @@ class FlagButton extends Component { } onOtherTextChange = (e) => { - this.setState({otherText: e.target.value}); + this.setState({description: e.target.value}); } handleClickOutside () { @@ -141,16 +140,16 @@ class FlagButton extends Component { ) } { - this.state.showOther &&
- +
+