1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Merge remote-tracking branch 'remotes/origin/AD-862-remove-confusion-introduced-in-prev-update' into AD-661-due-1208-implement-jury-rating-an

This commit is contained in:
diminator 2015-08-26 16:54:41 +02:00
commit c64aae332d
4 changed files with 66 additions and 13 deletions

View File

@ -26,13 +26,24 @@ let AccordionListItemPiece = React.createClass({
mixins: [Router.Navigation],
getLinkData(){
return {
to: 'piece',
params: {
pieceId: this.props.piece.id
}
};
getLinkData() {
if(this.props.piece && this.props.piece.first_edition) {
return {
to: 'edition',
params: {
editionId: this.props.piece.first_edition.bitcoin_id
}
};
} else {
return {
to: 'piece',
params: {
pieceId: this.props.piece.id
}
};
}
},
render() {

View File

@ -76,7 +76,27 @@ let PieceContainer = React.createClass({
},
onChange(state) {
this.setState(state);
/*
ATTENTION:
THIS IS JUST A TEMPORARY USABILITY FIX THAT ESSENTIALLY REMOVES THE LOAN BUTTON
FROM THE PIECE DETAIL PAGE SO THAT USERS DO NOT CONFUSE A PIECE WITH AN EDITION.
IT SHOULD BE REMOVED AND REPLACED WITH A BETTER SOLUTION ASAP!
*/
if(state && state.piece && state.piece.acl && typeof state.piece.acl.acl_loan !== 'undefined') {
let pieceState = mergeOptions({}, state.piece);
pieceState.acl.acl_loan = false;
this.setState({
piece: pieceState
});
} else {
this.setState(state);
}
},
loadPiece() {

View File

@ -39,13 +39,16 @@ let Form = React.createClass({
// You can use the form for inline requests, like the submit click on a button.
// For the form to then not display the error on top, you need to enable this option.
// It will make use of the GlobalNotification
isInline: React.PropTypes.bool
isInline: React.PropTypes.bool,
autoComplete: React.PropTypes.string
},
getDefaultProps() {
return {
method: 'post',
buttonSubmitText: 'SAVE'
buttonSubmitText: 'SAVE',
autoComplete: 'off'
};
},
@ -217,6 +220,25 @@ let Form = React.createClass({
});
},
/**
* All webkit-based browsers are ignoring the attribute autoComplete="off",
* as stated here: http://stackoverflow.com/questions/15738259/disabling-chrome-autofill/15917221#15917221
* So what we actually have to do is depended on whether or not this.props.autoComplete is set to "on" or "off"
* insert two fake hidden inputs that mock password and username so that chrome/safari is filling those
*/
getFakeAutocompletableInputs() {
if(this.props.autoComplete === 'off') {
return (
<span>
<input style={{display: 'none'}} type="text" name="fakeusernameremembered"/>
<input style={{display: 'none'}} type="password" name="fakepasswordremembered"/>
</span>
);
} else {
return null;
}
},
render() {
let className = 'ascribe-form';
@ -229,7 +251,8 @@ let Form = React.createClass({
role="form"
className={className}
onSubmit={this.submit}
autoComplete="on">
autoComplete={this.props.autoComplete}>
{this.getFakeAutocompletableInputs()}
{this.getErrors()}
{this.renderChildren()}
{this.getButtons()}

View File

@ -101,6 +101,7 @@ let LoginForm = React.createClass({
ref="loginForm"
url={ApiUrls.users_login}
handleSuccess={this.handleSuccess}
autoComplete="on"
buttons={
<button
type="submit"
@ -121,7 +122,6 @@ let LoginForm = React.createClass({
<input
type="email"
placeholder={getLangText('Enter your email')}
autoComplete="on"
name="username"
required/>
</Property>
@ -131,7 +131,6 @@ let LoginForm = React.createClass({
<input
type="password"
placeholder={getLangText('Enter your password')}
autoComplete="on"
name="password"
required/>
</Property>