1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Merge branch 'AD-613-cyland-white-label-page' of bitbucket.org:ascribe/onion into AD-613-cyland-white-label-page

This commit is contained in:
Tim Daubenschütz 2015-08-24 11:22:54 +02:00
commit 96fe1c69c6
3 changed files with 11 additions and 91 deletions

View File

@ -25,7 +25,6 @@ import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph
import Form from './../ascribe_forms/form';
import Property from './../ascribe_forms/property';
import EditionDetailProperty from './detail_property';
import InputTextAreaToggable from './../ascribe_forms/input_textarea_toggable';
import EditionFurtherDetails from './further_details';
@ -107,7 +106,6 @@ let Edition = React.createClass({
},
render() {
console.log(!!this.props.edition.public_note || this.props.edition.acl.acl_edit)
return (
<Row>
<Col md={6}>
@ -164,19 +162,19 @@ let Edition = React.createClass({
id={this.getId}
label={getLangText('Personal note (private)')}
defaultValue={this.props.edition.private_note ? this.props.edition.private_note : null}
placeholder='Enter your comments ...'
placeholder={getLangText('Enter your comments ...')}
editable={true}
successMessage='Private note saved'
successMessage={getLangText('Private note saved')}
url={ApiUrls.note_private_edition}
currentUser={this.state.currentUser}/>
<Note
id={this.getId}
label={getLangText('Edition note (public)')}
defaultValue={this.props.edition.public_note ? this.props.edition.public_note : null}
placeholder='Enter your comments ...'
placeholder={getLangText('Enter your comments ...')}
editable={!!this.props.edition.acl.acl_edit}
show={!!this.props.edition.public_note || !!this.props.edition.acl.acl_edit}
successMessage='Public edition note saved'
successMessage={getLangText('Public edition note saved')}
url={ApiUrls.note_public_edition}
currentUser={this.state.currentUser}/>
</CollapsibleParagraph>
@ -315,84 +313,6 @@ let EditionSummary = React.createClass({
});
let EditionPersonalNote = React.createClass({
propTypes: {
edition: React.PropTypes.object,
currentUser: React.PropTypes.object,
handleSuccess: React.PropTypes.func
},
showNotification(){
this.props.handleSuccess();
let notification = new GlobalNotificationModel(getLangText('Private note saved'), 'success');
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() {
if (this.props.currentUser.username && true || false) {
return (
<Form
url={ApiUrls.note_private_edition}
handleSuccess={this.showNotification}>
<Property
name='note'
label={getLangText('Personal note (private)')}
editable={true}>
<InputTextAreaToggable
rows={1}
editable={true}
defaultValue={this.props.edition.note_from_user}
placeholder={getLangText('Enter a personal note%s', '...')}/>
</Property>
<Property hidden={true} name='bitcoin_id'>
<input defaultValue={this.props.edition.bitcoin_id}/>
</Property>
<hr />
</Form>
);
}
return null;
}
});
let EditionPublicEditionNote = React.createClass({
propTypes: {
edition: React.PropTypes.object,
handleSuccess: React.PropTypes.func
},
showNotification(){
this.props.handleSuccess();
let notification = new GlobalNotificationModel(getLangText('Public note saved'), 'success');
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() {
let isEditable = this.props.edition.acl.acl_edit;
if (isEditable || this.props.edition.public_note){
return (
<Form
url={ApiUrls.note_edition}
handleSuccess={this.showNotification}>
<Property
name='note'
label={getLangText('Edition note (public)')}
editable={isEditable}>
<InputTextAreaToggable
rows={1}
editable={isEditable}
defaultValue={this.props.edition.public_note}
placeholder={getLangText('Enter a public note for this edition%s', '...')}
required="required"/>
</Property>
<Property hidden={true} name='bitcoin_id'>
<input defaultValue={this.props.edition.bitcoin_id}/>
</Property>
<hr />
</Form>
);
}
return null;
}
});
let CoaDetails = React.createClass({
propTypes: {
edition: React.PropTypes.object

View File

@ -28,8 +28,8 @@ let Note = React.createClass({
return {
editable: true,
show: true,
placeholder: 'Enter a note',
successMessage: 'Note saved'
placeholder: getLangText('Enter a note'),
successMessage: getLangText('Note saved')
};
},
@ -39,7 +39,7 @@ let Note = React.createClass({
},
render() {
if ((this.props.currentUser.username && true || false) && this.props.show) {
if (!!this.props.currentUser.username && this.props.show) {
return (
<Form
url={this.props.url}

View File

@ -196,21 +196,21 @@ let PieceContainer = React.createClass({
history={this.state.piece.loan_history} />
</CollapsibleParagraph>
<CollapsibleParagraph
title="Notes"
title={getLangText('Notes')}
show={(this.state.currentUser.username && true || false) ||
(this.state.piece.public_note)}>
<Note
id={this.getId}
label={getLangText('Personal note (private)')}
defaultValue={this.state.piece.private_note ? this.state.piece.private_note : null}
placeholder='Enter your comments ...'
placeholder={getLangText('Enter your comments ...')}
editable={true}
successMessage='Private note saved'
successMessage={getLangText('Private note saved')}
url={ApiUrls.note_private_piece}
currentUser={this.state.currentUser}/>
</CollapsibleParagraph>
<CollapsibleParagraph
title="Further Details"
title={getLangText('Further Details')}
show={this.state.piece.acl.acl_edit
|| Object.keys(this.state.piece.extra_data).length > 0
|| this.state.piece.other_data.length > 0}