mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
csrf subdomain
This commit is contained in:
parent
1ecd579718
commit
9cf060fdc4
43
js/components/ascribe_forms/form_note_edition.js
Normal file
43
js/components/ascribe_forms/form_note_edition.js
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import apiUrls from '../../constants/api_urls';
|
||||
import FormMixin from '../../mixins/form_mixin';
|
||||
|
||||
import InputTextAreaToggable from './input_textarea_toggable';
|
||||
|
||||
|
||||
let EditionNoteForm = React.createClass({
|
||||
mixins: [FormMixin],
|
||||
|
||||
url() {
|
||||
return apiUrls.note_edition;
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
return {
|
||||
bitcoin_id: this.getBitcoinIds().join(),
|
||||
note: this.refs.personalNote.state.value
|
||||
};
|
||||
},
|
||||
|
||||
renderForm() {
|
||||
|
||||
return (
|
||||
<form id="personal_note_content" role="form" key="personal_note_content">
|
||||
<InputTextAreaToggable
|
||||
ref="personalNote"
|
||||
className="form-control"
|
||||
defaultValue={this.props.editions[0].note_from_user}
|
||||
rows={3}
|
||||
editable={this.props.editable}
|
||||
required=""
|
||||
onSubmit={this.submit}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default EditionNoteForm;
|
@ -31,7 +31,7 @@ let PersonalNoteForm = React.createClass({
|
||||
className="form-control"
|
||||
defaultValue={this.props.editions[0].note_from_user}
|
||||
rows={3}
|
||||
editable={true}
|
||||
editable={this.props.editable}
|
||||
required=""
|
||||
onSubmit={this.submit}
|
||||
/>
|
||||
|
@ -14,6 +14,8 @@ import Button from 'react-bootstrap/lib/Button';
|
||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||
|
||||
import PersonalNoteForm from './ascribe_forms/form_note_personal';
|
||||
import EditionNoteForm from './ascribe_forms/form_note_edition';
|
||||
|
||||
import PieceExtraDataForm from './ascribe_forms/form_piece_extradata';
|
||||
import RequestActionForm from './ascribe_forms/form_request_action';
|
||||
|
||||
@ -90,14 +92,21 @@ let Edition = React.createClass({
|
||||
<EditionSummary
|
||||
edition={this.props.edition} />
|
||||
<CollapsibleEditionDetails
|
||||
title="Personal Note"
|
||||
show={this.state.currentUser && true || false}
|
||||
title="Personal Note (private)"
|
||||
show={this.state.currentUser.username && true || false}
|
||||
iconName="pencil">
|
||||
<EditionPersonalNote
|
||||
currentUser={this.state.currentUser}
|
||||
handleSuccess={this.props.loadEdition}
|
||||
edition={this.props.edition}/>
|
||||
</CollapsibleEditionDetails>
|
||||
<CollapsibleEditionDetails
|
||||
title="Edition Note (public)"
|
||||
iconName="pencil">
|
||||
<EditionPublicEditionNote
|
||||
handleSuccess={this.props.loadEdition}
|
||||
edition={this.props.edition}/>
|
||||
</CollapsibleEditionDetails>
|
||||
<CollapsibleEditionDetails
|
||||
title="Further Details">
|
||||
<EditionFurtherDetails
|
||||
@ -364,7 +373,7 @@ let EditionPersonalNote = React.createClass({
|
||||
},
|
||||
showNotification(){
|
||||
this.props.handleSuccess();
|
||||
let notification = new GlobalNotificationModel('Note saved', 'success');
|
||||
let notification = new GlobalNotificationModel('Private note saved', 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
render() {
|
||||
@ -372,6 +381,7 @@ let EditionPersonalNote = React.createClass({
|
||||
<Row>
|
||||
<Col md={12} className="ascribe-edition-personal-note">
|
||||
<PersonalNoteForm
|
||||
editable={true}
|
||||
handleSuccess={this.showNotification}
|
||||
editions={[this.props.edition]} />
|
||||
</Col>
|
||||
@ -381,6 +391,30 @@ let EditionPersonalNote = React.createClass({
|
||||
});
|
||||
|
||||
|
||||
let EditionPublicEditionNote = React.createClass({
|
||||
propTypes: {
|
||||
edition: React.PropTypes.object,
|
||||
handleSuccess: React.PropTypes.func
|
||||
},
|
||||
showNotification(){
|
||||
this.props.handleSuccess();
|
||||
let notification = new GlobalNotificationModel('Public note saved', 'success');
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<Row>
|
||||
<Col md={12} className="ascribe-edition-personal-note">
|
||||
<EditionNoteForm
|
||||
editable={this.props.edition.acl.indexOf('edit') > -1}
|
||||
handleSuccess={this.showNotification}
|
||||
editions={[this.props.edition]} />
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let EditionFurtherDetails = React.createClass({
|
||||
propTypes: {
|
||||
|
@ -8,6 +8,7 @@ let apiUrls = {
|
||||
'edition_remove_from_collection': AppConstants.apiEndpoint + 'ownership/shares/${edition_id}/',
|
||||
'editions_list': AppConstants.apiEndpoint + 'pieces/${piece_id}/editions/',
|
||||
'note_notes': AppConstants.apiEndpoint + 'note/notes/',
|
||||
'note_edition': AppConstants.apiEndpoint + 'note/edition_notes/',
|
||||
'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/',
|
||||
'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/',
|
||||
'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/',
|
||||
|
Loading…
Reference in New Issue
Block a user