From 9cf060fdc46141981c21d3d4f669b30eb712b5be Mon Sep 17 00:00:00 2001 From: ddejongh Date: Tue, 16 Jun 2015 14:49:00 +0200 Subject: [PATCH] csrf subdomain --- .../ascribe_forms/form_note_edition.js | 43 +++++++++++++++++++ .../ascribe_forms/form_note_personal.js | 2 +- js/components/edition.js | 40 +++++++++++++++-- js/constants/api_urls.js | 1 + 4 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 js/components/ascribe_forms/form_note_edition.js diff --git a/js/components/ascribe_forms/form_note_edition.js b/js/components/ascribe_forms/form_note_edition.js new file mode 100644 index 00000000..d6f90175 --- /dev/null +++ b/js/components/ascribe_forms/form_note_edition.js @@ -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 ( +
+ + + ); + } +}); + +export default EditionNoteForm; \ No newline at end of file diff --git a/js/components/ascribe_forms/form_note_personal.js b/js/components/ascribe_forms/form_note_personal.js index 282afcdf..7f3c4f2b 100644 --- a/js/components/ascribe_forms/form_note_personal.js +++ b/js/components/ascribe_forms/form_note_personal.js @@ -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} /> diff --git a/js/components/edition.js b/js/components/edition.js index d54a9964..6cfb578c 100644 --- a/js/components/edition.js +++ b/js/components/edition.js @@ -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({ + + + @@ -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 ( + + + -1} + handleSuccess={this.showNotification} + editions={[this.props.edition]} /> + + + ); + } +}); + let EditionFurtherDetails = React.createClass({ propTypes: { diff --git a/js/constants/api_urls.js b/js/constants/api_urls.js index eef55e3f..494d52d0 100644 --- a/js/constants/api_urls.js +++ b/js/constants/api_urls.js @@ -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/',