mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Merge remote-tracking branch 'origin/AD-435-hash-locally-for-when-a-artist-do' into AD-435-hash-locally-for-when-a-artist-do
This commit is contained in:
commit
c5072164eb
@ -63,7 +63,6 @@ let Form = React.createClass({
|
|||||||
if ('getFormData' in this.props){
|
if ('getFormData' in this.props){
|
||||||
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
|
||||||
}
|
}
|
||||||
console.log(data)
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2,18 +2,21 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import AppConstants from '../../constants/application_constants';
|
import UserStore from '../../stores/user_store';
|
||||||
|
import UserActions from '../../actions/user_actions';
|
||||||
|
|
||||||
import Form from './form';
|
import Form from './form';
|
||||||
import Property from './property';
|
import Property from './property';
|
||||||
import FormPropertyHeader from './form_property_header';
|
import FormPropertyHeader from './form_property_header';
|
||||||
|
|
||||||
import apiUrls from '../../constants/api_urls';
|
|
||||||
|
|
||||||
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
import ReactS3FineUploader from '../ascribe_uploader/react_s3_fine_uploader';
|
||||||
|
|
||||||
|
import AppConstants from '../../constants/application_constants';
|
||||||
|
import apiUrls from '../../constants/api_urls';
|
||||||
|
|
||||||
import { getCookie } from '../../utils/fetch_api_utils';
|
import { getCookie } from '../../utils/fetch_api_utils';
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
import { mergeOptions } from '../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
let RegisterPieceForm = React.createClass({
|
let RegisterPieceForm = React.createClass({
|
||||||
@ -33,10 +36,26 @@ let RegisterPieceForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getInitialState(){
|
getInitialState(){
|
||||||
return {
|
return mergeOptions(
|
||||||
digitalWorkKey: null,
|
{
|
||||||
isUploadReady: false
|
digitalWorkKey: null,
|
||||||
};
|
isUploadReady: false
|
||||||
|
},
|
||||||
|
UserStore.getState()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
UserStore.listen(this.onChange);
|
||||||
|
UserActions.fetchCurrentUser();
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
UserStore.unlisten(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
@ -67,6 +86,9 @@ let RegisterPieceForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let currentUser = this.state.currentUser;
|
||||||
|
let enableLocalHashing = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
@ -94,7 +116,8 @@ let RegisterPieceForm = React.createClass({
|
|||||||
submitKey={this.submitKey}
|
submitKey={this.submitKey}
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||||
editable={this.props.isFineUploaderEditable}/>
|
editable={this.props.isFineUploaderEditable}
|
||||||
|
enableLocalHashing={enableLocalHashing}/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property
|
<Property
|
||||||
name='artist_name'
|
name='artist_name'
|
||||||
@ -136,7 +159,8 @@ let FileUploader = React.createClass({
|
|||||||
// editable is used to lock react fine uploader in case
|
// editable is used to lock react fine uploader in case
|
||||||
// a user is actually not logged in already to prevent him from droping files
|
// a user is actually not logged in already to prevent him from droping files
|
||||||
// before login in
|
// before login in
|
||||||
editable: React.PropTypes.bool
|
editable: React.PropTypes.bool,
|
||||||
|
enableLocalHashing: React.PropTypes.bool
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -174,7 +198,7 @@ let FileUploader = React.createClass({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
enableLocalHashing={true} />
|
enableLocalHashing={this.props.enableLocalHashing} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -73,6 +73,7 @@ let AccountSettings = React.createClass({
|
|||||||
getFormDataProfile(){
|
getFormDataProfile(){
|
||||||
return {'email': this.state.currentUser.email};
|
return {'email': this.state.currentUser.email};
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let content = <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />;
|
let content = <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />;
|
||||||
let profile = null;
|
let profile = null;
|
||||||
@ -231,7 +232,6 @@ let LoanContractSettings = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title="Loan Contract Settings"
|
title="Loan Contract Settings"
|
||||||
@ -318,26 +318,30 @@ let APISettings = React.createClass({
|
|||||||
onChange(state) {
|
onChange(state) {
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
},
|
},
|
||||||
handleCreateSuccess: function(){
|
|
||||||
|
handleCreateSuccess() {
|
||||||
ApplicationActions.fetchApplication();
|
ApplicationActions.fetchApplication();
|
||||||
let notification = new GlobalNotificationModel(getLangText('Application successfully created'), 'success', 5000);
|
let notification = new GlobalNotificationModel(getLangText('Application successfully created'), 'success', 5000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleTokenRefresh: function(event){
|
handleTokenRefresh(event) {
|
||||||
let applicationName = event.target.getAttribute('data-id');
|
let applicationName = event.target.getAttribute('data-id');
|
||||||
ApplicationActions.refreshApplicationToken(applicationName);
|
ApplicationActions.refreshApplicationToken(applicationName);
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel(getLangText('Token refreshed'), 'success', 2000);
|
let notification = new GlobalNotificationModel(getLangText('Token refreshed'), 'success', 2000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let content = <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />;
|
let content = <img src={AppConstants.baseUrl + 'static/img/ascribe_animated_medium.gif'} />;
|
||||||
if (this.state.applications.length > -1) {
|
if (this.state.applications.length > -1) {
|
||||||
content = this.state.applications.map(function(app) {
|
content = this.state.applications.map(function(app, i) {
|
||||||
return (
|
return (
|
||||||
<Property
|
<Property
|
||||||
name={app.name}
|
name={app.name}
|
||||||
label={app.name}>
|
label={app.name}
|
||||||
|
key={i}>
|
||||||
<div className="row-same-height">
|
<div className="row-same-height">
|
||||||
<div className="no-padding col-xs-6 col-sm-10 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}
|
{'Bearer ' + app.bearer_token.token}
|
||||||
|
Loading…
Reference in New Issue
Block a user