diff --git a/js/actions/contract_agreement_list_actions.js b/js/actions/contract_agreement_list_actions.js
index 94f292c5..86988f47 100644
--- a/js/actions/contract_agreement_list_actions.js
+++ b/js/actions/contract_agreement_list_actions.js
@@ -37,11 +37,11 @@ class ContractAgreementListActions {
fetchAvailableContractAgreementList(issuer){
return Q.Promise((resolve, reject) => {
- this.actions.fetchContractAgreementList(issuer, 'True', null)
+ this.actions.fetchContractAgreementList(issuer, true, null)
.then((contractAgreementListAccepted) => {
if (!contractAgreementListAccepted) {
// fetch pending agreements if no accepted ones
- return this.actions.fetchContractAgreementList(issuer, null, 'True');
+ return this.actions.fetchContractAgreementList(issuer, null, true);
}
else {
resolve(contractAgreementListAccepted);
diff --git a/js/app.js b/js/app.js
index 5ad36d28..bd9e79be 100644
--- a/js/app.js
+++ b/js/app.js
@@ -46,7 +46,6 @@ requests.defaults({
class AppGateway {
-
start() {
let settings;
let subdomain = window.location.host.split('.')[0];
diff --git a/js/components/acl_proxy.js b/js/components/acl_proxy.js
index 10a7516e..4fc90a9b 100644
--- a/js/components/acl_proxy.js
+++ b/js/components/acl_proxy.js
@@ -21,7 +21,7 @@ let AclProxy = React.createClass({
},
getChildren() {
- if (this.props.children.length && this.props.children.length > 1){
+ if (React.Children.count(this.props.children) > 1){
/*
This might ruin styles for header items in the navbar etc
*/
diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js
index 47703ded..f7b1f76f 100644
--- a/js/components/ascribe_forms/form.js
+++ b/js/components/ascribe_forms/form.js
@@ -65,12 +65,12 @@ let Form = React.createClass({
reset() {
// If onReset prop is defined from outside,
// notify component that a form reset is happening.
- if(this.props.onReset && typeof this.props.onReset === 'function') {
+ if(typeof this.props.onReset === 'function') {
this.props.onReset();
}
for(let ref in this.refs) {
- if (this.refs[ref].reset && typeof this.refs[ref].reset === 'function'){
+ if(typeof this.refs[ref].reset === 'function') {
this.refs[ref].reset();
}
}
@@ -123,11 +123,12 @@ let Form = React.createClass({
getFormData() {
let data = {};
- for(let ref in this.refs){
+
+ for(let ref in this.refs) {
data[this.refs[ref].props.name] = this.refs[ref].state.value;
}
- if (this.props.getFormData && typeof this.props.getFormData === 'function'){
+ if(typeof this.props.getFormData === 'function') {
data = mergeOptionsWithDuplicates(data, this.props.getFormData());
}
@@ -135,16 +136,16 @@ let Form = React.createClass({
},
handleChangeChild(){
- this.setState({edited: true});
+ this.setState({ edited: true });
},
handleSuccess(response){
- if(this.props.handleSuccess && typeof this.props.handleSuccess === 'function') {
+ if(typeof this.props.handleSuccess === 'function') {
this.props.handleSuccess(response);
}
for(let ref in this.refs) {
- if(this.refs[ref] && this.refs[ref].handleSuccess && typeof this.refs[ref].handleSuccess === 'function'){
+ if(this.refs[ref] && typeof this.refs[ref].handleSuccess === 'function'){
this.refs[ref].handleSuccess();
}
}
@@ -163,8 +164,7 @@ let Form = React.createClass({
this.setState({errors: this.state.errors.concat(err.json.errors[input])});
}
}
- }
- else {
+ } else {
let formData = this.getFormData();
// sentry shouldn't post the user's password
@@ -187,7 +187,7 @@ let Form = React.createClass({
clearErrors(){
for(let ref in this.refs){
- if (this.refs[ref] && this.refs[ref].clearErrors && typeof this.refs[ref].clearErrors === 'function'){
+ if (this.refs[ref] && typeof this.refs[ref].clearErrors === 'function'){
this.refs[ref].clearErrors();
}
}
diff --git a/js/components/ascribe_forms/form_loan.js b/js/components/ascribe_forms/form_loan.js
index 8e83ca34..dacbae77 100644
--- a/js/components/ascribe_forms/form_loan.js
+++ b/js/components/ascribe_forms/form_loan.js
@@ -57,6 +57,15 @@ let LoanForm = React.createClass({
this.getContractAgreementsOrCreatePublic(this.props.email);
},
+ componentWillReceiveProps(nextProps) {
+ // however, it can also be that at the time the component is mounting,
+ // the email is not defined (because it's asynchronously fetched from the server).
+ // Then we need to update it as soon as it is included into LoanForm's props.
+ if(nextProps && nextProps.email) {
+ this.getContractAgreementsOrCreatePublic(nextProps.email);
+ }
+ },
+
componentWillUnmount() {
ContractAgreementListStore.unlisten(this.onChange);
},
@@ -66,11 +75,12 @@ let LoanForm = React.createClass({
},
getContractAgreementsOrCreatePublic(email){
+ ContractAgreementListActions.flushContractAgreementList();
if (email) {
ContractAgreementListActions.fetchAvailableContractAgreementList(email).then(
(contractAgreementList) => {
if (!contractAgreementList) {
- ContractAgreementListActions.createContractAgreementFromPublicContract.defer(email);
+ ContractAgreementListActions.createContractAgreementFromPublicContract(email);
}
}
);
diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js
index 8f2666c0..fbbc330a 100644
--- a/js/components/ascribe_forms/form_register_piece.js
+++ b/js/components/ascribe_forms/form_register_piece.js
@@ -13,7 +13,7 @@ import ApiUrls from '../../constants/api_urls';
import { getLangText } from '../../utils/lang_utils';
import { mergeOptions } from '../../utils/general_utils';
-import { isReadyForFormSubmission } from '../ascribe_uploader/react_s3_fine_uploader_utils';
+import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
let RegisterPieceForm = React.createClass({
@@ -100,7 +100,7 @@ let RegisterPieceForm = React.createClass({
ignoreFocus={true}>
You can leave this page and check back on the status later.
{getLangText('Computing hash(es)... This may take a few minutes.')}
-- {Math.ceil(this.props.hashingProgress)}% - {getLangText('Cancel hashing')} -
-{getLangText('Computing hash(es)... This may take a few minutes.')}
++ {getLangText('Cancel hashing')} +
+{getLangText('Would you rather')}
- +{getLangText('Drag files here')}
{getLangText('or')}
{getLangText('choose files to upload')} - +{getLangText('Drag a file here')}
{getLangText('or')}
{dialog} - +localBlankPagePath
property of the iframeSupport
option since this browser does not support the File API!localBlankPagePath
property of the iframeSupport
option since this browser does not support the File API!