Changes for PR comments

This commit is contained in:
Brett Sun 2016-01-18 17:31:56 +01:00
parent 1ffa1eb6aa
commit 2ad2ea242d
14 changed files with 37 additions and 60 deletions

View File

@ -90,7 +90,7 @@ let AccordionListItemWallet = React.createClass({
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
EditionListActions.toggleEditionList(pieceId);
const notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
const notification = new GlobalNotificationModel(getLangText('Editions successfully created'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},

View File

@ -24,6 +24,8 @@ export default function ({ action, displayName, title, tooltip }) {
propTypes: {
availableAcls: React.PropTypes.object.isRequired,
handleSuccess: React.PropTypes.func.isRequired,
buttonAcceptName: React.PropTypes.string,
buttonAcceptClassName: React.PropTypes.string,
currentUser: React.PropTypes.object,
@ -32,14 +34,13 @@ export default function ({ action, displayName, title, tooltip }) {
React.PropTypes.object,
React.PropTypes.array
]).isRequired,
handleSuccess: React.PropTypes.func.isRequired,
className: React.PropTypes.string
},
sanitizeAction() {
const { buttonAcceptName } = this.props;
return buttonAcceptName ? buttonAcceptName : AclInformationText.titles[action];
return buttonAcceptName || AclInformationText.titles[action];
},
render() {

View File

@ -43,8 +43,9 @@ let MediaContainer = React.createClass({
const isEncoding = digitalWork.isEncoding;
if (digitalWork.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
const timerId = window.setInterval(refreshObject, ENCODE_UPDATE_TIME);
this.setState({ timerId: timerId });
this.setState({
timerId: window.setInterval(refreshObject, ENCODE_UPDATE_TIME)
});
}
}
},

View File

@ -35,7 +35,7 @@ let LoginForm = React.createClass({
},
handleSuccess({ success }) {
const notification = new GlobalNotificationModel('Login successful', 'success', 10000);
const notification = new GlobalNotificationModel(getLangText('Login successful'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
if (success) {

View File

@ -29,7 +29,7 @@ let PasswordResetContainer = React.createClass({
},
handleRequestSuccess(email) {
this.setState({ isRequested: email });
this.setState({ isRequested: !!email });
},
render() {
@ -38,31 +38,20 @@ let PasswordResetContainer = React.createClass({
if (emailQuery && tokenQuery) {
return (
<div>
<PasswordResetForm
email={emailQuery}
token={tokenQuery} />
</div>
<PasswordResetForm
email={emailQuery}
token={tokenQuery} />
);
} else if (!isRequested) {
return (
<PasswordRequestResetForm handleRequestSuccess={this.handleRequestSuccess} />
);
} else {
if (isRequested === false) {
return (
<div>
<PasswordRequestResetForm
handleRequestSuccess={this.handleRequestSuccess} />
</div>
);
} else if (isRequested) {
return (
<div>
<div className="ascribe-login-text ascribe-login-header">
{getLangText('If your email address exists in our database, you will receive a password recovery link in a few minutes.')}
</div>
</div>
);
} else {
return <span />;
}
return (
<div className="ascribe-login-text ascribe-login-header">
{getLangText('If your email address exists in our database, you will receive a password recovery link in a few minutes.')}
</div>
);
}
}
});

View File

@ -59,14 +59,6 @@ let PRApp = React.createClass({
const { currentUser, whitelabel } = this.state;
const subdomain = getSubdomain();
// Add the current user and whitelabel settings to all child routes
const childrenWithProps = React.Children.map(children, (child) => {
return React.cloneElement(child, {
currentUser,
whitelabel
});
});
let style = {};
let header;
if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) {

View File

@ -42,7 +42,6 @@ let PrizeRegisterPiece = React.createClass({
},
render() {
const { location } = this.props;
const { prize } = this.state;
setDocumentTitle(getLangText('Submit to the prize'));
@ -53,8 +52,7 @@ let PrizeRegisterPiece = React.createClass({
{...this.props}
enableLocalHashing={false}
headerMessage={''}
submitMessage={getLangText('Submit')}
location={location}>
submitMessage={getLangText('Submit')}>
<Property
name='artist_statement'
label={getLangText('Artist statement')}

View File

@ -38,7 +38,7 @@ const SluiceSelectedPrizeActionButton = React.createClass({
// Can't use default props since those are only created once
const startLoanDate = this.props.startLoanDate || new Moment();
const endLoanDate = this.props.endLoanDate || (new Moment()).add(6, 'months');
const endLoanDate = this.props.endLoanDate || new Moment().add(6, 'months');
return (
<ModalWrapper

View File

@ -183,14 +183,13 @@ let CylandRegisterPiece = React.createClass({
<Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm
currentUser={currentUser}
{...this.props}
disabled={step > 0}
enableLocalHashing={false}
headerMessage={getLangText('Submit to Cyland Archive')}
submitMessage={getLangText('Submit')}
isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess}
location={location} />
headerMessage={getLangText('Submit to Cyland Archive')}
isFineUploaderActive={true}
submitMessage={getLangText('Submit')} />
</Col>
</Row>
</div>

View File

@ -177,7 +177,7 @@ let IkonotvContractNotifications = React.createClass({
<a href={blob.url_safe} target="_blank">
<Glyphicon glyph='download-alt'/>
<span style={{padding: '0.3em'}}>
Download PDF version
{getLangText('Download PDF version')}
</span>
</a>
</div>
@ -194,8 +194,9 @@ let IkonotvContractNotifications = React.createClass({
</div>
</div>
);
} else {
return null;
}
return null;
}
});

View File

@ -191,7 +191,7 @@ let IkonotvRegisterPiece = React.createClass({
const { whitelabel } = this.props;
const { piece } = this.state;
const today = new Moment();
const endDate = (new Moment()).add(2, 'years');
const endDate = new Moment().add(2, 'years');
return (
<div data-slide-title={getLangText('Loan')}>
@ -219,7 +219,7 @@ let IkonotvRegisterPiece = React.createClass({
},
render() {
const { currentUser, location } = this.props;
const { location } = this.props;
const { pageExitWarning, step } = this.state;
return (
@ -236,14 +236,13 @@ let IkonotvRegisterPiece = React.createClass({
<Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm
currentUser={currentUser}
{...this.props}
disabled={step > 0}
enableLocalHashing={false}
headerMessage={getLangText('Register work')}
submitMessage={getLangText('Register')}
isFineUploaderActive={true}
handleSuccess={this.handleRegisterSuccess}
location={location} />
headerMessage={getLangText('Register work')}
isFineUploaderActive={true}
submitMessage={getLangText('Register')} />
</Col>
</Row>
</div>

View File

@ -29,7 +29,6 @@ let MarketPieceList = React.createClass({
render() {
const {
currentUser: { email: userEmail },
customThumbnailPlaceholder,
whitelabel: {
name: whitelabelName = 'Market',
user: whitelabelAdminEmail
@ -58,7 +57,6 @@ let MarketPieceList = React.createClass({
canLoadPieceList={canLoadPieceList}
redirectTo="/register_piece?slide_num=0"
bulkModalButtonListType={MarketAclButtonList}
customThumbnailPlaceholder={customThumbnailPlaceholder}
filterParams={filterParams} />
);
}

View File

@ -39,7 +39,6 @@ let WalletApp = React.createClass({
UserStore.listen(this.onChange);
WhitelabelStore.listen(this.onChange);
console.log('fetch');
UserActions.fetchCurrentUser();
WhitelabelActions.fetchWhitelabel();
},

View File

@ -103,7 +103,7 @@ function _doesObjectListHaveDuplicates(l) {
// Taken from: http://stackoverflow.com/a/7376645/1263876
// By casting the array to a set, and then checking if the size of the array
// shrunk in the process of casting, we can check if there were any duplicates
return (new Set(mergedList)).size !== mergedList.length;
return new Set(mergedList).size !== mergedList.length;
}
/**