From a3656410b133d87be50447de175eff6ecd03ee68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 29 Sep 2015 14:25:30 +0200 Subject: [PATCH 01/12] Update component no PieceListStore changes --- .../piece_list_bulk_modal.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js index 452a9bd8..06fd98a0 100644 --- a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js +++ b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js @@ -33,21 +33,25 @@ let PieceListBulkModal = React.createClass({ ); }, - onChange(state) { - this.setState(state); - }, + componentDidMount() { EditionListStore.listen(this.onChange); UserStore.listen(this.onChange); + PieceListStore.listen(this.onChange); UserActions.fetchCurrentUser(); }, componentWillUnmount() { EditionListStore.unlisten(this.onChange); + PieceListStore.unlisten(this.onChange); UserStore.unlisten(this.onChange); }, + onChange(state) { + this.setState(state); + }, + fetchSelectedPieceEditionList() { let filteredPieceIdList = Object.keys(this.state.editionList) .filter((pieceId) => { From 550eb2dc0bfafd39e6be1fabd4fa5d3303f10e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 29 Sep 2015 15:23:57 +0200 Subject: [PATCH 02/12] Add fetchPieceList to PieceListBulkModal --- .../ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js index 06fd98a0..3e5b6495 100644 --- a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js +++ b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js @@ -39,7 +39,10 @@ let PieceListBulkModal = React.createClass({ EditionListStore.listen(this.onChange); UserStore.listen(this.onChange); PieceListStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); }, componentWillUnmount() { From 40095f7fbf06c388b571bf246cc9eec687b2dfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 29 Sep 2015 15:38:06 +0200 Subject: [PATCH 03/12] throw javascript errors on >= 400 HTTP errors --- js/stores/edition_list_store.js | 1 - js/utils/requests.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/js/stores/edition_list_store.js b/js/stores/edition_list_store.js index 87b4df76..b3b152d3 100644 --- a/js/stores/edition_list_store.js +++ b/js/stores/edition_list_store.js @@ -13,7 +13,6 @@ class EditionListStore { } onUpdateEditionList({pieceId, editionListOfPiece, page, pageSize, orderBy, orderAsc, count, filterBy}) { - /* Basically there are two modes an edition list can be updated. diff --git a/js/utils/requests.js b/js/utils/requests.js index fd676896..3761a7a0 100644 --- a/js/utils/requests.js +++ b/js/utils/requests.js @@ -21,7 +21,7 @@ class Requests { } unpackResponse(response) { - if (response.status >= 500) { + if (response.status >= 400) { throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url); } From cda81b6f5bd73abb9832fb7b31c91c7fe4534baf Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 29 Sep 2015 18:09:34 +0200 Subject: [PATCH 04/12] withdraw consign and acl buttonlist in detail refactor --- js/components/ascribe_detail/edition.js | 68 ++++++++++++++----------- js/constants/api_urls.js | 1 + 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 51884751..832ad386 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -38,6 +38,8 @@ import GlobalNotificationActions from '../../actions/global_notification_actions import Note from './note'; +import AclProxy from '../acl_proxy'; + import ApiUrls from '../../constants/api_urls'; import AppConstants from '../../constants/application_constants'; @@ -216,10 +218,6 @@ let EditionSummary = React.createClass({ refreshCollection: React.PropTypes.func }, - getTransferWithdrawData(){ - return {'bitcoin_id': this.props.edition.bitcoin_id}; - }, - handleSuccess() { this.props.refreshCollection(); this.props.handleSuccess(); @@ -261,30 +259,6 @@ let EditionSummary = React.createClass({ } else { - let withdrawButton = null; - if (this.props.edition.status.length > 0 && this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer) { - withdrawButton = ( -
- -
- ); - } - let unconsignRequestButton = null; - if (this.props.edition.acl.acl_request_unconsign) { - unconsignRequestButton = ( - - ); - } actions = ( @@ -293,11 +267,45 @@ let EditionSummary = React.createClass({ availableAcls={this.props.edition.acl} editions={[this.props.edition]} handleSuccess={this.handleSuccess}> - {withdrawButton} + +
{return {'bitcoin_id': this.props.edition.bitcoin_id}; }} + handleSuccess={this.showNotification} + className='inline' + isInline={true}> + +
+
+ +
{return {'bitcoin_id': this.props.edition.bitcoin_id}; }} + handleSuccess={this.showNotification} + className='inline' + isInline={true}> + +
+
+ + + - {unconsignRequestButton}
); diff --git a/js/constants/api_urls.js b/js/constants/api_urls.js index b8d6713d..2ff689fe 100644 --- a/js/constants/api_urls.js +++ b/js/constants/api_urls.js @@ -38,6 +38,7 @@ let ApiUrls = { 'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/', 'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/', 'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/', + 'ownership_consigns_withdraw': AppConstants.apiEndpoint + 'ownership/consigns/withdraw/', 'ownership_loans_pieces': AppConstants.apiEndpoint + 'ownership/loans/pieces/', 'ownership_loans_pieces_confirm': AppConstants.apiEndpoint + 'ownership/loans/pieces/confirm/', 'ownership_loans_pieces_deny': AppConstants.apiEndpoint + 'ownership/loans/pieces/deny/', From 4f6e39699f23fd05d51456f055b0ea6c07bd480e Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 30 Sep 2015 09:46:11 +0200 Subject: [PATCH 05/12] PR getlangtext --- js/components/ascribe_detail/edition.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 832ad386..e0ce16a5 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -277,7 +277,7 @@ let EditionSummary = React.createClass({ className='inline' isInline={true}> @@ -291,7 +291,7 @@ let EditionSummary = React.createClass({ className='inline' isInline={true}> From 7283ae7574ce94cd5c1c904e1226c86a46656c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 30 Sep 2015 11:22:20 +0200 Subject: [PATCH 06/12] PR Feedback: Change API error handling to saver approach --- js/actions/edition_list_actions.js | 5 +++++ js/utils/requests.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/actions/edition_list_actions.js b/js/actions/edition_list_actions.js index d13882cd..fb0a2249 100644 --- a/js/actions/edition_list_actions.js +++ b/js/actions/edition_list_actions.js @@ -33,6 +33,10 @@ class EditionListActions { EditionListFetcher .fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy) .then((res) => { + if(res && !res.editions) { + throw new Error('Piece has no editions to fetch.'); + } + this.actions.updateEditionList({ pieceId, page, @@ -46,6 +50,7 @@ class EditionListActions { resolve(res); }) .catch((err) => { + console.logGlobal(err); reject(err); }); }); diff --git a/js/utils/requests.js b/js/utils/requests.js index 3761a7a0..fd676896 100644 --- a/js/utils/requests.js +++ b/js/utils/requests.js @@ -21,7 +21,7 @@ class Requests { } unpackResponse(response) { - if (response.status >= 400) { + if (response.status >= 500) { throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url); } From 44cf707e3472ea1305b08e6f7f3b86306ae9ebed Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 30 Sep 2015 12:12:14 +0200 Subject: [PATCH 07/12] refactoring out edition_actions --- js/components/ascribe_detail/edition.js | 141 ++------------- .../ascribe_detail/edition_actions.js | 170 ++++++++++++++++++ 2 files changed, 184 insertions(+), 127 deletions(-) create mode 100644 js/components/ascribe_detail/edition_actions.js diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 8c718cc9..5a5df656 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -6,15 +6,11 @@ import Router from 'react-router'; import Row from 'react-bootstrap/lib/Row'; import Col from 'react-bootstrap/lib/Col'; import Glyphicon from 'react-bootstrap/lib/Glyphicon'; -import Button from 'react-bootstrap/lib/Button'; import UserActions from '../../actions/user_actions'; import UserStore from '../../stores/user_store'; import CoaActions from '../../actions/coa_actions'; import CoaStore from '../../stores/coa_store'; -import PieceListActions from '../../actions/piece_list_actions'; -import PieceListStore from '../../stores/piece_list_store'; -import EditionListActions from '../../actions/edition_list_actions'; import HistoryIterator from './history_iterator'; @@ -28,23 +24,14 @@ import EditionDetailProperty from './detail_property'; import LicenseDetail from './license_detail'; import EditionFurtherDetails from './further_details'; -import ListRequestActions from './../ascribe_forms/list_form_request_actions'; -import AclButtonList from './../ascribe_buttons/acl_button_list'; -import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button'; -import DeleteButton from '../ascribe_buttons/delete_button'; - -import GlobalNotificationModel from '../../models/global_notification_model'; -import GlobalNotificationActions from '../../actions/global_notification_actions'; +import EditionActions from './edition_actions'; import Note from './note'; -import AclProxy from '../acl_proxy'; - import ApiUrls from '../../constants/api_urls'; import AppConstants from '../../constants/application_constants'; import { getLangText } from '../../utils/lang_utils'; -import { mergeOptions } from '../../utils/general_utils'; let Link = Router.Link; /** @@ -59,15 +46,11 @@ let Edition = React.createClass({ mixins: [Router.Navigation], getInitialState() { - return mergeOptions( - UserStore.getState(), - PieceListStore.getState() - ); + return UserStore.getState(); }, componentDidMount() { UserStore.listen(this.onChange); - PieceListStore.listen(this.onChange); UserActions.fetchCurrentUser(); }, @@ -82,31 +65,12 @@ let Edition = React.createClass({ CoaActions.flushCoa(); UserStore.unlisten(this.onChange); - PieceListStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, - handleDeleteSuccess(response) { - this.refreshCollection(); - - EditionListActions.closeAllEditionLists(); - EditionListActions.clearAllEditionSelections(); - - let notification = new GlobalNotificationModel(response.notification, 'success'); - GlobalNotificationActions.appendGlobalNotification(notification); - - this.transitionTo('pieces'); - }, - - refreshCollection() { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, - this.state.orderBy, this.state.orderAsc, this.state.filterBy); - EditionListActions.refreshEditionList({pieceId: this.props.edition.parent}); - }, - render() { return ( @@ -123,12 +87,9 @@ let Edition = React.createClass({
- + currentUser={this.state.currentUser} + handleSuccess={this.props.loadEdition}/> @@ -211,25 +172,14 @@ let Edition = React.createClass({ let EditionSummary = React.createClass({ propTypes: { edition: React.PropTypes.object, - handleSuccess: React.PropTypes.func, currentUser: React.PropTypes.object, - handleDeleteSuccess: React.PropTypes.func, - refreshCollection: React.PropTypes.func + handleSuccess: React.PropTypes.func }, handleSuccess() { - this.props.refreshCollection(); this.props.handleSuccess(); }, - showNotification(response){ - this.props.handleSuccess(); - - if (response){ - let notification = new GlobalNotificationModel(response.notification, 'success'); - GlobalNotificationActions.appendGlobalNotification(notification); - } - }, getStatus(){ let status = null; if (this.props.edition.status.length > 0){ @@ -244,89 +194,26 @@ let EditionSummary = React.createClass({ return status; }, - getActions(){ - let actions = null; - if (this.props.edition && - this.props.edition.notifications && - this.props.edition.notifications.length > 0){ - actions = ( - ); - } - - else { - actions = ( - - - - -
{return {'bitcoin_id': this.props.edition.bitcoin_id}; }} - handleSuccess={this.showNotification} - className='inline' - isInline={true}> - -
-
- -
{return {'bitcoin_id': this.props.edition.bitcoin_id}; }} - handleSuccess={this.showNotification} - className='inline' - isInline={true}> - -
-
- - - - -
- -
); - } - return actions; - }, render() { + let { edition } = this.props; return (
+ value={ edition.edition_number + ' ' + getLangText('of') + ' ' + this.props.edition.num_editions} /> - + value={ edition.owner } /> + {this.getStatus()} - {this.getActions()} +
); diff --git a/js/components/ascribe_detail/edition_actions.js b/js/components/ascribe_detail/edition_actions.js new file mode 100644 index 00000000..c1d73dd2 --- /dev/null +++ b/js/components/ascribe_detail/edition_actions.js @@ -0,0 +1,170 @@ +'use strict'; + +import React from 'react'; +import Router from 'react-router'; + +import Row from 'react-bootstrap/lib/Row'; +import Col from 'react-bootstrap/lib/Col'; +import Button from 'react-bootstrap/lib/Button'; + +import EditionListActions from '../../actions/edition_list_actions'; +import PieceListActions from '../../actions/piece_list_actions'; +import PieceListStore from '../../stores/piece_list_store'; + +import Form from './../ascribe_forms/form'; +import Property from './../ascribe_forms/property'; + +import ListRequestActions from './../ascribe_forms/list_form_request_actions'; +import AclButtonList from './../ascribe_buttons/acl_button_list'; +import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button'; +import DeleteButton from '../ascribe_buttons/delete_button'; + +import GlobalNotificationModel from '../../models/global_notification_model'; +import GlobalNotificationActions from '../../actions/global_notification_actions'; + +import AclProxy from '../acl_proxy'; + +import ApiUrls from '../../constants/api_urls'; + +import { getLangText } from '../../utils/lang_utils'; + +/* + A component that handles all the actions inside of the edition detail + handleSuccess requires a loadEdition action (could be refactored) + */ +let EditionActions = React.createClass({ + propTypes: { + edition: React.PropTypes.object, + currentUser: React.PropTypes.object, + handleSuccess: React.PropTypes.func + }, + + mixins: [Router.Navigation], + + getInitialState() { + return PieceListStore.getState(); + }, + + componentDidMount() { + PieceListStore.listen(this.onChange); + }, + + componentWillUnmount() { + PieceListStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); + }, + + + handleDeleteSuccess(response) { + this.refreshCollection(); + + EditionListActions.closeAllEditionLists(); + EditionListActions.clearAllEditionSelections(); + + let notification = new GlobalNotificationModel(response.notification, 'success'); + GlobalNotificationActions.appendGlobalNotification(notification); + + this.transitionTo('pieces'); + }, + + refreshCollection() { + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); + EditionListActions.refreshEditionList({pieceId: this.props.edition.parent}); + }, + + handleSuccess(response){ + this.refreshCollection(); + this.props.handleSuccess(); + if (response){ + let notification = new GlobalNotificationModel(response.notification, 'success'); + GlobalNotificationActions.appendGlobalNotification(notification); + } + }, + + render(){ + let {edition, currentUser} = this.props; + + if (edition && + edition.notifications && + edition.notifications.length > 0){ + return ( + ); + } + + else { + return ( + + + + +
+ + +
+
+ +
+ + +
+
+ + + + +
+ +
+ ); + } + } +}); + +export default EditionActions; \ No newline at end of file From 0d6e82a45d3db0c496c6d4cd7d6bb0459f97cead Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 30 Sep 2015 15:08:45 +0200 Subject: [PATCH 08/12] WIP signup/login redirect and redirectAuthenticated --- js/components/ascribe_forms/form_login.js | 21 ++++++++++++++++++++- js/components/ascribe_forms/form_signup.js | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/js/components/ascribe_forms/form_login.js b/js/components/ascribe_forms/form_login.js index 79bced6c..dacad32c 100644 --- a/js/components/ascribe_forms/form_login.js +++ b/js/components/ascribe_forms/form_login.js @@ -44,6 +44,10 @@ let LoginForm = React.createClass({ componentDidMount() { UserStore.listen(this.onChange); + let { redirect } = this.getQuery(); + if (redirect !== 'login'){ + this.transitionTo(redirect, null, this.getQuery()); + } }, componentWillUnmount() { @@ -56,6 +60,15 @@ let LoginForm = React.createClass({ // if user is already logged in, redirect him to piece list if(this.state.currentUser && this.state.currentUser.email && this.props.redirectOnLoggedIn) { // FIXME: hack to redirect out of the dispatch cycle + let { redirectAuthenticated } = this.getQuery(); + if ( redirectAuthenticated) { + /* + * redirectAuthenticated contains an arbirary path + * eg pieces/, editions/, collection, settings, ... + * hence transitionTo cannot be used directly + */ + window.location = AppConstants.baseUrl + redirectAuthenticated; + } window.setTimeout(() => this.transitionTo('pieces'), 0); } }, @@ -79,7 +92,13 @@ let LoginForm = React.createClass({ Users on Stack Overflow claim this is a bug in chrome and should be fixed in the future. Until then, we redirect the HARD way, but reloading the whole page using window.location */ - window.location = AppConstants.baseUrl + 'collection'; + let { redirectAuthenticated } = this.getQuery(); + if ( redirectAuthenticated) { + window.location = AppConstants.baseUrl + redirectAuthenticated; + } + else { + window.location = AppConstants.baseUrl + 'collection'; + } } else if(this.props.onLogin) { // In some instances we want to give a callback to an outer container, // to show that the one login action the user triggered actually went through. diff --git a/js/components/ascribe_forms/form_signup.js b/js/components/ascribe_forms/form_signup.js index 790e8e2f..bfcabf1a 100644 --- a/js/components/ascribe_forms/form_signup.js +++ b/js/components/ascribe_forms/form_signup.js @@ -40,6 +40,10 @@ let SignupForm = React.createClass({ componentDidMount() { UserStore.listen(this.onChange); + let { redirect } = this.getQuery(); + if (redirect !== 'signup'){ + this.transitionTo(redirect, null, this.getQuery()); + } }, componentWillUnmount() { From bbae33a40f9b9022cfd5624bf43592ef2301b808 Mon Sep 17 00:00:00 2001 From: diminator Date: Wed, 30 Sep 2015 17:07:18 +0200 Subject: [PATCH 09/12] avoid dispatcherror when switching to signup --- js/components/ascribe_forms/form_signup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/components/ascribe_forms/form_signup.js b/js/components/ascribe_forms/form_signup.js index bfcabf1a..344787ab 100644 --- a/js/components/ascribe_forms/form_signup.js +++ b/js/components/ascribe_forms/form_signup.js @@ -55,7 +55,7 @@ let SignupForm = React.createClass({ // if user is already logged in, redirect him to piece list if(this.state.currentUser && this.state.currentUser.email) { - this.transitionTo('pieces'); + window.setTimeout(() => this.transitionTo('pieces')); } }, From dfa01a0dded1d78a8ae7b7cc60492a57403eb444 Mon Sep 17 00:00:00 2001 From: diminator Date: Thu, 1 Oct 2015 09:45:12 +0200 Subject: [PATCH 10/12] signup fix consign redirect --- js/components/ascribe_forms/form_signup.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/components/ascribe_forms/form_signup.js b/js/components/ascribe_forms/form_signup.js index 344787ab..ded34f7b 100644 --- a/js/components/ascribe_forms/form_signup.js +++ b/js/components/ascribe_forms/form_signup.js @@ -14,6 +14,7 @@ import Form from './form'; import Property from './property'; import InputCheckbox from './input_checkbox'; +import AppConstants from '../../constants/application_constants'; import ApiUrls from '../../constants/api_urls'; @@ -55,6 +56,15 @@ let SignupForm = React.createClass({ // if user is already logged in, redirect him to piece list if(this.state.currentUser && this.state.currentUser.email) { + let { redirectAuthenticated } = this.getQuery(); + if ( redirectAuthenticated) { + /* + * redirectAuthenticated contains an arbirary path + * eg pieces/, editions/, collection, settings, ... + * hence transitionTo cannot be used directly + */ + window.location = AppConstants.baseUrl + redirectAuthenticated; + } window.setTimeout(() => this.transitionTo('pieces')); } }, @@ -66,6 +76,15 @@ let SignupForm = React.createClass({ this.props.handleSuccess(getLangText('We sent an email to your address') + ' ' + response.user.email + ', ' + getLangText('please confirm') + '.'); } else if (response.redirect) { + let { redirectAuthenticated } = this.getQuery(); + if ( redirectAuthenticated) { + /* + * redirectAuthenticated contains an arbirary path + * eg pieces/, editions/, collection, settings, ... + * hence transitionTo cannot be used directly + */ + window.location = AppConstants.baseUrl + redirectAuthenticated; + } this.transitionTo('pieces'); } }, From b233dbb937bae9845db0879b6826fe3ff19eee8f Mon Sep 17 00:00:00 2001 From: diminator Date: Thu, 1 Oct 2015 09:49:01 +0200 Subject: [PATCH 11/12] PR fixes --- js/components/ascribe_detail/edition.js | 10 +++++----- .../{edition_actions.js => edition_action_panel.js} | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) rename js/components/ascribe_detail/{edition_actions.js => edition_action_panel.js} (98%) diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 5a5df656..62394631 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -24,7 +24,7 @@ import EditionDetailProperty from './detail_property'; import LicenseDetail from './license_detail'; import EditionFurtherDetails from './further_details'; -import EditionActions from './edition_actions'; +import EditionActionPanel from './edition_action_panel'; import Note from './note'; @@ -195,12 +195,12 @@ let EditionSummary = React.createClass({ }, render() { - let { edition } = this.props; + let { edition, currentUser } = this.props; return (
+ value={ edition.edition_number + ' ' + getLangText('of') + ' ' + edition.num_editions} /> {this.getStatus()} -
diff --git a/js/components/ascribe_detail/edition_actions.js b/js/components/ascribe_detail/edition_action_panel.js similarity index 98% rename from js/components/ascribe_detail/edition_actions.js rename to js/components/ascribe_detail/edition_action_panel.js index c1d73dd2..d82a6b8f 100644 --- a/js/components/ascribe_detail/edition_actions.js +++ b/js/components/ascribe_detail/edition_action_panel.js @@ -32,7 +32,7 @@ import { getLangText } from '../../utils/lang_utils'; A component that handles all the actions inside of the edition detail handleSuccess requires a loadEdition action (could be refactored) */ -let EditionActions = React.createClass({ +let EditionActionPanel = React.createClass({ propTypes: { edition: React.PropTypes.object, currentUser: React.PropTypes.object, @@ -57,7 +57,6 @@ let EditionActions = React.createClass({ this.setState(state); }, - handleDeleteSuccess(response) { this.refreshCollection(); @@ -167,4 +166,4 @@ let EditionActions = React.createClass({ } }); -export default EditionActions; \ No newline at end of file +export default EditionActionPanel; \ No newline at end of file From 5f201ad76a4df8af9abd6025f2dbc2d5b2241c1b Mon Sep 17 00:00:00 2001 From: diminator Date: Thu, 1 Oct 2015 15:38:37 +0200 Subject: [PATCH 12/12] fix redirect --- js/components/ascribe_forms/form_login.js | 2 +- js/components/ascribe_forms/form_signup.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/components/ascribe_forms/form_login.js b/js/components/ascribe_forms/form_login.js index dacad32c..290a4de7 100644 --- a/js/components/ascribe_forms/form_login.js +++ b/js/components/ascribe_forms/form_login.js @@ -45,7 +45,7 @@ let LoginForm = React.createClass({ componentDidMount() { UserStore.listen(this.onChange); let { redirect } = this.getQuery(); - if (redirect !== 'login'){ + if (redirect && redirect !== 'login'){ this.transitionTo(redirect, null, this.getQuery()); } }, diff --git a/js/components/ascribe_forms/form_signup.js b/js/components/ascribe_forms/form_signup.js index ded34f7b..0bed7cf9 100644 --- a/js/components/ascribe_forms/form_signup.js +++ b/js/components/ascribe_forms/form_signup.js @@ -42,7 +42,7 @@ let SignupForm = React.createClass({ componentDidMount() { UserStore.listen(this.onChange); let { redirect } = this.getQuery(); - if (redirect !== 'signup'){ + if (redirect && redirect !== 'signup'){ this.transitionTo(redirect, null, this.getQuery()); } },