diff --git a/js/components/ascribe_buttons/acl_button.js b/js/components/ascribe_buttons/acl_button.js index 6969aeb5..2aedc44f 100644 --- a/js/components/ascribe_buttons/acl_button.js +++ b/js/components/ascribe_buttons/acl_button.js @@ -51,7 +51,12 @@ let AclButton = React.createClass({ return { title: getLangText('Unconsign artwork'), tooltip: getLangText('Have the owner manage his sales again'), - form: , + form: ( + + ), handleSuccess: this.showNotification }; }else if (this.props.action === 'acl_transfer') { @@ -144,6 +149,20 @@ ${this.props.currentUser.username} ${getLangText('I consign')}: ${this.getTitlesString()} ${getLangText('to you')}. +${getLangText('Truly yours')}, +${this.props.currentUser.username} + ` + ); + }, + + // plz move to consign form + getUnConsignMessage(){ + return ( + `${getLangText('Hi')}, + +${getLangText('I un-consign')}: +${this.getTitlesString()} ${getLangText('from you')}. + ${getLangText('Truly yours')}, ${this.props.currentUser.username} ` diff --git a/js/components/ascribe_buttons/unconsign_request_button.js b/js/components/ascribe_buttons/unconsign_request_button.js new file mode 100644 index 00000000..11cbfa51 --- /dev/null +++ b/js/components/ascribe_buttons/unconsign_request_button.js @@ -0,0 +1,47 @@ +'use strict'; + +import React from 'react'; + +import Button from 'react-bootstrap/lib/Button'; + +import ModalWrapper from '../ascribe_modal/modal_wrapper'; +import UnConsignRequestForm from './../ascribe_forms/form_unconsign_request'; + +import { getLangText } from '../../utils/lang_utils.js'; +import apiUrls from '../../constants/api_urls'; + + +let UnConsignRequestButton = React.createClass({ + propTypes: { + currentUser: React.PropTypes.object.isRequired, + edition: React.PropTypes.object.isRequired, + handleSuccess: React.PropTypes.func.isRequired + }, + + render: function () { + return ( + + REQUEST UNCONSIGN + + } + handleSuccess={this.props.handleSuccess} + title='Request to Un-Consign' + tooltip='Ask the consignee to return the ownership of the work back to you'> + + + ); + } +}); + +export default UnConsignRequestButton; + diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 484aca0f..e1773760 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -28,6 +28,7 @@ import EditionFurtherDetails from './further_details'; import RequestActionForm from './../ascribe_forms/form_request_action'; import EditionActions from '../../actions/edition_actions'; import AclButtonList from './../ascribe_buttons/acl_button_list'; +import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button'; //import ReactS3FineUploader from './../ascribe_uploader/react_s3_fine_uploader'; @@ -81,12 +82,13 @@ let Edition = React.createClass({
+ show={this.props.edition.acl.acl_coa === true}> @@ -152,19 +154,20 @@ let Edition = React.createClass({ let EditionSummary = React.createClass({ propTypes: { - edition: React.PropTypes.object + edition: React.PropTypes.object, + handleSuccess: React.PropTypes.func, + currentUser: React.PropTypes.object }, getTransferWithdrawData(){ return {'bitcoin_id': this.props.edition.bitcoin_id}; }, - handleSuccess(){ - EditionActions.fetchOne(this.props.edition.id); - }, showNotification(response){ - this.handleSuccess(); - let notification = new GlobalNotificationModel(response.notification, 'success'); - GlobalNotificationActions.appendGlobalNotification(notification); + this.props.handleSuccess(); + if (response){ + let notification = new GlobalNotificationModel(response.notification, 'success'); + GlobalNotificationActions.appendGlobalNotification(notification); + } }, getStatus(){ let status = null; @@ -186,6 +189,7 @@ let EditionSummary = React.createClass({ if (this.props.edition.request_action && this.props.edition.request_action.length > 0){ actions = ( ); } @@ -205,6 +209,15 @@ let EditionSummary = React.createClass({ ); } + let unconsignRequestButton = null; + if (this.props.edition.acl.acl_request_unconsign) { + unconsignRequestButton = ( + + ); + } actions = ( @@ -212,8 +225,9 @@ let EditionSummary = React.createClass({ className="text-center ascribe-button-list" availableAcls={this.props.edition.acl} editions={[this.props.edition]} - handleSuccess={this.handleSuccess}> + handleSuccess={this.props.handleSuccess}> {withdrawButton} + {unconsignRequestButton} ); diff --git a/js/components/ascribe_forms/form_consign.js b/js/components/ascribe_forms/form_consign.js index beb06917..5815efdd 100644 --- a/js/components/ascribe_forms/form_consign.js +++ b/js/components/ascribe_forms/form_consign.js @@ -1,151 +1,8 @@ -//'use strict'; -// -//import React from 'react'; -// -//import ApiUrls from '../../constants/api_urls'; -//import FormMixin from '../../mixins/form_mixin'; -//import InputText from './input_text'; -//import InputTextArea from './input_textarea'; -//import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close'; -//import { getLangText } from '../../utils/lang_utils.js' -// -//let ConsignForm = React.createClass({ -// mixins: [FormMixin], -// -// -// url() { -// return ApiUrls.ownership_consigns; -// }, -// -// getFormData() { -// return { -// bitcoin_id: this.getBitcoinIds().join(), -// consignee: this.refs.consignee.state.value, -// consign_message: this.refs.consign_message.state.value, -// password: this.refs.password.state.value -// }; -// }, -// -// renderForm() { -// let title = this.getTitlesString().join(''); -// let username = this.props.currentUser.username; -// let message = -//`${getLangText('Hi')}, -// -//${getLangText('I consign')} : -//${title}${getLangText('to you')}. -// -//${getLangText('Truly yours')}, -//${username}`; -// -// return ( -//
-// -// -// -// -// -// -// -// ); -// } -//}); -////'use strict'; -//// -////import React from 'react'; -//// -////import ApiUrls from '../../constants/api_urls'; -////import FormMixin from '../../mixins/form_mixin'; -////import InputText from './input_text'; -////import InputTextArea from './input_textarea'; -////import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close'; -////import { getLangText } from '../../utils/lang_utils.js' -//// -////let TransferForm = React.createClass({ -//// mixins: [FormMixin], -//// -//// url() { -//// return ApiUrls.ownership_transfers; -//// }, -//// -//// getFormData() { -//// return { -//// bitcoin_id: this.getBitcoinIds().join(), -//// transferee: this.refs.transferee.state.value, -//// transfer_message: this.refs.transfer_message.state.value, -//// password: this.refs.password.state.value -//// }; -//// }, -//// -//// renderForm() { -//// let title = this.getTitlesString().join(''); -//// let username = this.props.currentUser.username; -//// let message = -////`${getLangText('Hi')}, -//// -////${getLangText('I transfer ownership of')} : -////${title}${getLangText('to you')}. -//// -////${getLangText('Truly yours')}, -////${username}`; -//// -//// return ( -////
-//// -//// -//// -//// -//// -////
-//// Make sure that display instructions and technology details are correct. -//// They cannot be edited after the transfer. -////
-//// -//// -//// ); -//// } -////}); -//// 'use strict'; import React from 'react'; import Button from 'react-bootstrap/lib/Button'; -import Alert from 'react-bootstrap/lib/Alert'; import Form from './form'; import Property from './property'; @@ -161,8 +18,6 @@ let ConsignForm = React.createClass({ url: React.PropTypes.string, id: React.PropTypes.object, message: React.PropTypes.string, - editions: React.PropTypes.array, - currentUser: React.PropTypes.object, onRequestHide: React.PropTypes.func, handleSuccess: React.PropTypes.func }, diff --git a/js/components/ascribe_forms/form_request_action.js b/js/components/ascribe_forms/form_request_action.js index f76aa1d5..622aa02f 100644 --- a/js/components/ascribe_forms/form_request_action.js +++ b/js/components/ascribe_forms/form_request_action.js @@ -7,6 +7,8 @@ import Alert from 'react-bootstrap/lib/Alert'; import apiUrls from '../../constants/api_urls'; import FormMixin from '../../mixins/form_mixin'; +import AclButton from './../ascribe_buttons/acl_button'; + import AppConstants from '../../constants/application_constants'; import { getLangText } from '../../utils/lang_utils.js'; @@ -52,15 +54,31 @@ let RequestActionForm = React.createClass({ renderForm() { let edition = this.props.editions[0]; + let buttonAccept = ( +
{getLangText('ACCEPT')} +
); + if (edition.request_action === 'unconsign'){ + console.log(this.props) + buttonAccept = ( + + ); + } let buttons = ( + - -
{getLangText('ACCEPT')}
-
- -
{getLangText('REJECT')}
-
+ {buttonAccept}
+ +
{getLangText('REJECT')}
+
+
); if (this.state.submitted){ buttons = ( diff --git a/js/components/ascribe_forms/form_transfer.js b/js/components/ascribe_forms/form_transfer.js index 7bfdd605..07821475 100644 --- a/js/components/ascribe_forms/form_transfer.js +++ b/js/components/ascribe_forms/form_transfer.js @@ -1,76 +1,3 @@ -//'use strict'; -// -//import React from 'react'; -// -//import ApiUrls from '../../constants/api_urls'; -//import FormMixin from '../../mixins/form_mixin'; -//import InputText from './input_text'; -//import InputTextArea from './input_textarea'; -//import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close'; -//import { getLangText } from '../../utils/lang_utils.js' -// -//let TransferForm = React.createClass({ -// mixins: [FormMixin], -// -// url() { -// return ApiUrls.ownership_transfers; -// }, -// -// getFormData() { -// return { -// bitcoin_id: this.getBitcoinIds().join(), -// transferee: this.refs.transferee.state.value, -// transfer_message: this.refs.transfer_message.state.value, -// password: this.refs.password.state.value -// }; -// }, -// -// renderForm() { -// let title = this.getTitlesString().join(''); -// let username = this.props.currentUser.username; -// let message = -//`${getLangText('Hi')}, -// -//${getLangText('I transfer ownership of')} : -//${title}${getLangText('to you')}. -// -//${getLangText('Truly yours')}, -//${username}`; -// -// return ( -//
-// -// -// -// -// -//
-// Make sure that display instructions and technology details are correct. -// They cannot be edited after the transfer. -//
-// -// -// ); -// } -//}); -// 'use strict'; import React from 'react'; diff --git a/js/components/ascribe_forms/form_unconsign.js b/js/components/ascribe_forms/form_unconsign.js index 80a1fa58..d33ccedf 100644 --- a/js/components/ascribe_forms/form_unconsign.js +++ b/js/components/ascribe_forms/form_unconsign.js @@ -2,59 +2,75 @@ import React from 'react'; -import ApiUrls from '../../constants/api_urls'; -import FormMixin from '../../mixins/form_mixin'; -import InputText from './input_text'; -import InputTextArea from './input_textarea'; -import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close'; -import { getLangText } from '../../utils/lang_utils.js' +import Button from 'react-bootstrap/lib/Button'; + +import Form from './form'; +import Property from './property'; +import InputTextAreaToggable from './input_textarea_toggable'; + +import AppConstants from '../../constants/application_constants'; +import { getLangText } from '../../utils/lang_utils.js'; + let UnConsignForm = React.createClass({ - mixins: [FormMixin], - - url() { - return ApiUrls.ownership_unconsigns; + propTypes: { + url: React.PropTypes.string, + id: React.PropTypes.object, + message: React.PropTypes.string, + editions: React.PropTypes.array, + onRequestHide: React.PropTypes.func, + handleSuccess: React.PropTypes.func }, - getFormData() { - return { - bitcoin_id: this.getBitcoinIds().join(), - unconsign_message: this.refs.unconsign_message.state.value, - password: this.refs.password.state.value - }; + getFormData(){ + return this.props.id; }, - renderForm() { - let title = this.getTitlesString().join(''); - let username = this.props.currentUser.username; - let message = -`${getLangText('Hi')}, - -${getLangText('I un-consign')}: -${title}${getLangText('from you')}. - -${getLangText('Truly yours')}, -${username}`; + render() { return ( -
- - - - - - +
+

+ + +

+ } + spinner={ +
+ +
}> + + + + + + +
+
); } }); diff --git a/js/components/ascribe_forms/form_unconsign_request.js b/js/components/ascribe_forms/form_unconsign_request.js index e2a53513..1978e151 100644 --- a/js/components/ascribe_forms/form_unconsign_request.js +++ b/js/components/ascribe_forms/form_unconsign_request.js @@ -2,48 +2,68 @@ import React from 'react'; -import ApiUrls from '../../constants/api_urls'; -import FormMixin from '../../mixins/form_mixin'; -import InputTextArea from './input_textarea'; -import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close'; -import { getLangText } from '../../utils/lang_utils.js' +import Button from 'react-bootstrap/lib/Button'; +import Alert from 'react-bootstrap/lib/Alert'; + +import Form from './form'; +import Property from './property'; +import InputTextAreaToggable from './input_textarea_toggable'; + + +import AppConstants from '../../constants/application_constants'; +import { getLangText } from '../../utils/lang_utils.js'; + let UnConsignRequestForm = React.createClass({ - mixins: [FormMixin], - - url() { - return ApiUrls.ownership_unconsigns_request; + propTypes: { + url: React.PropTypes.string, + id: React.PropTypes.object, + message: React.PropTypes.string, + onRequestHide: React.PropTypes.func, + handleSuccess: React.PropTypes.func }, - getFormData() { - return { - bitcoin_id: this.props.edition.bitcoin_id, - unconsign_request_message: this.refs.unconsign_request_message.state.value - }; + getFormData(){ + return this.props.id; }, - renderForm() { - let title = this.props.edition.title; - let username = this.props.currentUser.username; - let message = -`${getLangText('Hi')}, - -${getLangText('I request you to un-consign')} \" ${title} \". - -${getLangText('Truly yours')}, -${username}`; + render() { return ( -
- - - +
+

+ + +

+ } + spinner={ +
+ +
}> + + + +
+
); } });