diff --git a/index.html b/index.html
index b61794b4..066b36cc 100644
--- a/index.html
+++ b/index.html
@@ -5,8 +5,9 @@
diff --git a/js/components/ascribe_forms/form_consign.js b/js/components/ascribe_forms/form_consign.js
new file mode 100644
index 00000000..dbb1eee0
--- /dev/null
+++ b/js/components/ascribe_forms/form_consign.js
@@ -0,0 +1,68 @@
+import fetch from 'isomorphic-fetch';
+
+import React from 'react';
+
+import ApiUrls from '../../constants/api_urls';
+import FormMixin from '../../mixins/form_mixin';
+import InputText from './input_text';
+import InputTextArea from './input_textarea';
+import ButtonSubmitOrClose from './button_submit_close';
+
+let ConsignForm = React.createClass({
+ mixins: [FormMixin],
+
+ url() {
+ return ApiUrls.ownership_consigns
+ },
+ getFormData() {
+ return {
+ bitcoin_id: this.getBitcoinIds().join(),
+ consignee: this.refs.consignee.state.value,
+ consign_message: this.refs.consign_message.state.value,
+ password: this.refs.password.state.value
+ }
+ },
+
+ renderForm() {
+ let title = this.getTitlesString().join("");
+ let username = this.props.currentUser.username;
+ let message =
+`Hi,
+
+I consign :
+${title}to you.
+
+Truly yours,
+${username}`;
+
+ return (
+
+ );
+ }
+});
+
+export default ConsignForm;
\ No newline at end of file
diff --git a/js/components/ascribe_forms/form_loan.js b/js/components/ascribe_forms/form_loan.js
new file mode 100644
index 00000000..483d0f0a
--- /dev/null
+++ b/js/components/ascribe_forms/form_loan.js
@@ -0,0 +1,137 @@
+import fetch from 'isomorphic-fetch';
+
+import React from 'react';
+
+import ApiUrls from '../../constants/api_urls';
+import FormMixin from '../../mixins/form_mixin';
+import InputText from './input_text';
+import InputHidden from './input_hidden';
+import InputCheckbox from './input_checkbox';
+import InputDate from './input_date';
+import InputTextArea from './input_textarea';
+import OwnershipFetcher from '../../fetchers/ownership_fetcher'
+import ButtonSubmitOrClose from './button_submit_close';
+
+let LoanForm = React.createClass({
+ mixins: [FormMixin],
+
+ url() {
+ return ApiUrls.ownership_loans
+ },
+ componentDidMount(){
+ this.setState({contract_key: null,
+ contract_url: null,
+ loaneeHasContract: false});
+ },
+ getFormData() {
+ return {
+ bitcoin_id: this.getBitcoinIds().join(),
+ loanee: this.refs.loanee.state.value,
+ gallery_name: this.refs.gallery_name.state.value,
+ startdate: this.refs.startdate.state.value.format("YYYY-MM-DD"),
+ enddate: this.refs.enddate.state.value.format("YYYY-MM-DD"),
+ loan_message: this.refs.loan_message.state.value,
+ password: this.refs.password.state.value,
+ terms: this.refs.terms.state.value
+ }
+ },
+ handleLoanEmailBlur(e){
+ OwnershipFetcher.fetchLoanContract(this.refs.loanee.state.value)
+ .then((res) => {
+ if (res && res.length > 0) {
+ this.setState({contract_key: res[0].s3Key,
+ contract_url: res[0].s3Url,
+ loaneeHasContract: true});
+ }
+ else{
+ this.resetLoanContract();
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ this.resetLoanContract();
+ });
+ },
+ resetLoanContract(){
+ this.setState({contract_key: null,
+ contract_url: null,
+ loaneeHasContract: false
+ });
+ },
+ renderForm() {
+ let title = this.getTitlesString().join("");
+ let username = this.props.currentUser.username;
+ let message =
+`Hi,
+
+I loan :
+${title}to you.
+
+Truly yours,
+${username}`;
+
+ let contract =
;
+ if (this.state.loaneeHasContract){
+ let label =
;
+ contract =
+ }
+ return (
+
+ );
+ }
+});
+
+export default LoanForm;
diff --git a/js/components/ascribe_forms/form_share_email.js b/js/components/ascribe_forms/form_share_email.js
index dd61bc7b..cbcfc7a1 100644
--- a/js/components/ascribe_forms/form_share_email.js
+++ b/js/components/ascribe_forms/form_share_email.js
@@ -16,18 +16,23 @@ let ShareForm = React.createClass({
},
getFormData() {
return {
- bitcoin_id: this.props.edition.bitcoin_id,
+ bitcoin_id: this.getBitcoinIds().join(),
share_emails: this.refs.share_emails.state.value,
share_message: this.refs.share_message.state.value
}
},
renderForm() {
- let message = "Hi,\n" +
- "\n" +
- "I am sharing \"" + this.props.edition.title + "\" with you.\n" +
- "\n" +
- "Truly yours,\n" +
- this.props.currentUser.username;
+ let title = this.getTitlesString().join("");
+ let username = this.props.currentUser.username;
+ let message =
+`Hi,
+
+I am sharing :
+${title}with you.
+
+Truly yours,
+${username}`;
+
return (
);
diff --git a/js/components/ascribe_forms/input_textarea.js b/js/components/ascribe_forms/input_textarea.js
index b5f64b66..cf5cfc4a 100644
--- a/js/components/ascribe_forms/input_textarea.js
+++ b/js/components/ascribe_forms/input_textarea.js
@@ -8,8 +8,7 @@ let InputTextArea = React.createClass({
getInitialState() {
return {value: this.props.defaultValue,
- alerts: null, // needed in AlertMixin
- retry: 0 // needed in AlertMixin for generating unique alerts
+ alerts: null // needed in AlertMixin
};
},
handleChange(event) {
@@ -28,7 +27,6 @@ let InputTextArea = React.createClass({
onChange={this.handleChange}>
);
-
}
});
diff --git a/js/components/ascribe_media/image_viewer.js b/js/components/ascribe_media/image_viewer.js
deleted file mode 100644
index fdbd0342..00000000
--- a/js/components/ascribe_media/image_viewer.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-
-/**
- * This is the component that implements display-specific functionality
- */
-let ImageViewer = React.createClass({
- propTypes: {
- thumbnail: React.PropTypes.string.isRequired
- },
-
- render() {
- let thumbnail =
+ resourceviewer {this.props.thumbnail} {this.props.mimetype}
+
+ );
+ }
+});
+
+export default ResourceViewer;
diff --git a/js/components/ascribe_modal/modal_loan.js b/js/components/ascribe_modal/modal_loan.js
new file mode 100644
index 00000000..aed475b1
--- /dev/null
+++ b/js/components/ascribe_modal/modal_loan.js
@@ -0,0 +1,43 @@
+import React from 'react';
+import Modal from 'react-bootstrap/lib/Modal';
+import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
+import ModalTrigger from 'react-bootstrap/lib/ModalTrigger';
+import Tooltip from 'react-bootstrap/lib/Tooltip';
+
+import LoanForm from '../ascribe_forms/form_loan'
+import ModalMixin from '../../mixins/modal_mixin'
+
+let LoanModalButton = React.createClass({
+ render() {
+ return (
+