From e0eb31d1def734d2915dce13f39c7b28c2764334 Mon Sep 17 00:00:00 2001 From: diminator Date: Tue, 14 Jul 2015 11:42:09 +0200 Subject: [PATCH] transfer + withdraw --- js/components/ascribe_buttons/acl_button.js | 30 ++- js/components/ascribe_detail/edition.js | 35 +-- .../ascribe_forms/form_request_action.js | 2 +- js/components/ascribe_forms/form_transfer.js | 207 +++++++++++++----- .../ascribe_forms/input_textarea_toggable.js | 1 + sass/main.scss | 4 + 6 files changed, 205 insertions(+), 74 deletions(-) diff --git a/js/components/ascribe_buttons/acl_button.js b/js/components/ascribe_buttons/acl_button.js index e3998759..c3e6e2ec 100644 --- a/js/components/ascribe_buttons/acl_button.js +++ b/js/components/ascribe_buttons/acl_button.js @@ -50,10 +50,21 @@ let AclButton = React.createClass({ handleSuccess: this.showNotification }; }else if (this.props.action === 'acl_transfer') { + //return { + // title: getLangText('Transfer artwork'), + // tooltip: getLangText('Transfer the ownership of the artwork'), + // form: , + // handleSuccess: this.showNotification + //}; return { title: getLangText('Transfer artwork'), tooltip: getLangText('Transfer the ownership of the artwork'), - form: , + form: ( + + ), handleSuccess: this.showNotification }; } @@ -112,11 +123,24 @@ let AclButton = React.createClass({ } }, +// plz move to share form + getTransferMessage(){ + return ( + `${getLangText('Hi')}, + +${getLangText('I transfer ownership of')}: +${this.getTitlesString()} ${getLangText('to you')}. + +${getLangText('Truly yours')}, +${this.props.currentUser.username} + ` + ); + }, + // plz move to share form getShareMessage(){ return ( - ` -${getLangText('Hi')}, + `${getLangText('Hi')}, ${getLangText('I am sharing')}: ${this.getTitlesString()} ${getLangText('with you')}. diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 0edcf4b8..484aca0f 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -6,6 +6,7 @@ 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'; @@ -172,18 +173,9 @@ let EditionSummary = React.createClass({ status = ; if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){ status = ( -
- - - -
+ + + ); } } @@ -197,7 +189,22 @@ let EditionSummary = React.createClass({ editions={ [this.props.edition] } handleSuccess={this.showNotification}/>); } + 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 = ( +
+ +
+ ); + } actions = ( @@ -205,7 +212,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.handleSuccess}> + {withdrawButton} + ); } diff --git a/js/components/ascribe_forms/form_request_action.js b/js/components/ascribe_forms/form_request_action.js index 4eb3f394..666422e6 100644 --- a/js/components/ascribe_forms/form_request_action.js +++ b/js/components/ascribe_forms/form_request_action.js @@ -8,7 +8,7 @@ import apiUrls from '../../constants/api_urls'; import FormMixin from '../../mixins/form_mixin'; import AppConstants from '../../constants/application_constants'; -import { getLangText } from '../../utils/lang_utils.js' +import { getLangText } from '../../utils/lang_utils.js'; let RequestActionForm = React.createClass({ mixins: [FormMixin], diff --git a/js/components/ascribe_forms/form_transfer.js b/js/components/ascribe_forms/form_transfer.js index f10455d1..a965610e 100644 --- a/js/components/ascribe_forms/form_transfer.js +++ b/js/components/ascribe_forms/form_transfer.js @@ -1,72 +1,165 @@ +//'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 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 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 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 - }; + propTypes: { + 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 }, - renderForm() { - let title = this.getTitlesString().join(''); - let username = this.props.currentUser.username; - let message = -`${getLangText('Hi')}, + getFormData(){ + return this.props.id; + }, -${getLangText('I transfer ownership of')} : -${title}${getLangText('to you')}. - -${getLangText('Truly yours')}, -${username}`; + render() { return ( -
- - - - - -
- Make sure that display instructions and technology details are correct. + +

+ + +

+
} + spinner={ +
+ +
}> + + + + + + + + + +
+
+ + Make sure that display instructions and technology details are correct.
They cannot be edited after the transfer. - - - +
+ ); } }); diff --git a/js/components/ascribe_forms/input_textarea_toggable.js b/js/components/ascribe_forms/input_textarea_toggable.js index 222a6e36..fe372bdd 100644 --- a/js/components/ascribe_forms/input_textarea_toggable.js +++ b/js/components/ascribe_forms/input_textarea_toggable.js @@ -32,6 +32,7 @@ let InputTextAreaToggable = React.createClass({ className={className} value={this.state.value} rows={this.props.rows} + maxRows={10} required={this.props.required} onChange={this.handleChange} onBlur={this.props.onBlur} diff --git a/sass/main.scss b/sass/main.scss index 073c8937..462810fc 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -58,6 +58,10 @@ hr { .no-padding{ padding: 0; } +.inline{ + display: inline; +} + .navbar-default { border: none; border-left:0;