1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

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); this.state.orderBy, this.state.orderAsc, this.state.filterBy);
EditionListActions.toggleEditionList(pieceId); 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); GlobalNotificationActions.appendGlobalNotification(notification);
}, },

View File

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

View File

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

View File

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

View File

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

View File

@ -59,14 +59,6 @@ let PRApp = React.createClass({
const { currentUser, whitelabel } = this.state; const { currentUser, whitelabel } = this.state;
const subdomain = getSubdomain(); 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 style = {};
let header; let header;
if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) { if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) {

View File

@ -42,7 +42,6 @@ let PrizeRegisterPiece = React.createClass({
}, },
render() { render() {
const { location } = this.props;
const { prize } = this.state; const { prize } = this.state;
setDocumentTitle(getLangText('Submit to the prize')); setDocumentTitle(getLangText('Submit to the prize'));
@ -53,8 +52,7 @@ let PrizeRegisterPiece = React.createClass({
{...this.props} {...this.props}
enableLocalHashing={false} enableLocalHashing={false}
headerMessage={''} headerMessage={''}
submitMessage={getLangText('Submit')} submitMessage={getLangText('Submit')}>
location={location}>
<Property <Property
name='artist_statement' name='artist_statement'
label={getLangText('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 // Can't use default props since those are only created once
const startLoanDate = this.props.startLoanDate || new Moment(); 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 ( return (
<ModalWrapper <ModalWrapper

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -103,7 +103,7 @@ function _doesObjectListHaveDuplicates(l) {
// Taken from: http://stackoverflow.com/a/7376645/1263876 // Taken from: http://stackoverflow.com/a/7376645/1263876
// By casting the array to a set, and then checking if the size of the array // 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 // 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;
} }
/** /**