mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
Merged in AD-419-decouple-piece-registration-from- (pull request #10)
Ad 419 decouple piece registration from
This commit is contained in:
commit
af5964e68c
10
index.html
10
index.html
@ -41,6 +41,16 @@
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
|
||||
<!-- Google Analytics tracking code -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-60614729-2', 'auto');
|
||||
</script>
|
||||
|
||||
<!-- Intercom library -->
|
||||
<script>
|
||||
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
|
||||
|
48
js/actions/loan_contract_actions.js
Normal file
48
js/actions/loan_contract_actions.js
Normal file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
import alt from '../alt';
|
||||
import OwnershipFetcher from '../fetchers/ownership_fetcher';
|
||||
|
||||
|
||||
class LoanContractActions {
|
||||
constructor() {
|
||||
this.generateActions(
|
||||
'updateLoanContract'
|
||||
);
|
||||
}
|
||||
|
||||
fetchLoanContract(email) {
|
||||
|
||||
if(email.match(/.+\@.+\..+/)) {
|
||||
OwnershipFetcher.fetchLoanContract(email)
|
||||
.then((contracts) => {
|
||||
if (contracts && contracts.length > 0) {
|
||||
this.actions.updateLoanContract({
|
||||
contractKey: contracts[0].s3Key,
|
||||
contractUrl: contracts[0].s3Url,
|
||||
contractEmail: email
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.actions.updateLoanContract({
|
||||
contractKey: null,
|
||||
contractUrl: null,
|
||||
contractEmail: null
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
this.actions.updateLoanContract({
|
||||
contractKey: null,
|
||||
contractUrl: null,
|
||||
contractEmail: null
|
||||
});
|
||||
});
|
||||
} else {
|
||||
/* No email was entered - Ignore and keep going*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default alt.createActions(LoanContractActions);
|
@ -52,7 +52,10 @@ class AppGateway {
|
||||
}
|
||||
|
||||
load(type) {
|
||||
Router.run(getRoutes(type), Router.HistoryLocation, (App) => {
|
||||
Router.run(getRoutes(type), Router.HistoryLocation, (App, state) => {
|
||||
if (window.ga) {
|
||||
window.ga('send', 'pageview');
|
||||
}
|
||||
React.render(
|
||||
<App />,
|
||||
document.getElementById('main')
|
||||
|
@ -37,7 +37,7 @@ let AclProxy = React.createClass({
|
||||
);
|
||||
} else {
|
||||
if(typeof this.props.aclObject[this.props.aclName] === 'undefined') {
|
||||
console.warn('The aclName you\'re filtering for was not present (undefined) in the aclObject.');
|
||||
console.warn('The aclName you\'re filtering for was not present (or undefined) in the aclObject.');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -11,6 +11,11 @@ import AccordionListItemEditionWidget from './accordion_list_item_edition_widget
|
||||
import CreateEditionsForm from '../ascribe_forms/create_editions_form';
|
||||
|
||||
import PieceListActions from '../../actions/piece_list_actions';
|
||||
import PieceListStore from '../../stores/piece_list_store';
|
||||
|
||||
import WhitelabelStore from '../../stores/whitelabel_store';
|
||||
import WhitelabelActions from '../../actions/whitelabel_actions';
|
||||
|
||||
import EditionListActions from '../../actions/edition_list_actions';
|
||||
|
||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||
@ -20,6 +25,7 @@ import AclProxy from '../acl_proxy';
|
||||
import SubmitToPrizeButton from '../ascribe_buttons/submit_to_prize_button';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
|
||||
let Link = Router.Link;
|
||||
|
||||
@ -33,9 +39,27 @@ let AccordionListItem = React.createClass({
|
||||
mixins: [Router.Navigation],
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
showCreateEditionsDialog: false
|
||||
};
|
||||
return mergeOptions(
|
||||
{
|
||||
showCreateEditionsDialog: false
|
||||
},
|
||||
PieceListStore.getState(),
|
||||
WhitelabelStore.getState()
|
||||
);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
PieceListStore.listen(this.onChange);
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
PieceListStore.unlisten(this.onChange);
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
getGlyphicon(){
|
||||
@ -61,6 +85,13 @@ let AccordionListItem = React.createClass({
|
||||
this.toggleCreateEditionsDialog();
|
||||
},
|
||||
|
||||
handleSubmitPrizeSuccess(response) {
|
||||
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc);
|
||||
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
onPollingSuccess(pieceId, numEditions) {
|
||||
PieceListActions.updatePropertyForPiece({
|
||||
pieceId,
|
||||
@ -86,6 +117,17 @@ let AccordionListItem = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
getLicences() {
|
||||
// convert this to acl_view_licences later
|
||||
if(this.state.whitelabel.name === 'Creative Commons France') {
|
||||
return (
|
||||
<a href={this.props.content.license_type.url} target="_blank" className="pull-right">
|
||||
{getLangText('%s license', this.props.content.license_type.code)}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
let linkData;
|
||||
|
||||
@ -123,25 +165,32 @@ let AccordionListItem = React.createClass({
|
||||
<h3>{getLangText('by %s', this.props.content.artist_name)}</h3>
|
||||
<div>
|
||||
<span className="pull-left">{this.props.content.date_created.split('-')[0]}</span>
|
||||
<AccordionListItemEditionWidget
|
||||
className="pull-right"
|
||||
piece={this.props.content}
|
||||
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
||||
onPollingSuccess={this.onPollingSuccess}/>
|
||||
|
||||
<AclProxy
|
||||
show={this.props.content.prize_name === null}>
|
||||
<SubmitToPrizeButton
|
||||
aclObject={this.props.content.acl}
|
||||
aclName="acl_view_editions">
|
||||
<AccordionListItemEditionWidget
|
||||
className="pull-right"
|
||||
piece={this.props.content} />
|
||||
piece={this.props.content}
|
||||
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
||||
onPollingSuccess={this.onPollingSuccess}/>
|
||||
</AclProxy>
|
||||
<AclProxy
|
||||
show={this.props.content.prize_name}>
|
||||
show={this.props.content.prize === null}>
|
||||
<SubmitToPrizeButton
|
||||
className="pull-right"
|
||||
piece={this.props.content}
|
||||
handleSuccess={this.handleSubmitPrizeSuccess}/>
|
||||
</AclProxy>
|
||||
<AclProxy
|
||||
show={this.props.content.prize}>
|
||||
<button
|
||||
disabled
|
||||
className="btn btn-default btn-xs pull-right">
|
||||
{getLangText('Submitted to prize')} <span className="glyphicon glyphicon-ok" aria-hidden="true"></span>
|
||||
</button>
|
||||
</AclProxy>
|
||||
{this.getLicences()}
|
||||
</div>
|
||||
</div>
|
||||
<span style={{'clear': 'both'}}></span>
|
||||
|
@ -5,7 +5,7 @@ import React from 'react';
|
||||
import ConsignForm from '../ascribe_forms/form_consign';
|
||||
import UnConsignForm from '../ascribe_forms/form_unconsign';
|
||||
import TransferForm from '../ascribe_forms/form_transfer';
|
||||
import LoanForm from '../ascribe_forms/form_loan';
|
||||
import LoanForm from '../ascribe_forms/form_loan_new';
|
||||
import ShareForm from '../ascribe_forms/form_share_email';
|
||||
import ModalWrapper from '../ascribe_modal/modal_wrapper';
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
@ -30,7 +30,7 @@ let AclButton = React.createClass({
|
||||
},
|
||||
|
||||
isPiece(){
|
||||
return !(this.props.pieceOrEditions.constructor === Array);
|
||||
return this.props.pieceOrEditions.constructor !== Array;
|
||||
},
|
||||
|
||||
actionProperties(){
|
||||
@ -68,7 +68,7 @@ let AclButton = React.createClass({
|
||||
message={this.getTransferMessage()}
|
||||
id={this.getFormDataId()}
|
||||
url={apiUrls.ownership_transfers}/>
|
||||
),
|
||||
),
|
||||
handleSuccess: this.showNotification
|
||||
};
|
||||
}
|
||||
@ -76,7 +76,11 @@ let AclButton = React.createClass({
|
||||
return {
|
||||
title: getLangText('Loan artwork'),
|
||||
tooltip: getLangText('Loan your artwork for a limited period of time'),
|
||||
form: <LoanForm currentUser={ this.props.currentUser } editions={ this.props.pieceOrEditions }/>,
|
||||
form: (<LoanForm
|
||||
message={this.getLoanMessage()}
|
||||
id={this.getFormDataId()}
|
||||
url={this.isPiece() ? apiUrls.ownership_loans_pieces : apiUrls.ownership_loans_editions}/>
|
||||
),
|
||||
handleSuccess: this.showNotification
|
||||
};
|
||||
}
|
||||
@ -135,6 +139,20 @@ let AclButton = React.createClass({
|
||||
${getLangText('I transfer ownership of')}:
|
||||
${this.getTitlesString()} ${getLangText('to you')}.
|
||||
|
||||
${getLangText('Truly yours')},
|
||||
${this.props.currentUser.username}
|
||||
`
|
||||
);
|
||||
},
|
||||
|
||||
// plz move to transfer form
|
||||
getLoanMessage(){
|
||||
return (
|
||||
`${getLangText('Hi')},
|
||||
|
||||
${getLangText('I loan')}:
|
||||
${this.getTitlesString()} ${getLangText('to you')}.
|
||||
|
||||
${getLangText('Truly yours')},
|
||||
${this.props.currentUser.username}
|
||||
`
|
||||
@ -191,6 +209,7 @@ ${this.props.currentUser.username}
|
||||
render() {
|
||||
let shouldDisplay = this.props.availableAcls[this.props.action];
|
||||
let aclProps = this.actionProperties();
|
||||
|
||||
return (
|
||||
<ModalWrapper
|
||||
button={
|
||||
@ -198,10 +217,10 @@ ${this.props.currentUser.username}
|
||||
{this.sanitizeAction()}
|
||||
</button>
|
||||
}
|
||||
handleSuccess={ aclProps.handleSuccess }
|
||||
title={ aclProps.title }
|
||||
tooltip={ aclProps.tooltip }>
|
||||
{ aclProps.form }
|
||||
handleSuccess={aclProps.handleSuccess}
|
||||
title={aclProps.title}
|
||||
tooltip={aclProps.tooltip}>
|
||||
{aclProps.form}
|
||||
</ModalWrapper>
|
||||
);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ let DeleteButton = React.createClass({
|
||||
if(this.props.editions && this.props.editions.constructor !== Array && this.props.editions.acl.acl_unshare) {
|
||||
content = <EditionRemoveFromCollectionForm editions={this.props.editions}/>;
|
||||
title = getLangText('Remove Edition from Collection');
|
||||
} else {
|
||||
} else if(this.props.piece && this.props.piece.acl.acl_unshare) {
|
||||
content = <PieceRemoveFromCollectionForm pieceId={this.props.piece.id}/>;
|
||||
title = getLangText('Remove Piece from Collection');
|
||||
}
|
||||
|
@ -3,19 +3,38 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import ModalWrapper from '../ascribe_modal/modal_wrapper';
|
||||
import PieceSubmitToPrizeForm from '../ascribe_forms/form_submit_to_prize';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
|
||||
let SubmitToPrizeButton = React.createClass({
|
||||
propTypes: {
|
||||
className: React.PropTypes.string
|
||||
className: React.PropTypes.string,
|
||||
handleSuccess: React.PropTypes.func,
|
||||
piece: React.PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
render() {
|
||||
getSubmitButton() {
|
||||
return (
|
||||
<button
|
||||
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
|
||||
{getLangText('Submit to prize')}
|
||||
</button>
|
||||
</button>
|
||||
);
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ModalWrapper
|
||||
button={this.getSubmitButton()}
|
||||
handleSuccess={this.props.handleSuccess}
|
||||
title={getLangText('Submit to prize')}>
|
||||
<PieceSubmitToPrizeForm
|
||||
piece={this.props.piece}
|
||||
handleSuccess={this.props.handleSuccess}/>
|
||||
</ModalWrapper>
|
||||
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -38,8 +38,8 @@ let DetailProperty = React.createClass({
|
||||
return (
|
||||
<div className="row ascribe-detail-property">
|
||||
<div className="row-same-height">
|
||||
<div className={this.props.labelClassName + ' col-xs-height col-bottom'}>
|
||||
<div>{ this.props.label + this.props.separator}</div>
|
||||
<div className={this.props.labelClassName + ' col-xs-height col-bottom ascribe-detail-property-label'}>
|
||||
{ this.props.label + this.props.separator}
|
||||
</div>
|
||||
<div className={this.props.valueClassName + ' col-xs-height col-bottom'}>
|
||||
{value}
|
||||
|
@ -22,6 +22,7 @@ let MediaContainer = React.createClass({
|
||||
let mimetype = this.props.content.digital_work.mime;
|
||||
let embed = null;
|
||||
let extraData = null;
|
||||
let isEmbedDisabled = mimetype === 'video' && this.props.content.digital_work.isEncoding !== undefined && this.props.content.digital_work.isEncoding !== 100;
|
||||
|
||||
if (this.props.content.digital_work.encoding_urls) {
|
||||
extraData = this.props.content.digital_work.encoding_urls.map(e => { return { url: e.url, type: e.label }; });
|
||||
@ -31,25 +32,26 @@ let MediaContainer = React.createClass({
|
||||
embed = (
|
||||
<CollapsibleButton
|
||||
button={
|
||||
<Button bsSize="xsmall" className="ascribe-margin-1px">
|
||||
<Button bsSize="xsmall" className="ascribe-margin-1px" disabled={isEmbedDisabled ? '"disabled"' : ''}>
|
||||
Embed
|
||||
</Button>
|
||||
}
|
||||
panel={
|
||||
<pre className="">
|
||||
{'<iframe width="560" height="315" src="http://embed.ascribe.io/content/'
|
||||
+ this.props.content.bitcoin_id + '" frameborder="0" allowfullscreen></iframe>'
|
||||
}
|
||||
+ this.props.content.bitcoin_id + '" frameborder="0" allowfullscreen></iframe>'}
|
||||
</pre>
|
||||
}/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<MediaPlayer mimetype={mimetype}
|
||||
preview={thumbnail}
|
||||
url={this.props.content.digital_work.url}
|
||||
extraData={extraData} />
|
||||
<MediaPlayer
|
||||
mimetype={mimetype}
|
||||
preview={thumbnail}
|
||||
url={this.props.content.digital_work.url}
|
||||
extraData={extraData}
|
||||
encodingStatus={this.props.content.digital_work.isEncoding} />
|
||||
<p className="text-center">
|
||||
<AclProxy
|
||||
aclObject={this.props.content.acl}
|
||||
|
@ -6,12 +6,8 @@ import Router from 'react-router';
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
|
||||
import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph';
|
||||
|
||||
import DetailProperty from './detail_property';
|
||||
|
||||
import FurtherDetails from './further_details';
|
||||
|
||||
import UserActions from '../../actions/user_actions';
|
||||
import UserStore from '../../stores/user_store';
|
||||
|
||||
@ -37,13 +33,15 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
|
||||
|
||||
/**
|
||||
* This is the component that implements display-specific functionality
|
||||
*/
|
||||
let Piece = React.createClass({
|
||||
propTypes: {
|
||||
piece: React.PropTypes.object,
|
||||
loadPiece: React.PropTypes.func
|
||||
loadPiece: React.PropTypes.func,
|
||||
children: React.PropTypes.object
|
||||
},
|
||||
|
||||
mixins: [Router.Navigation],
|
||||
@ -135,7 +133,7 @@ let Piece = React.createClass({
|
||||
<EditionDetailProperty label="TITLE" value={<div className="ascribe-detail-title">{this.props.piece.title}</div>} />
|
||||
<EditionDetailProperty label="BY" value={this.props.piece.artist_name} />
|
||||
<EditionDetailProperty label="DATE" value={ this.props.piece.date_created.slice(0, 4) } />
|
||||
{this.props.piece.num_editions > 0 ? <EditionDetailProperty label="NUMBER OF EDITIONS" value={ this.props.piece.num_editions } /> : null}
|
||||
{this.props.piece.num_editions > 0 ? <EditionDetailProperty label="EDITIONS" value={ this.props.piece.num_editions } /> : null}
|
||||
<hr/>
|
||||
</div>
|
||||
<div className="ascribe-detail-header">
|
||||
@ -159,20 +157,8 @@ let Piece = React.createClass({
|
||||
</AclButtonList>
|
||||
|
||||
{this.getCreateEditionsDialog()}
|
||||
{this.props.children}
|
||||
|
||||
<CollapsibleParagraph
|
||||
title="Further Details"
|
||||
show={this.props.piece.acl.acl_edit
|
||||
|| Object.keys(this.props.piece.extra_data).length > 0
|
||||
|| this.props.piece.other_data !== null}
|
||||
defaultExpanded={true}>
|
||||
<FurtherDetails
|
||||
editable={this.props.piece.acl.acl_edit}
|
||||
pieceId={this.props.piece.id}
|
||||
extraData={this.props.piece.extra_data}
|
||||
otherData={this.props.piece.other_data}
|
||||
handleSuccess={this.props.loadPiece}/>
|
||||
</CollapsibleParagraph>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
|
@ -6,6 +6,8 @@ import PieceActions from '../../actions/piece_actions';
|
||||
import PieceStore from '../../stores/piece_store';
|
||||
|
||||
import Piece from './piece';
|
||||
import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph';
|
||||
import FurtherDetails from './further_details';
|
||||
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
|
||||
@ -46,7 +48,21 @@ let PieceContainer = React.createClass({
|
||||
return (
|
||||
<Piece
|
||||
piece={this.state.piece}
|
||||
loadPiece={this.loadPiece}/>
|
||||
loadPiece={this.loadPiece}>
|
||||
<CollapsibleParagraph
|
||||
title="Further Details"
|
||||
show={this.state.piece.acl.acl_edit
|
||||
|| Object.keys(this.state.piece.extra_data).length > 0
|
||||
|| this.state.piece.other_data !== null}
|
||||
defaultExpanded={true}>
|
||||
<FurtherDetails
|
||||
editable={this.state.piece.acl.acl_edit}
|
||||
pieceId={this.state.piece.id}
|
||||
extraData={this.state.piece.extra_data}
|
||||
otherData={this.state.piece.other_data}
|
||||
handleSuccess={this.loadPiece}/>
|
||||
</CollapsibleParagraph>
|
||||
</Piece>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
|
@ -52,7 +52,7 @@ let CreateEditionsForm = React.createClass({
|
||||
<input
|
||||
type="number"
|
||||
placeholder="(e.g. 32)"
|
||||
min={0}/>
|
||||
min={1}/>
|
||||
</Property>
|
||||
</Form>
|
||||
);
|
||||
|
@ -56,11 +56,9 @@ let Form = React.createClass({
|
||||
|
||||
getFormData(){
|
||||
let data = {};
|
||||
console.log(this.refs);
|
||||
for (let ref in this.refs){
|
||||
data[this.refs[ref].props.name] = this.refs[ref].state.value;
|
||||
}
|
||||
console.log(data);
|
||||
if ('getFormData' in this.props){
|
||||
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import InputTextArea from './input_textarea';
|
||||
import OwnershipFetcher from '../../fetchers/ownership_fetcher';
|
||||
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils.js'
|
||||
import { getLangText } from '../../utils/lang_utils.js';
|
||||
|
||||
let LoanForm = React.createClass({
|
||||
|
||||
|
168
js/components/ascribe_forms/form_loan_new.js
Normal file
168
js/components/ascribe_forms/form_loan_new.js
Normal file
@ -0,0 +1,168 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import Button from 'react-bootstrap/lib/Button';
|
||||
|
||||
import Form from './form';
|
||||
import Property from './property';
|
||||
import InputTextAreaToggable from './input_textarea_toggable';
|
||||
import InputDate from './input_date';
|
||||
import InputCheckbox from './input_checkbox';
|
||||
|
||||
import LoanContractStore from '../../stores/loan_contract_store';
|
||||
import LoanContractActions from '../../actions/loan_contract_actions';
|
||||
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
import { getLangText } from '../../utils/lang_utils';
|
||||
|
||||
|
||||
let LoanForm = React.createClass({
|
||||
propTypes: {
|
||||
url: React.PropTypes.string,
|
||||
id: React.PropTypes.object,
|
||||
message: React.PropTypes.string,
|
||||
onRequestHide: React.PropTypes.func,
|
||||
handleSuccess: React.PropTypes.func
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return LoanContractStore.getState();
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
LoanContractStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
LoanContractStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
getFormData(){
|
||||
return this.props.id;
|
||||
},
|
||||
|
||||
handleOnBlur(event) {
|
||||
LoanContractActions.fetchLoanContract(event.target.value);
|
||||
},
|
||||
|
||||
getContractCheckbox() {
|
||||
if(this.state.contractKey && this.state.contractUrl) {
|
||||
return (
|
||||
<Property
|
||||
name="terms"
|
||||
className="ascribe-settings-property-collapsible-toggle"
|
||||
style={{paddingBottom: 0}}>
|
||||
<InputCheckbox>
|
||||
<span>
|
||||
{getLangText('I agree to the')}
|
||||
<a href={this.state.contractUrl} target="_blank">
|
||||
{getLangText('terms of')} {this.state.contractEmail}
|
||||
</a>
|
||||
</span>
|
||||
</InputCheckbox>
|
||||
</Property>
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
onRequestHide() {
|
||||
// Since the modal can be opened without sending it to the server
|
||||
// and therefore clearing the store,
|
||||
// we'll need to make sure to flush the store once the
|
||||
// modal unmounts
|
||||
LoanContractActions.updateLoanContract({
|
||||
contractUrl: null,
|
||||
contractEmail: null,
|
||||
contractKey: null
|
||||
});
|
||||
|
||||
this.props.onRequestHide();
|
||||
},
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<Form
|
||||
ref='form'
|
||||
url={this.props.url}
|
||||
getFormData={this.getFormData}
|
||||
handleSuccess={this.props.handleSuccess}
|
||||
buttons={
|
||||
<div className="modal-footer">
|
||||
<p className="pull-right">
|
||||
<Button
|
||||
className="btn btn-default btn-sm ascribe-margin-1px"
|
||||
type="submit">{getLangText('LOAN')}</Button>
|
||||
<Button
|
||||
className="btn btn-danger btn-delete btn-sm ascribe-margin-1px"
|
||||
style={{marginLeft: '0'}}
|
||||
onClick={this.onRequestHide}>{getLangText('CLOSE')}</Button>
|
||||
</p>
|
||||
</div>}
|
||||
spinner={
|
||||
<div className="modal-footer">
|
||||
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
|
||||
</div>}>
|
||||
<Property
|
||||
name='loanee'
|
||||
label={getLangText('Loanee Email')}
|
||||
onBlur={this.handleOnBlur}>
|
||||
<input
|
||||
type="email"
|
||||
placeholder={getLangText('Email of the loanee')}
|
||||
required/>
|
||||
</Property>
|
||||
<Property
|
||||
name='gallery_name'
|
||||
label={getLangText('Gallery/exhibition (optional)')}
|
||||
onBlur={this.handleOnBlur}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={getLangText('Gallery/exhibition (optional)')}/>
|
||||
</Property>
|
||||
<Property
|
||||
name='startdate'
|
||||
label={getLangText('Start date')}>
|
||||
<InputDate
|
||||
placeholderText={getLangText('Loan start date')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='enddate'
|
||||
label={getLangText('End date')}>
|
||||
<InputDate
|
||||
placeholderText={getLangText('Loan end date')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='loan_message'
|
||||
label={getLangText('Personal Message')}
|
||||
editable={true}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={true}
|
||||
defaultValue={this.props.message}
|
||||
placeholder={getLangText('Enter a message...')}
|
||||
required="required"/>
|
||||
</Property>
|
||||
|
||||
<Property
|
||||
name='password'
|
||||
label={getLangText('Password')}>
|
||||
<input
|
||||
type="password"
|
||||
placeholder={getLangText('Enter your password')}
|
||||
required/>
|
||||
</Property>
|
||||
{this.getContractCheckbox()}
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default LoanForm;
|
@ -32,8 +32,8 @@ let LoginForm = React.createClass({
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
headerMessage: 'Enter ascribe',
|
||||
submitMessage: 'Log in',
|
||||
headerMessage: getLangText('Enter ascribe'),
|
||||
submitMessage: getLangText('Log in'),
|
||||
redirectOnLoggedIn: true,
|
||||
redirectOnLoginSuccess: true
|
||||
};
|
||||
@ -95,7 +95,7 @@ let LoginForm = React.createClass({
|
||||
<button
|
||||
type="submit"
|
||||
className="btn ascribe-btn ascribe-btn-login">
|
||||
{getLangText(this.props.submitMessage)}
|
||||
{this.props.submitMessage}
|
||||
</button>}
|
||||
spinner={
|
||||
<span className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||
@ -103,7 +103,7 @@ let LoginForm = React.createClass({
|
||||
</span>
|
||||
}>
|
||||
<FormPropertyHeader>
|
||||
<h3>{getLangText(this.props.headerMessage)}</h3>
|
||||
<h3>{this.props.headerMessage}</h3>
|
||||
</FormPropertyHeader>
|
||||
<Property
|
||||
name='email'
|
||||
|
@ -31,8 +31,8 @@ let SignupForm = React.createClass({
|
||||
|
||||
getDefaultProps() {
|
||||
return {
|
||||
headerMessage: 'Welcome to ascribe',
|
||||
submitMessage: 'Sign up'
|
||||
headerMessage: getLangText('Welcome to ascribe'),
|
||||
submitMessage: getLangText('Sign up')
|
||||
};
|
||||
},
|
||||
|
||||
@ -58,12 +58,9 @@ let SignupForm = React.createClass({
|
||||
},
|
||||
|
||||
handleSuccess(response){
|
||||
|
||||
let notificationText = getLangText('Sign up successful');
|
||||
let notification = new GlobalNotificationModel(notificationText, 'success', 50000);
|
||||
let notification = new GlobalNotificationModel(getLangText('Sign up successful'), 'success', 50000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
this.props.handleSuccess(getLangText('We sent an email to your address') + ' ' + response.user.email +
|
||||
', ' + getLangText('please confirm') + '.');
|
||||
this.props.handleSuccess(getLangText('We sent an email to your address') + ' ' + response.user.email + ', ' + getLangText('please confirm') + '.');
|
||||
|
||||
},
|
||||
getFormData(){
|
||||
@ -82,7 +79,7 @@ let SignupForm = React.createClass({
|
||||
getFormData={this.getFormData}
|
||||
buttons={
|
||||
<button type="submit" className="btn ascribe-btn ascribe-btn-login">
|
||||
{getLangText(this.props.submitMessage)}
|
||||
{this.props.submitMessage}
|
||||
</button>}
|
||||
spinner={
|
||||
<span className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
|
||||
@ -90,7 +87,7 @@ let SignupForm = React.createClass({
|
||||
</span>
|
||||
}>
|
||||
<FormPropertyHeader>
|
||||
<h3>{getLangText(this.props.headerMessage)}</h3>
|
||||
<h3>{this.props.headerMessage}</h3>
|
||||
</FormPropertyHeader>
|
||||
<Property
|
||||
name='email'
|
||||
|
90
js/components/ascribe_forms/form_submit_to_prize.js
Normal file
90
js/components/ascribe_forms/form_submit_to_prize.js
Normal file
@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import Form from './form';
|
||||
import Property from './property';
|
||||
import InputTextAreaToggable from './input_textarea_toggable';
|
||||
import InputCheckbox from './input_checkbox';
|
||||
|
||||
import Alert from 'react-bootstrap/lib/Alert';
|
||||
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
import ApiUrls from '../../constants/api_urls';
|
||||
|
||||
import { getLangText } from '../../utils/lang_utils.js';
|
||||
|
||||
import requests from '../../utils/requests';
|
||||
|
||||
let PieceSubmitToPrizeForm = React.createClass({
|
||||
propTypes: {
|
||||
piece: React.PropTypes.object,
|
||||
handleSuccess: React.PropTypes.func,
|
||||
|
||||
// this is set by ModalWrapper automatically
|
||||
onRequestHide: React.PropTypes.func
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Form
|
||||
ref='form'
|
||||
url={requests.prepareUrl(ApiUrls.piece_submit_to_prize, {piece_id: this.props.piece.id})}
|
||||
handleSuccess={this.props.handleSuccess}
|
||||
buttons={
|
||||
<div className="modal-footer">
|
||||
<p className="pull-right">
|
||||
<button
|
||||
className="btn btn-default btn-sm ascribe-margin-1px"
|
||||
type="submit">{getLangText('SUBMIT TO PRIZE')}</button>
|
||||
</p>
|
||||
</div>}
|
||||
spinner={
|
||||
<div className="modal-footer">
|
||||
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
|
||||
</div>}>
|
||||
<Property
|
||||
name='artist_statement'
|
||||
label={getLangText('Artist statement')}
|
||||
editable={true}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={true}
|
||||
placeholder={getLangText('Enter your statement')}
|
||||
required="required"/>
|
||||
</Property>
|
||||
<Property
|
||||
name='work_description'
|
||||
label={getLangText('Work description')}
|
||||
editable={true}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={true}
|
||||
placeholder={getLangText('Enter the description for your work')}
|
||||
required="required"/>
|
||||
</Property>
|
||||
<Property
|
||||
name="terms"
|
||||
className="ascribe-settings-property-collapsible-toggle"
|
||||
style={{paddingBottom: 0}}>
|
||||
<InputCheckbox>
|
||||
<span>
|
||||
{' ' + getLangText('I agree to the Terms of Service the art price') + ' '}
|
||||
(<a href="https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/sluice/terms.pdf" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
|
||||
{getLangText('read')}
|
||||
</a>)
|
||||
</span>
|
||||
</InputCheckbox>
|
||||
</Property>
|
||||
<Alert bsStyle='warning'>
|
||||
<p>{getLangText('Are you sure you want to submit to the prize?')}</p>
|
||||
<p>{getLangText('This is an irrevocable action%s', '.')}</p>
|
||||
</Alert>
|
||||
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
export default PieceSubmitToPrizeForm;
|
@ -2,7 +2,6 @@
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import AlertMixin from '../../mixins/alert_mixin';
|
||||
import DatePicker from 'react-datepicker/dist/react-datepicker';
|
||||
|
||||
let InputDate = React.createClass({
|
||||
@ -11,31 +10,33 @@ let InputDate = React.createClass({
|
||||
placeholderText: React.PropTypes.string
|
||||
},
|
||||
|
||||
mixins: [AlertMixin],
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
value: null,
|
||||
value_formatted: null,
|
||||
alerts: null // needed in AlertMixin
|
||||
value: null
|
||||
};
|
||||
},
|
||||
|
||||
handleChange(date) {
|
||||
let formattedDate = date.format('YYYY-MM-DD');
|
||||
this.setState({
|
||||
value: date,
|
||||
value_formatted: date.format('YYYY-MM-DD')});
|
||||
value: formattedDate,
|
||||
value_moment: date
|
||||
});
|
||||
|
||||
this.props.onChange({
|
||||
target: {
|
||||
value: formattedDate
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
render: function () {
|
||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
||||
console.log(this.state.value);
|
||||
return (
|
||||
<div className="form-group">
|
||||
{alerts}
|
||||
<DatePicker
|
||||
key="example2"
|
||||
dateFormat="YYYY-MM-DD"
|
||||
selected={this.state.value}
|
||||
selected={this.state.value_moment}
|
||||
onChange={this.handleChange}
|
||||
placeholderText={this.props.placeholderText}/>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@ let Property = React.createClass({
|
||||
this.props.onChange(event);
|
||||
}
|
||||
|
||||
this.setState({value: true});
|
||||
this.setState({value: event.target.value});
|
||||
},
|
||||
|
||||
handleFocus() {
|
||||
@ -104,10 +104,14 @@ let Property = React.createClass({
|
||||
});
|
||||
},
|
||||
|
||||
handleBlur() {
|
||||
handleBlur(event) {
|
||||
this.setState({
|
||||
isFocused: false
|
||||
});
|
||||
|
||||
if(this.props.onBlur) {
|
||||
this.props.onBlur(event);
|
||||
}
|
||||
},
|
||||
|
||||
handleSuccess(){
|
||||
|
@ -5,7 +5,7 @@ import Router from 'react-router';
|
||||
|
||||
import Form from './ascribe_forms/form';
|
||||
import Property from './ascribe_forms/property';
|
||||
|
||||
import FormPropertyHeader from './ascribe_forms/form_property_header';
|
||||
import apiUrls from '../constants/api_urls';
|
||||
|
||||
import GlobalNotificationModel from '../models/global_notification_model';
|
||||
@ -25,9 +25,6 @@ let PasswordResetContainer = React.createClass({
|
||||
if (this.props.query.email && this.props.query.token) {
|
||||
return (
|
||||
<div>
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
{getLangText('Reset the password for')} {this.props.query.email}
|
||||
</div>
|
||||
<PasswordResetForm
|
||||
email={this.props.query.email}
|
||||
token={this.props.query.token}/>
|
||||
@ -38,9 +35,6 @@ let PasswordResetContainer = React.createClass({
|
||||
if (this.state.isRequested === false) {
|
||||
return (
|
||||
<div>
|
||||
<div className="ascribe-login-text ascribe-login-header">
|
||||
{getLangText('Reset your password')}
|
||||
</div>
|
||||
<PasswordRequestResetForm
|
||||
handleRequestSuccess={this.handleRequestSuccess}/>
|
||||
</div>
|
||||
@ -86,6 +80,9 @@ let PasswordRequestResetForm = React.createClass({
|
||||
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||
</span>
|
||||
}>
|
||||
<FormPropertyHeader>
|
||||
<h3>{getLangText('Reset your password')}</h3>
|
||||
</FormPropertyHeader>
|
||||
<Property
|
||||
name='email'
|
||||
label={getLangText('Email')}>
|
||||
@ -133,6 +130,9 @@ let PasswordResetForm = React.createClass({
|
||||
<img src="https://s3-us-west-2.amazonaws.com/ascribe0/media/thumbnails/ascribe_animated_medium.gif" />
|
||||
</span>
|
||||
}>
|
||||
<FormPropertyHeader>
|
||||
<h3>{getLangText('Reset the password for')} {this.props.email}</h3>
|
||||
</FormPropertyHeader>
|
||||
<Property
|
||||
name='password'
|
||||
label={getLangText('Password')}>
|
||||
|
@ -9,6 +9,9 @@ import Row from 'react-bootstrap/lib/Row';
|
||||
import LicenseActions from '../actions/license_actions';
|
||||
import LicenseStore from '../stores/license_store';
|
||||
|
||||
import WhitelabelActions from '../actions/whitelabel_actions';
|
||||
import WhitelabelStore from '../stores/whitelabel_store';
|
||||
|
||||
import PieceListStore from '../stores/piece_list_store';
|
||||
import PieceListActions from '../actions/piece_list_actions';
|
||||
|
||||
@ -35,7 +38,6 @@ let RegisterPiece = React.createClass( {
|
||||
propTypes: {
|
||||
headerMessage: React.PropTypes.string,
|
||||
submitMessage: React.PropTypes.string,
|
||||
canSpecifyEditions: React.PropTypes.bool,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element])
|
||||
@ -53,6 +55,7 @@ let RegisterPiece = React.createClass( {
|
||||
return mergeOptions(
|
||||
LicenseStore.getState(),
|
||||
UserStore.getState(),
|
||||
WhitelabelStore.getState(),
|
||||
PieceListStore.getState(),
|
||||
{
|
||||
selectedLicense: 0,
|
||||
@ -62,15 +65,18 @@ let RegisterPiece = React.createClass( {
|
||||
|
||||
componentDidMount() {
|
||||
LicenseActions.fetchLicense();
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
LicenseStore.listen(this.onChange);
|
||||
PieceListStore.listen(this.onChange);
|
||||
UserStore.listen(this.onChange);
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
LicenseStore.unlisten(this.onChange);
|
||||
PieceListStore.unlisten(this.onChange);
|
||||
UserStore.unlisten(this.onChange);
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
@ -136,7 +142,7 @@ let RegisterPiece = React.createClass( {
|
||||
},
|
||||
|
||||
getSpecifyEditions() {
|
||||
if (this.props.canSpecifyEditions) {
|
||||
if (this.state.whitelabel.acl_editions) {
|
||||
return (
|
||||
<PropertyCollapsible
|
||||
name="num_editions"
|
||||
|
@ -32,7 +32,7 @@ let SettingsContainer = React.createClass({
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<div className="settings-container">
|
||||
<AccountSettings />
|
||||
<APISettings />
|
||||
<BitcoinWalletSettings />
|
||||
@ -104,7 +104,7 @@ let AccountSettings = React.createClass({
|
||||
show={true}
|
||||
defaultExpanded={true}>
|
||||
{content}
|
||||
<Form
|
||||
{/*<Form
|
||||
url={AppConstants.serverUrl + 'api/users/set_language/'}>
|
||||
<Property
|
||||
name='language'
|
||||
@ -121,7 +121,7 @@ let AccountSettings = React.createClass({
|
||||
</select>
|
||||
</Property>
|
||||
<hr />
|
||||
</Form>
|
||||
</Form>*/}
|
||||
</CollapsibleParagraph>
|
||||
);
|
||||
}
|
||||
@ -297,10 +297,10 @@ let APISettings = React.createClass({
|
||||
name={app.name}
|
||||
label={app.name}>
|
||||
<div className="row-same-height">
|
||||
<div className="no-padding col-xs-6 col-xs-height col-middle">
|
||||
<div className="no-padding col-xs-6 col-sm-10 col-xs-height col-middle">
|
||||
{'Bearer ' + app.bearer_token.token}
|
||||
</div>
|
||||
<div className="col-xs-6 col-xs-height">
|
||||
<div className="col-xs-6 col-sm-2 col-xs-height">
|
||||
<button
|
||||
className="pull-right btn btn-default btn-sm"
|
||||
onClick={this.handleTokenRefresh}
|
||||
@ -346,4 +346,4 @@ let APISettings = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default SettingsContainer;
|
||||
export default SettingsContainer;
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
import React from 'react';
|
||||
import SignupForm from './ascribe_forms/form_signup';
|
||||
import Property from './ascribe_forms/property';
|
||||
|
||||
import { getLangText } from '../utils/lang_utils';
|
||||
|
||||
|
||||
let SignupContainer = React.createClass({
|
||||
@ -35,15 +32,7 @@ let SignupContainer = React.createClass({
|
||||
}
|
||||
return (
|
||||
<div className="ascribe-login-wrapper">
|
||||
<SignupForm handleSuccess={this.handleSuccess}>
|
||||
<Property
|
||||
name='promo_code'
|
||||
label={getLangText('Promocode')}>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={getLangText('Enter a promocode here (Optional)')}/>
|
||||
</Property>
|
||||
</SignupForm>
|
||||
<SignupForm handleSuccess={this.handleSuccess} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import PieceActions from '../../../../../actions/piece_actions';
|
||||
import PieceStore from '../../../../../stores/piece_store';
|
||||
|
||||
import Piece from '../../../../../components/ascribe_detail/piece';
|
||||
|
||||
import AppConstants from '../../../../../constants/application_constants';
|
||||
|
||||
import Form from '../../../../../components/ascribe_forms/form';
|
||||
import Property from '../../../../../components/ascribe_forms/property';
|
||||
import InputTextAreaToggable from '../../../../../components/ascribe_forms/input_textarea_toggable';
|
||||
import CollapsibleParagraph from '../../../../../components/ascribe_collapsible/collapsible_paragraph';
|
||||
|
||||
/**
|
||||
* This is the component that implements resource/data specific functionality
|
||||
*/
|
||||
let PieceContainer = React.createClass({
|
||||
getInitialState() {
|
||||
return PieceStore.getState();
|
||||
},
|
||||
|
||||
onChange(state) {
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
PieceStore.listen(this.onChange);
|
||||
PieceActions.fetchOne(this.props.params.pieceId);
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
// Every time we're leaving the piece detail page,
|
||||
// just reset the piece that is saved in the piece store
|
||||
// as it will otherwise display wrong/old data once the user loads
|
||||
// the piece detail a second time
|
||||
PieceActions.updatePiece({});
|
||||
|
||||
PieceStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
|
||||
loadPiece() {
|
||||
PieceActions.fetchOne(this.props.params.pieceId);
|
||||
},
|
||||
|
||||
render() {
|
||||
if('title' in this.state.piece) {
|
||||
return (
|
||||
<Piece
|
||||
piece={this.state.piece}
|
||||
loadPiece={this.loadPiece}>
|
||||
<PrizePieceDetails piece={this.state.piece}/>
|
||||
</Piece>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="fullpage-spinner">
|
||||
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let PrizePieceDetails = React.createClass({
|
||||
propTypes: {
|
||||
piece: React.PropTypes.object
|
||||
},
|
||||
render() {
|
||||
if (this.props.piece.prize
|
||||
&& this.props.piece.prize.name
|
||||
&& Object.keys(this.props.piece.extra_data).length !== 0){
|
||||
return (
|
||||
<CollapsibleParagraph
|
||||
title="Prize Details"
|
||||
show={true}
|
||||
defaultExpanded={true}>
|
||||
<Form ref='form'>
|
||||
{Object.keys(this.props.piece.extra_data).map((data) => {
|
||||
let label = data.replace('_', ' ');
|
||||
return (
|
||||
<Property
|
||||
name={data}
|
||||
label={label}
|
||||
editable={false}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={false}
|
||||
defaultValue={this.props.piece.extra_data[data]}/>
|
||||
</Property>);
|
||||
}
|
||||
)}
|
||||
<hr />
|
||||
</Form>
|
||||
</CollapsibleParagraph>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
export default PieceContainer;
|
@ -14,20 +14,20 @@ let Landing = React.createClass({
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
<div className="col-xs-12 wp-landing-wrapper">
|
||||
<h1>Sluice Art Prize 2015</h1>
|
||||
<h1>Sluice_screens ↄc Prize 2015</h1>
|
||||
<p>
|
||||
This is the submission page for sluice art fair price 2015.
|
||||
This is the submission page for Sluice_screens ↄc Prize 2015.
|
||||
</p>
|
||||
<ButtonGroup className="enter" bsSize="large" vertical block>
|
||||
<ButtonLink to="signup">
|
||||
Signup to the prize
|
||||
Signup to submit
|
||||
</ButtonLink>
|
||||
|
||||
<p>
|
||||
or, already an ascribe user?
|
||||
</p>
|
||||
<ButtonLink to="login">
|
||||
Login with ascribe
|
||||
Login to submit
|
||||
</ButtonLink>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
|
@ -14,8 +14,7 @@ let PrizeRegisterPiece = React.createClass({
|
||||
return (
|
||||
<RegisterPiece
|
||||
headerMessage={getLangText('Submit to the prize')}
|
||||
submitMessage={getLangText('Submit')}
|
||||
canSpecifyEditions={false} >
|
||||
submitMessage={getLangText('Submit')}>
|
||||
<Property
|
||||
name='artist_statement'
|
||||
label={getLangText('Artist statement')}
|
||||
|
@ -28,15 +28,16 @@ let SignupContainer = React.createClass({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="ascribe-login-wrapper">
|
||||
<SignupForm
|
||||
headerMessage="Create account for submission"
|
||||
submitMessage="Sign up"
|
||||
handleSuccess={this.handleSuccess} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="ascribe-login-wrapper">
|
||||
<SignupForm
|
||||
headerMessage="Sign up to the prize"
|
||||
submitMessage="Sign up"
|
||||
handleSuccess={this.handleSuccess} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,12 @@ import AppConstants from '../../../../constants/application_constants';
|
||||
|
||||
function getApiUrls(subdomain) {
|
||||
return {
|
||||
'pieces_list': AppConstants.apiEndpoint + 'prize/' + subdomain + '/pieces/'
|
||||
'pieces_list': AppConstants.apiEndpoint + 'prize/' + subdomain + '/pieces/',
|
||||
'users_login': AppConstants.apiEndpoint + 'prize/' + subdomain + '/users/login/',
|
||||
'users_signup': AppConstants.apiEndpoint + 'prize/' + subdomain + '/users/',
|
||||
'user': AppConstants.apiEndpoint + 'prize/' + subdomain + '/users/',
|
||||
'piece_submit_to_prize': AppConstants.apiEndpoint + 'prize/' + subdomain + '/pieces/${piece_id}/submit/',
|
||||
'piece': AppConstants.apiEndpoint + 'prize/' + subdomain + '/pieces/${piece_id}/'
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import SignupContainer from './components/signup_container';
|
||||
import PasswordResetContainer from '../../../components/password_reset_container';
|
||||
import PrizeRegisterPiece from './components/register_piece';
|
||||
import PrizePieceList from './components/piece_list';
|
||||
import PieceContainer from '../../ascribe_detail/piece_container';
|
||||
import PrizePieceContainer from './components/ascribe_detail/piece_container';
|
||||
import EditionContainer from '../../ascribe_detail/edition_container';
|
||||
import SettingsContainer from '../../../components/settings_container';
|
||||
|
||||
@ -29,7 +29,7 @@ function getRoutes(commonRoutes) {
|
||||
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||
<Route name="register_piece" path="register_piece" handler={PrizeRegisterPiece} />
|
||||
<Route name="pieces" path="collection" handler={PrizePieceList} />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PieceContainer} />
|
||||
<Route name="piece" path="pieces/:pieceId" handler={PrizePieceContainer} />
|
||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||
</Route>
|
||||
|
@ -24,10 +24,11 @@ let apiUrls = {
|
||||
'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/',
|
||||
'ownership_consigns_confirm': AppConstants.apiEndpoint + 'ownership/consigns/confirm/',
|
||||
'ownership_consigns_deny': AppConstants.apiEndpoint + 'ownership/consigns/deny/',
|
||||
'ownership_loans': AppConstants.apiEndpoint + 'ownership/loans/',
|
||||
'ownership_loans_pieces': AppConstants.apiEndpoint + 'ownership/loans/pieces/',
|
||||
'ownership_loans_editions': AppConstants.apiEndpoint + 'ownership/loans/editions/',
|
||||
'ownership_loans_confirm': AppConstants.apiEndpoint + 'ownership/loans/confirm/',
|
||||
'ownership_loans_deny': AppConstants.apiEndpoint + 'ownership/loans/deny/',
|
||||
'ownership_loans_contract': AppConstants.apiEndpoint + 'ownership/loans/contract/',
|
||||
'ownership_loans_contract': AppConstants.apiEndpoint + 'ownership/loans/editions/contract/',
|
||||
'ownership_shares_editions': AppConstants.apiEndpoint + 'ownership/shares/editions/',
|
||||
'ownership_shares_pieces': AppConstants.apiEndpoint + 'ownership/shares/pieces/',
|
||||
'ownership_transfers': AppConstants.apiEndpoint + 'ownership/transfers/',
|
||||
|
@ -148,7 +148,7 @@ const languages = {
|
||||
'Hash of Artwork, title, etc': 'Hash of Artwork, title, etc',
|
||||
'Owned by SPOOL address': 'Owned by SPOOL address',
|
||||
'Are you sure you would like to permanently delete this edition%s': 'Are you sure you would like to permanently delete this edition%s',
|
||||
'This is an irrevocable action%s': 'This is an irrevocable action%s',
|
||||
'This is an irrevocable action%s': 'You can not undo this action%s',
|
||||
'DELETE': 'DELETE',
|
||||
'YES, DELETE': 'YES, DELETE',
|
||||
'CLOSE': 'CLOSE',
|
||||
@ -223,7 +223,11 @@ const languages = {
|
||||
'Sign up to the prize': 'Sign up to the prize',
|
||||
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
|
||||
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
|
||||
'Log in with ascribe': 'Log in with ascribe'
|
||||
'Log in with ascribe': 'Log in with ascribe',
|
||||
'Submitted to prize': 'Submitted to prize',
|
||||
'Welcome to ascribe': 'Welcome to ascribe',
|
||||
'CREATE EDITIONS': 'CREATE EDITIONS',
|
||||
'Remove Piece': 'Remove Piece'
|
||||
},
|
||||
'de': {
|
||||
'ID': 'ID',
|
||||
@ -447,7 +451,11 @@ const languages = {
|
||||
'Sign up to the prize': 'Sign up to the prize',
|
||||
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
|
||||
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
|
||||
'Log in with ascribe': 'Log in with ascribe'
|
||||
'Log in with ascribe': 'Log in with ascribe',
|
||||
'Submitted to prize': 'Submitted to prize',
|
||||
'Welcome to ascribe': 'Welcome to ascribe',
|
||||
'CREATE EDITIONS': 'CREATE EDITIONS',
|
||||
'Remove Piece': 'Remove Piece'
|
||||
},
|
||||
'fr': {
|
||||
'ID': 'ID',
|
||||
@ -671,7 +679,11 @@ const languages = {
|
||||
'Sign up to the prize': 'Sign up to the prize',
|
||||
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
|
||||
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
|
||||
'Log in with ascribe': 'Log in with ascribe'
|
||||
'Log in with ascribe': 'Log in with ascribe',
|
||||
'Submitted to prize': 'Submitted to prize',
|
||||
'Welcome to ascribe': 'Welcome to ascribe',
|
||||
'CREATE EDITIONS': 'CREATE EDITIONS',
|
||||
'Remove Piece': 'Remove Piece'
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
import requests from '../utils/requests';
|
||||
import AppConstants from '../constants/application_constants';
|
||||
|
||||
import ApiUrls from '../constants/api_urls';
|
||||
|
||||
let OwnershipFetcher = {
|
||||
/**
|
||||
@ -10,7 +10,7 @@ let OwnershipFetcher = {
|
||||
* If no arg is supplied, load the current user
|
||||
*/
|
||||
fetchLoanContract(email) {
|
||||
return requests.get(AppConstants.apiEndpoint + 'ownership/loans/contract/?loanee=' + email);
|
||||
return requests.get(ApiUrls.ownership_loans_contract + '?loanee=' + email);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@ import requests from '../utils/requests';
|
||||
import React from 'react';
|
||||
|
||||
import AlertDismissable from '../components/ascribe_forms/alert';
|
||||
import { getLangText } from '../utils/lang_utils.js'
|
||||
import { getLangText } from '../utils/lang_utils.js';
|
||||
|
||||
export const FormMixin = {
|
||||
propTypes: {
|
||||
|
22
js/stores/loan_contract_store.js
Normal file
22
js/stores/loan_contract_store.js
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
import alt from '../alt';
|
||||
import LoanContractActions from '../actions/loan_contract_actions';
|
||||
|
||||
|
||||
class LoanContractStore {
|
||||
constructor() {
|
||||
this.contractKey = null;
|
||||
this.contractUrl = null;
|
||||
this.contractEmail = null;
|
||||
this.bindActions(LoanContractActions);
|
||||
}
|
||||
|
||||
onUpdateLoanContract({contractKey, contractUrl, contractEmail}) {
|
||||
this.contractKey = contractKey;
|
||||
this.contractUrl = contractUrl;
|
||||
this.contractEmail = contractEmail;
|
||||
}
|
||||
}
|
||||
|
||||
export default alt.createStore(LoanContractStore, 'LoanContractStore');
|
@ -4,6 +4,14 @@ import languages from '../constants/languages';
|
||||
|
||||
import { formatText } from './general_utils';
|
||||
|
||||
|
||||
export function getLang() {
|
||||
// this is just for testing, as changing the navigator.language wasn't possible
|
||||
// return 'fr';
|
||||
return navigator.languages ? navigator.languages[0] :
|
||||
(navigator.language || navigator.userLanguage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is used to translate strings to another language. Basically can be used with C's string format method.
|
||||
* @param {string} s The string you want to translate
|
||||
@ -11,9 +19,7 @@ import { formatText } from './general_utils';
|
||||
* @return {string} The formated string
|
||||
*/
|
||||
export function getLangText(s, ...args) {
|
||||
let lang = navigator.language || navigator.userLanguage;
|
||||
// this is just for testing, as changing the navigator.language wasn't possible
|
||||
//ang = 'de';
|
||||
let lang = getLang();
|
||||
try {
|
||||
if(lang in languages) {
|
||||
return formatText(languages[lang][s], args);
|
||||
|
@ -1,3 +1,7 @@
|
||||
.settings-container{
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.ascribe-settings-wrapper {
|
||||
width: 100%;
|
||||
@ -96,7 +100,7 @@
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
> input, > pre, > textarea, > select {
|
||||
> input, > pre, > textarea, > select, .datepicker__input {
|
||||
font-weight: 400;
|
||||
font-size: 1.1em;
|
||||
width:100%;
|
||||
@ -105,6 +109,7 @@
|
||||
background-color: rgba(0,0,0,0);
|
||||
color: rgba(0,0,0,.8);
|
||||
padding-left: 0;
|
||||
box-shadow: none;
|
||||
|
||||
&:focus {
|
||||
border:0;
|
||||
|
@ -44,6 +44,11 @@ hr {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
form{
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#main {
|
||||
height: 100%;
|
||||
}
|
||||
@ -217,6 +222,10 @@ hr {
|
||||
padding-bottom: 0.4em;
|
||||
}
|
||||
|
||||
.ascribe-detail-property-label{
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
::-webkit-input-placeholder { /* WebKit browsers */
|
||||
font-size: 0.9em;
|
||||
font-style: italic;
|
||||
@ -234,18 +243,6 @@ hr {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.input-text-ascribe,
|
||||
.datepicker__input {
|
||||
border-bottom: 1px solid black;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
background: transparent;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.textarea-ascribe-message {
|
||||
height: 13em !important;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
.wp {
|
||||
height: 100%;
|
||||
|
||||
max-width: 90%;
|
||||
margin: auto;
|
||||
/* We need this, otherwise piece list will have a scrollbar */
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user