mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
further details functional / unstyled
This commit is contained in:
parent
509aa111ab
commit
9241d3e38f
@ -2,34 +2,39 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import fetch from '../../utils/fetch';
|
||||||
|
|
||||||
import apiUrls from '../../constants/api_urls';
|
import apiUrls from '../../constants/api_urls';
|
||||||
import FormMixin from '../../mixins/form_mixin';
|
import FormMixin from '../../mixins/form_mixin';
|
||||||
|
|
||||||
import InputTextAreaToggable from './input_textarea_toggable';
|
import InputTextAreaToggable from './input_textarea_toggable';
|
||||||
|
|
||||||
|
|
||||||
let PersonalNoteForm = React.createClass({
|
let PieceExtraDataForm = React.createClass({
|
||||||
mixins: [FormMixin],
|
mixins: [FormMixin],
|
||||||
|
|
||||||
url() {
|
url() {
|
||||||
return apiUrls.note_notes;
|
return fetch.prepareUrl(apiUrls.piece_extradata, {piece_id: this.props.editions[0].bitcoin_id});
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData() {
|
getFormData() {
|
||||||
|
let extradata = {};
|
||||||
|
extradata[this.props.name] = this.refs[this.props.name].state.value;
|
||||||
return {
|
return {
|
||||||
bitcoin_id: this.getBitcoinIds().join(),
|
bitcoin_id: this.getBitcoinIds().join(),
|
||||||
note: this.refs.personalNote.state.value
|
extradata: extradata
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
renderForm() {
|
renderForm() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form id="personal_note_content" role="form" key="personal_note_content">
|
<form role="form" key={this.props.name}>
|
||||||
|
<h5>{this.props.title}</h5>
|
||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
ref="personalNote"
|
ref={this.props.name}
|
||||||
className="form-control"
|
className="form-control"
|
||||||
defaultValue={this.props.editions[0].note_from_user}
|
defaultValue={this.props.editions[0].extra_data[this.props.name]}
|
||||||
rows={3}
|
rows={3}
|
||||||
editable={true}
|
editable={true}
|
||||||
required=""
|
required=""
|
||||||
@ -40,4 +45,4 @@ let PersonalNoteForm = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PersonalNoteForm;
|
export default PieceExtraDataForm;
|
@ -10,10 +10,14 @@ import Button from 'react-bootstrap/lib/Button';
|
|||||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||||
|
|
||||||
import PersonalNoteForm from './ascribe_forms/form_note_personal';
|
import PersonalNoteForm from './ascribe_forms/form_note_personal';
|
||||||
|
import PieceExtraDataForm from './ascribe_forms/form_piece_extradata';
|
||||||
|
|
||||||
import EditionActions from '../actions/edition_actions';
|
import EditionActions from '../actions/edition_actions';
|
||||||
import AclButtonList from './ascribe_buttons/acl_button_list';
|
import AclButtonList from './ascribe_buttons/acl_button_list';
|
||||||
|
|
||||||
|
import GlobalNotificationModel from '../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../actions/global_notification_actions';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -319,13 +323,17 @@ let EditionPersonalNote = React.createClass({
|
|||||||
edition: React.PropTypes.object,
|
edition: React.PropTypes.object,
|
||||||
handleSuccess: React.PropTypes.func
|
handleSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
showNotification(){
|
||||||
|
this.props.handleSuccess();
|
||||||
|
let notification = new GlobalNotificationModel('Note saved', 'success');
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12} className="ascribe-edition-personal-note">
|
<Col md={12} className="ascribe-edition-personal-note">
|
||||||
<PersonalNoteForm
|
<PersonalNoteForm
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.showNotification}
|
||||||
editions={[this.props.edition]} />
|
editions={[this.props.edition]} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@ -345,7 +353,19 @@ let EditionFurtherDetails = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12} className="ascribe-edition-personal-note">
|
<Col md={12} className="ascribe-edition-personal-note">
|
||||||
<PersonalNoteForm
|
<PieceExtraDataForm
|
||||||
|
name='artist_contact_info'
|
||||||
|
title='Artist Contact Info'
|
||||||
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
editions={[this.props.edition]} />
|
||||||
|
<PieceExtraDataForm
|
||||||
|
name='display_instructions'
|
||||||
|
title='Display Instructions'
|
||||||
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
editions={[this.props.edition]} />
|
||||||
|
<PieceExtraDataForm
|
||||||
|
name='technology_details'
|
||||||
|
title='Technology Details'
|
||||||
handleSuccess={this.props.handleSuccess}
|
handleSuccess={this.props.handleSuccess}
|
||||||
editions={[this.props.edition]} />
|
editions={[this.props.edition]} />
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -4,9 +4,6 @@ import React from 'react';
|
|||||||
|
|
||||||
import { mergeOptions } from '../utils/general_utils';
|
import { mergeOptions } from '../utils/general_utils';
|
||||||
|
|
||||||
import apiUrls from '../constants/api_urls';
|
|
||||||
import fetch from '../utils/fetch';
|
|
||||||
|
|
||||||
import EditionActions from '../actions/edition_actions';
|
import EditionActions from '../actions/edition_actions';
|
||||||
import EditionStore from '../stores/edition_store';
|
import EditionStore from '../stores/edition_store';
|
||||||
import UserActions from '../actions/user_actions';
|
import UserActions from '../actions/user_actions';
|
||||||
|
@ -14,7 +14,8 @@ let apiUrls = {
|
|||||||
'ownership_consigns': AppConstants.baseUrl + 'ownership/consigns/',
|
'ownership_consigns': AppConstants.baseUrl + 'ownership/consigns/',
|
||||||
'ownership_unconsigns': AppConstants.baseUrl + 'ownership/unconsigns/',
|
'ownership_unconsigns': AppConstants.baseUrl + 'ownership/unconsigns/',
|
||||||
'ownership_unconsigns_request': AppConstants.baseUrl + 'ownership/unconsigns/request/',
|
'ownership_unconsigns_request': AppConstants.baseUrl + 'ownership/unconsigns/request/',
|
||||||
'note_notes': AppConstants.baseUrl + 'note/notes/'
|
'note_notes': AppConstants.baseUrl + 'note/notes/',
|
||||||
|
'piece_extradata': AppConstants.baseUrl + 'pieces/${piece_id}/extradata/'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default apiUrls;
|
export default apiUrls;
|
||||||
|
@ -88,19 +88,19 @@ class Fetch {
|
|||||||
|
|
||||||
get(url, params) {
|
get(url, params) {
|
||||||
let paramsCopy = this._merge(params);
|
let paramsCopy = this._merge(params);
|
||||||
let newUrl = this.prepareUrl(url, params, true);
|
let newUrl = this.prepareUrl(url, paramsCopy, true);
|
||||||
return this.request('get', newUrl);
|
return this.request('get', newUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
post(url, params) {
|
post(url, params) {
|
||||||
let paramsCopy = this._merge(params);
|
let paramsCopy = this._merge(params);
|
||||||
let newUrl = this.prepareUrl(url, params);
|
let newUrl = this.prepareUrl(url, paramsCopy);
|
||||||
let body = null;
|
let body = null;
|
||||||
|
|
||||||
if (params.body) {
|
if (paramsCopy && paramsCopy.body) {
|
||||||
body = JSON.stringify(params.body);
|
body = JSON.stringify(paramsCopy.body);
|
||||||
}
|
}
|
||||||
return this.request('post', url, { body });
|
return this.request('post', newUrl, { body });
|
||||||
}
|
}
|
||||||
|
|
||||||
defaults(options) {
|
defaults(options) {
|
||||||
|
Loading…
Reference in New Issue
Block a user