mirror of
https://github.com/ascribe/onion.git
synced 2025-01-05 11:25:09 +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:
commit
4dcd66c05b
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,7 +7,7 @@ lib-cov
|
|||||||
*.pid
|
*.pid
|
||||||
*.gz
|
*.gz
|
||||||
*.sublime-project
|
*.sublime-project
|
||||||
|
.idea
|
||||||
spool-project.sublime-project
|
spool-project.sublime-project
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
@ -37,6 +37,8 @@ import DeleteButton from '../ascribe_buttons/delete_button';
|
|||||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
|
import Note from './note';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
import ApiUrls from '../../constants/api_urls';
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
|
|
||||||
@ -100,7 +102,12 @@ let Edition = React.createClass({
|
|||||||
this.transitionTo('pieces');
|
this.transitionTo('pieces');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getId() {
|
||||||
|
return {'bitcoin_id': this.props.edition.bitcoin_id};
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
console.log(!!this.props.edition.public_note || this.props.edition.acl.acl_edit)
|
||||||
return (
|
return (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={6}>
|
<Col md={6}>
|
||||||
@ -153,13 +160,25 @@ let Edition = React.createClass({
|
|||||||
title="Notes"
|
title="Notes"
|
||||||
show={(this.state.currentUser.username && true || false) ||
|
show={(this.state.currentUser.username && true || false) ||
|
||||||
(this.props.edition.acl.acl_edit || this.props.edition.public_note)}>
|
(this.props.edition.acl.acl_edit || this.props.edition.public_note)}>
|
||||||
<EditionPersonalNote
|
<Note
|
||||||
currentUser={this.state.currentUser}
|
id={this.getId}
|
||||||
handleSuccess={this.props.loadEdition}
|
label={getLangText('Personal note (private)')}
|
||||||
edition={this.props.edition}/>
|
defaultValue={this.props.edition.private_note ? this.props.edition.private_note : null}
|
||||||
<EditionPublicEditionNote
|
placeholder='Enter your comments ...'
|
||||||
handleSuccess={this.props.loadEdition}
|
editable={true}
|
||||||
edition={this.props.edition}/>
|
successMessage='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 ...'
|
||||||
|
editable={!!this.props.edition.acl.acl_edit}
|
||||||
|
show={!!this.props.edition.public_note || !!this.props.edition.acl.acl_edit}
|
||||||
|
successMessage='Public edition note saved'
|
||||||
|
url={ApiUrls.note_public_edition}
|
||||||
|
currentUser={this.state.currentUser}/>
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
|
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
@ -312,7 +331,7 @@ let EditionPersonalNote = React.createClass({
|
|||||||
if (this.props.currentUser.username && true || false) {
|
if (this.props.currentUser.username && true || false) {
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
url={ApiUrls.note_notes}
|
url={ApiUrls.note_private_edition}
|
||||||
handleSuccess={this.showNotification}>
|
handleSuccess={this.showNotification}>
|
||||||
<Property
|
<Property
|
||||||
name='note'
|
name='note'
|
||||||
|
66
js/components/ascribe_detail/note.js
Normal file
66
js/components/ascribe_detail/note.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import Form from './../ascribe_forms/form';
|
||||||
|
import Property from './../ascribe_forms/property';
|
||||||
|
import InputTextAreaToggable from './../ascribe_forms/input_textarea_toggable';
|
||||||
|
|
||||||
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
|
||||||
|
let Note = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
url: React.PropTypes.string,
|
||||||
|
id: React.PropTypes.func,
|
||||||
|
label: React.PropTypes.string,
|
||||||
|
currentUser: React.PropTypes.object,
|
||||||
|
defaultValue: React.PropTypes.string,
|
||||||
|
editable: React.PropTypes.bool,
|
||||||
|
show: React.PropTypes.bool,
|
||||||
|
placeholder: React.PropTypes.string,
|
||||||
|
successMessage: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefaultProps() {
|
||||||
|
return {
|
||||||
|
editable: true,
|
||||||
|
show: true,
|
||||||
|
placeholder: 'Enter a note',
|
||||||
|
successMessage: 'Note saved'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
showNotification(){
|
||||||
|
let notification = new GlobalNotificationModel(this.props.successMessage, 'success');
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if ((this.props.currentUser.username && true || false) && this.props.show) {
|
||||||
|
return (
|
||||||
|
<Form
|
||||||
|
url={this.props.url}
|
||||||
|
getFormData={this.props.id}
|
||||||
|
handleSuccess={this.showNotification}>
|
||||||
|
<Property
|
||||||
|
name='note'
|
||||||
|
label={this.props.label}
|
||||||
|
editable={this.props.editable}>
|
||||||
|
<InputTextAreaToggable
|
||||||
|
rows={1}
|
||||||
|
editable={this.props.editable}
|
||||||
|
defaultValue={this.props.defaultValue}
|
||||||
|
placeholder={this.props.placeholder}/>
|
||||||
|
</Property>
|
||||||
|
<hr />
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Note
|
@ -29,9 +29,7 @@ import DeleteButton from '../ascribe_buttons/delete_button';
|
|||||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
import Form from '../ascribe_forms/form';
|
import Note from './note';
|
||||||
import Property from '../ascribe_forms/property';
|
|
||||||
import InputTextAreaToggable from '../ascribe_forms/input_textarea_toggable';
|
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
import ApiUrls from '../../constants/api_urls';
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
@ -146,6 +144,10 @@ let PieceContainer = React.createClass({
|
|||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getId() {
|
||||||
|
return {'id': this.state.piece.id};
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if('title' in this.state.piece) {
|
if('title' in this.state.piece) {
|
||||||
return (
|
return (
|
||||||
@ -193,7 +195,20 @@ let PieceContainer = React.createClass({
|
|||||||
<HistoryIterator
|
<HistoryIterator
|
||||||
history={this.state.piece.loan_history} />
|
history={this.state.piece.loan_history} />
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
|
<CollapsibleParagraph
|
||||||
|
title="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 ...'
|
||||||
|
editable={true}
|
||||||
|
successMessage='Private note saved'
|
||||||
|
url={ApiUrls.note_private_piece}
|
||||||
|
currentUser={this.state.currentUser}/>
|
||||||
|
</CollapsibleParagraph>
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title="Further Details"
|
title="Further Details"
|
||||||
show={this.state.piece.acl.acl_edit
|
show={this.state.piece.acl.acl_edit
|
||||||
@ -207,11 +222,7 @@ let PieceContainer = React.createClass({
|
|||||||
otherData={this.state.piece.other_data}
|
otherData={this.state.piece.other_data}
|
||||||
handleSuccess={this.loadPiece}/>
|
handleSuccess={this.loadPiece}/>
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
{
|
|
||||||
//<PersonalNote
|
|
||||||
// piece={this.state.piece}
|
|
||||||
// currentUser={this.state.currentUser}/>
|
|
||||||
}
|
|
||||||
</Piece>
|
</Piece>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -224,43 +235,4 @@ let PieceContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let PersonalNote = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
piece: React.PropTypes.object,
|
|
||||||
currentUser: React.PropTypes.object
|
|
||||||
},
|
|
||||||
showNotification(){
|
|
||||||
let notification = new GlobalNotificationModel(getLangText('Jury note saved'), 'success');
|
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.props.currentUser.username && true || false) {
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
url={ApiUrls.note_notes}
|
|
||||||
handleSuccess={this.showNotification}>
|
|
||||||
<Property
|
|
||||||
name='value'
|
|
||||||
label={getLangText('Jury note')}
|
|
||||||
editable={true}>
|
|
||||||
<InputTextAreaToggable
|
|
||||||
rows={1}
|
|
||||||
editable={true}
|
|
||||||
defaultValue={this.props.piece.note_from_user ? this.props.piece.note_from_user.note : null}
|
|
||||||
placeholder={getLangText('Enter your comments...')}/>
|
|
||||||
</Property>
|
|
||||||
<Property hidden={true} name='piece_id'>
|
|
||||||
<input defaultValue={this.props.piece.id}/>
|
|
||||||
</Property>
|
|
||||||
<hr />
|
|
||||||
</Form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export default PieceContainer;
|
export default PieceContainer;
|
||||||
|
@ -22,8 +22,10 @@ let ApiUrls = {
|
|||||||
'editions': AppConstants.apiEndpoint + 'editions/', // this should be moved to the one below
|
'editions': AppConstants.apiEndpoint + 'editions/', // this should be moved to the one below
|
||||||
'editions_list': AppConstants.apiEndpoint + 'pieces/${piece_id}/editions/',
|
'editions_list': AppConstants.apiEndpoint + 'pieces/${piece_id}/editions/',
|
||||||
'licenses': AppConstants.apiEndpoint + 'ownership/licenses/',
|
'licenses': AppConstants.apiEndpoint + 'ownership/licenses/',
|
||||||
'note_notes': AppConstants.apiEndpoint + 'note/notes/',
|
'note_private_edition': AppConstants.apiEndpoint + 'note/private/editions/',
|
||||||
'note_edition': AppConstants.apiEndpoint + 'note/edition_notes/',
|
'note_private_piece': AppConstants.apiEndpoint + 'note/private/pieces/',
|
||||||
|
'note_public_edition': AppConstants.apiEndpoint + 'note/public/editions/',
|
||||||
|
'note_public_piece': AppConstants.apiEndpoint + 'note/public/pieces/',
|
||||||
'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/',
|
'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/',
|
||||||
'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/',
|
'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/',
|
||||||
'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/',
|
'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/',
|
||||||
|
Loading…
Reference in New Issue
Block a user