1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +02:00

PR comments fix

This commit is contained in:
diminator 2015-09-17 11:39:55 +02:00
parent 5c2ec3ffb0
commit 63fffc2132
10 changed files with 72 additions and 70 deletions

View File

@ -91,12 +91,7 @@ class ContractAgreementListActions {
flushContractAgreementList(){
return Q.Promise((resolve, reject) => {
this.actions.updateContractAgreementList(null).then(
resolve()
).catch((err) => {
console.logGlobal(err);
reject(err);
});
return this.actions.updateContractAgreementList(null);
});
}

View File

@ -152,7 +152,7 @@ let Edition = React.createClass({
<CollapsibleParagraph
title="Notes"
show={(this.state.currentUser.username && true || false) ||
show={(!!this.state.currentUser.username) ||
(this.props.edition.acl.acl_edit || this.props.edition.public_note)}>
<Note
id={() => {return {'bitcoin_id': this.props.edition.bitcoin_id}; }}

View File

@ -237,7 +237,7 @@ let PieceContainer = React.createClass({
</CollapsibleParagraph>
<CollapsibleParagraph
title={getLangText('Notes')}
show={(this.state.currentUser.username && true || false) ||
show={(!!this.state.currentUser.username) ||
(this.state.piece.public_note)}>
<Note
id={this.getId}

View File

@ -8,8 +8,8 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
import Form from './form';
import Property from './property';
import apiUrls from '../../constants/api_urls';
import appConstants from '../../constants/application_constants';
import ApiUrls from '../../constants/api_urls';
import AppConstants from '../../constants/application_constants';
import { getLangText } from '../../utils/lang_utils';
@ -25,10 +25,7 @@ let CopyrightAssociationForm = React.createClass({
},
getProfileFormData(){
if (this.props.currentUser && this.props.currentUser.email){
return {email: this.props.currentUser.email};
}
return null;
return {email: this.props.currentUser.email};
},
render() {
@ -36,39 +33,42 @@ let CopyrightAssociationForm = React.createClass({
if (this.props.currentUser
&& this.props.currentUser.profile
&& this.props.currentUser.profile.copyright_association) {
selectedState = appConstants.copyrightAssociations.indexOf(this.props.currentUser.profile.copyright_association);
selectedState = AppConstants.copyrightAssociations.indexOf(this.props.currentUser.profile.copyright_association);
}
return (
<Form
ref='form'
url={apiUrls.users_profile}
getFormData={this.getProfileFormData}
handleSuccess={this.handleSubmitSuccess}>
<Property
name="copyright_association"
className="ascribe-settings-property-collapsible-toggle"
label={getLangText('Copyright Association')}
style={{paddingBottom: 0}}>
<select name="contract">
<option disabled selected={selectedState === -1}>
{getLangText(' -- select an association -- ')}
</option>
{appConstants.copyrightAssociations.map((association, i) => {
return (
<option
name={i}
key={i}
value={ association }
selected={selectedState === i}>
{ association }
</option>
);
})}
</select>
</Property>
<hr />
</Form>
);
if (this.props.currentUser && this.props.currentUser.email){
return (
<Form
ref='form'
url={ApiUrls.users_profile}
getFormData={this.getProfileFormData}
handleSuccess={this.handleSubmitSuccess}>
<Property
name="copyright_association"
className="ascribe-settings-property-collapsible-toggle"
label={getLangText('Copyright Association')}
style={{paddingBottom: 0}}>
<select name="contract">
<option disabled selected={selectedState === -1}>
{getLangText(' -- select an association -- ')}
</option>
{AppConstants.copyrightAssociations.map((association, i) => {
return (
<option
name={i}
key={i}
value={ association }
selected={selectedState === i}>
{ association }
</option>
);
})}
</select>
</Property>
<hr />
</Form>
);
}
return null;
}
});

View File

@ -79,12 +79,17 @@ let LoanForm = React.createClass({
getContractAgreementsOrCreatePublic(email){
/* a more complex defer (with promises) otherwise we dispatch while an action is being dispatched) */
window.setTimeout(() => {
ContractAgreementListActions.flushContractAgreementList();
ContractAgreementListActions.flushContractAgreementList()
.catch((err) => {
console.logGlobal(err);
});
if (email) {
// fetch the available contractagreements (pending/accepted)
ContractAgreementListActions.fetchAvailableContractAgreementList(email).then(
(contractAgreementList) => {
if (!contractAgreementList && this.props.createPublicContractAgreement) {
// for public contracts: fetch the public contract and create a contractagreement if available
ContractAgreementListActions.createContractAgreementFromPublicContract(email);
}
}

View File

@ -98,7 +98,7 @@ let CylandPieceContainer = React.createClass({
</CollapsibleParagraph>
<CollapsibleParagraph
title={getLangText('Notes')}
show={(this.state.currentUser.username && true || false) ||
show={(!!this.state.currentUser.username) ||
(this.state.piece.public_note)}>
<Note
id={() => {return {'id': this.state.piece.id}; }}

View File

@ -97,7 +97,7 @@ let IkonotvPieceContainer = React.createClass({
</CollapsibleParagraph>
<CollapsibleParagraph
title={getLangText('Notes')}
show={(this.state.currentUser.username && true || false) ||
show={(!!this.state.currentUser.username) ||
(this.state.piece.public_note)}>
<Note
id={() => {return {'id': this.state.piece.id}; }}

View File

@ -62,7 +62,7 @@ let IkonotvArtistDetailsForm = React.createClass({
},
render() {
if(this.props.piece && this.props.piece.id) {
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
return (
<Form
disabled={this.props.disabled}

View File

@ -7,8 +7,6 @@ import Property from '../../../../../ascribe_forms/property';
import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable';
//import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
import ApiUrls from '../../../../../../constants/api_urls';
import AppConstants from '../../../../../../constants/application_constants';
@ -62,7 +60,7 @@ let IkonotvArtworkDetailsForm = React.createClass({
},
render() {
if(this.props.piece && this.props.piece.id) {
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
return (
<Form
disabled={this.props.disabled}

View File

@ -9,6 +9,7 @@ import Button from 'react-bootstrap/lib/Button';
import NotificationActions from '../../../../../actions/notification_actions';
import NotificationStore from '../../../../../stores/notification_store';
import UserActions from '../../../../../actions/user_actions';
import UserStore from '../../../../../stores/user_store';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
@ -19,7 +20,8 @@ import GlobalNotificationActions from '../../../../../actions/global_notificatio
import CopyrightAssociationForm from '../../../../ascribe_forms/form_copyright_association';
import apiUrls from '../../../../../constants/api_urls';
import AppConstants from '../../../../../constants/application_constants';
import ApiUrls from '../../../../../constants/api_urls';
import requests from '../../../../../utils/requests';
import { getLangText } from '../../../../../utils/lang_utils';
@ -42,6 +44,7 @@ let IkonotvContractNotifications = React.createClass({
componentDidMount() {
NotificationStore.listen(this.onChange);
UserStore.listen(this.onChange);
UserActions.fetchCurrentUser();
WhitelabelStore.listen(this.onChange);
WhitelabelActions.fetchWhitelabel();
if (this.state.contractAgreementListNotifications === null){
@ -107,26 +110,26 @@ let IkonotvContractNotifications = React.createClass({
handleConfirm() {
let contractAgreement = this.state.contractAgreementListNotifications[0].contract_agreement;
requests.put(apiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id}).then(
requests.put(ApiUrls.ownership_contract_agreements_confirm, {contract_agreement_id: contractAgreement.id}).then(
() => this.handleConfirmSuccess()
);
},
handleConfirmSuccess() {
let notification = new GlobalNotificationModel(getLangText('You have accepted the conditions'), 'success', 10000);
let notification = new GlobalNotificationModel(getLangText('You have accepted the conditions'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
this.transitionTo('pieces');
},
handleDeny() {
let contractAgreement = this.state.contractAgreementListNotifications[0].contract_agreement;
requests.put(apiUrls.ownership_contract_agreements_deny, {contract_agreement_id: contractAgreement.id}).then(
requests.put(ApiUrls.ownership_contract_agreements_deny, {contract_agreement_id: contractAgreement.id}).then(
() => this.handleDenySuccess()
);
},
handleDenySuccess() {
let notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 10000);
let notification = new GlobalNotificationModel(getLangText('You have denied the conditions'), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
this.transitionTo('pieces');
},
@ -136,18 +139,19 @@ let IkonotvContractNotifications = React.createClass({
&& this.state.currentUser.profile.copyright_association){
return null;
}
return (
<div className='notification-contract-footer'>
<h1>{getLangText('Are you a member of any copyright societies?')}</h1>
<p>
ARS, DACS, Bildkunst, Pictoright, SODRAC, Copyright Agency/Viscopy, SAVA, Bildrecht GmbH,
SABAM, AUTVIS, CREAIMAGEN, SONECA, Copydan, EAU, Kuvasto, GCA, HUNGART, IVARO, SIAE, JASPAR-SPDA,
AKKA/LAA, LATGA-A, SOMAAP, ARTEGESTION, CARIER, BONO, APSAV, SPA, GESTOR, VISaRTA, RAO, LITA,
DALRO, VeGaP, BUS, ProLitteris, AGADU, AUTORARTE, BUBEDRA, BBDA, BCDA, BURIDA, ADAVIS, BSDA
</p>
<CopyrightAssociationForm currentUser={this.state.currentUser} />
</div>
);
if (this.state.currentUser && this.state.currentUser.profile) {
return (
<div className='notification-contract-footer'>
<h1>{getLangText('Are you a member of any copyright societies?')}</h1>
<p>
{AppConstants.copyrightAssociations.join(', ')}
</p>
<CopyrightAssociationForm currentUser={this.state.currentUser}/>
</div>
);
}
return null;
},
render() {