From d3cc6a500705784dce0e11ce3aea3c7c746f6b3f Mon Sep 17 00:00:00 2001 From: diminator Date: Fri, 28 Aug 2015 15:24:32 +0200 Subject: [PATCH] request actions first cut --- js/actions/piece_list_actions.js | 2 +- .../accordion_list_item_wallet.js | 5 +- js/components/piece_list.js | 26 +++++++ .../ascribe_detail/prize_piece_container.js | 1 - js/stores/piece_list_store.js | 21 +++++- sass/ascribe_accordion_list.scss | 2 +- sass/ascribe_global_action.scss | 73 +++++++++++++++++++ sass/main.scss | 1 + 8 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 sass/ascribe_global_action.scss diff --git a/js/actions/piece_list_actions.js b/js/actions/piece_list_actions.js index 1ebe7f42..d1ff363c 100644 --- a/js/actions/piece_list_actions.js +++ b/js/actions/piece_list_actions.js @@ -55,7 +55,7 @@ class PieceListActions { PieceListFetcher .fetchRequestActions() .then((res) => { - this.actions.updatePieceListRequestActions(res.piece_ids); + this.actions.updatePieceListRequestActions(res); }) .catch((err) => console.logGlobal(err)); } diff --git a/js/components/ascribe_accordion_list/accordion_list_item_wallet.js b/js/components/ascribe_accordion_list/accordion_list_item_wallet.js index f7bca334..178a7db4 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_wallet.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_wallet.js @@ -61,12 +61,13 @@ let AccordionListItemWallet = React.createClass({ }, getGlyphicon(){ - if (this.props.content.requestAction && this.props.content.requestAction.length > 0) { + if ((this.props.content.request_action && this.props.content.request_action.length > 0) || + (this.props.content.request_action_editions)){ return ( {getLangText('You have actions pending in one of your editions')}}> + overlay={{getLangText('You have actions pending')}}> ); } diff --git a/js/components/piece_list.js b/js/components/piece_list.js index 79f1471c..185b0f05 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -147,8 +147,34 @@ let PieceList = React.createClass({ render() { let loadingElement = (); let AccordionListItemType = this.props.accordionListItemType; + + let pieceActions = null; + if (this.state.requestActions && this.state.requestActions.pieces){ + pieceActions = this.state.requestActions.pieces.map((item) => { + return ( +
+ test +
); + }); + } + let editionActions = null; + if (this.state.requestActions && this.state.requestActions.editions){ + for (let pieceId in this.state.requestActions.editions) { + editionActions = this.state.requestActions.editions[pieceId].map((item) => { + return ( +
+ test +
); + }); + } + } + return (
+
+ {pieceActions} + {editionActions} +
{ - piece.requestAction = requestActions.indexOf(piece.id) > -1; - }); + onUpdatePieceListRequestActions(res) { + this.requestActions.pieces = res.piece_actions; + this.requestActions.editions = res.edition_actions; + for (let pieceId in res.edition_actions){ + try { + this.onUpdatePropertyForPiece({ + pieceId: parseInt(pieceId, 10), + key: 'request_action_editions', + value: res.edition_actions[pieceId] + }); + } + catch(err) { + console.warn('couldnt match request action with piecelist, maybe on other page'); + } + + } } onUpdatePropertyForPiece({pieceId, key, value}) { diff --git a/sass/ascribe_accordion_list.scss b/sass/ascribe_accordion_list.scss index 1ef4bef9..6f809b27 100644 --- a/sass/ascribe_accordion_list.scss +++ b/sass/ascribe_accordion_list.scss @@ -158,7 +158,7 @@ span.ascribe-accordion-list-table-toggle { right: 0px; color: $ascribe-color-green; font-size: 1.2em; - padding: 0.3em; + padding: 0.8em; } .ascribe-accordion-list-item-edition-widget { diff --git a/sass/ascribe_global_action.scss b/sass/ascribe_global_action.scss new file mode 100644 index 00000000..bcc3f50d --- /dev/null +++ b/sass/ascribe_global_action.scss @@ -0,0 +1,73 @@ +.ascribe-global-action-wrapper { + position: fixed; + width: 100%; + height:3.5em; + left:0; + top:0; + z-index: 2000; + display:table; +} + +.ascribe-global-action { + width: 40%; + margin: 1px auto; + text-align: center; + padding: 1em; + color: black; + border: 1px solid #cccccc; + background-color: white; +} + +.ascribe-global-notification-off { + bottom: -3.5em; +} + +.ascribe-global-notification-on { + bottom: 0; +} + +.ascribe-global-notification > div, .ascribe-global-notification-bubble > div { + display:table-cell; + vertical-align: middle; + font-size: 1.25em; + font-family: 'Source Sans Pro'; + text-align: right; + padding-right: 3em; +} + +.ascribe-global-notification-bubble > div { + padding: .75em 1.5em .75em 1.5em; +} + +.ascribe-global-notification-bubble { + position: fixed; + bottom: 3em; + right: -50em; + + display:table; + + height: 3.5em; + + background-color: #212121; + border-radius: 2px; + + color: white; + + transition: 1s right ease; +} + +.ascribe-global-notification-bubble-off { + right: -100em; +} + +.ascribe-global-notification-bubble-on { + right: 3.5em; +} + +.ascribe-global-notification-danger { + background-color: #d9534f; +} + +.ascribe-global-notification-success { + background-color: rgba(2, 182, 163, 1); +} \ No newline at end of file diff --git a/sass/main.scss b/sass/main.scss index a6ab05b3..34bf42b1 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -22,6 +22,7 @@ $BASE_URL: '<%= BASE_URL %>'; @import 'ascribe_media_player'; @import 'ascribe_uploader'; @import 'ascribe_footer'; +@import 'ascribe_global_action'; @import 'ascribe_global_notification'; @import 'ascribe_piece_register'; @import 'offset_right';