1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Merge pull request #107 from ascribe/cosmetic-fix-for-multiline-destructure

Update multiline destructuring format based on style guide
This commit is contained in:
Tim Daubenschütz 2016-02-09 09:27:26 +01:00
commit dad4ea4e87
29 changed files with 218 additions and 254 deletions

View File

@ -21,16 +21,15 @@ let AccordionListItem = React.createClass({
},
render() {
const {
linkData,
className,
thumbnail,
heading,
subheading,
subsubheading,
buttons,
badge,
children } = this.props;
const { badge,
buttons,
children,
className,
heading,
linkData,
subheading,
subsubheading,
thumbnail } = this.props;
return (
<div className="row">

View File

@ -44,15 +44,14 @@ let AccordionListItemPiece = React.createClass({
},
render() {
const {
artistName,
badge,
buttons,
children,
className,
piece,
subsubheading,
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { artistName,
badge,
buttons,
children,
className,
piece,
subsubheading,
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail;
// Display the 300x300 thumbnail if we have it, otherwise just use the safe url

View File

@ -66,13 +66,12 @@ let AclButtonList = React.createClass({
},
render() {
const {
availableAcls,
buttonsStyle,
className,
currentUser,
handleSuccess,
pieceOrEditions } = this.props;
const { availableAcls,
buttonsStyle,
className,
currentUser,
handleSuccess,
pieceOrEditions } = this.props;
const buttonProps = selectFromObject(this.props, [
'availableAcls',

View File

@ -41,13 +41,12 @@ export default function AclButton({ action, displayName, title, tooltip }) {
},
render() {
const {
availableAcls,
buttonAcceptClassName,
currentUser,
email,
pieceOrEditions,
handleSuccess } = this.props;
const { availableAcls,
buttonAcceptClassName,
currentUser,
email,
pieceOrEditions,
handleSuccess } = this.props;
return (
<AclProxy

View File

@ -32,15 +32,14 @@ const DetailProperty = React.createClass({
},
render() {
const {
children,
className,
ellipsis,
label,
labelClassName,
separator,
valueClassName,
value } = this.props;
const { children,
className,
ellipsis,
label,
labelClassName,
separator,
valueClassName,
value } = this.props;
return (
<div className={classNames('row ascribe-detail-property', className)}>

View File

@ -53,14 +53,13 @@ let Edition = React.createClass({
},
render() {
const {
actionPanelButtonListType,
coaError,
currentUser,
edition,
furtherDetailsType: FurtherDetailsType,
loadEdition,
whitelabel } = this.props;
const { actionPanelButtonListType,
coaError,
currentUser,
edition,
furtherDetailsType: FurtherDetailsType,
loadEdition,
whitelabel } = this.props;
return (
<Row>

View File

@ -101,11 +101,10 @@ let EditionActionPanel = React.createClass({
},
render() {
const {
actionPanelButtonListType: ActionPanelButtonListType,
currentUser,
edition,
whitelabel } = this.props;
const { actionPanelButtonListType: ActionPanelButtonListType,
currentUser,
edition,
whitelabel } = this.props;
if (edition.notifications && edition.notifications.length) {
return (

View File

@ -45,17 +45,16 @@ let FurtherDetailsFileuploader = React.createClass({
},
render() {
const {
editable,
isReadyForFormSubmission,
multiple,
onValidationFailed,
otherData,
pieceId,
setIsUploadReady,
showErrorPrompt,
submitFile,
validation } = this.props;
const { editable,
isReadyForFormSubmission,
multiple,
onValidationFailed,
otherData,
pieceId,
setIsUploadReady,
showErrorPrompt,
submitFile,
validation } = this.props;
// Essentially there a three cases important to the fileuploader
//

View File

@ -54,16 +54,15 @@ let AclFormFactory = React.createClass({
},
render() {
const {
action,
autoFocusProperty,
pieceOrEditions,
currentUser,
email,
message,
labels,
handleSuccess,
showNotification } = this.props;
const { action,
autoFocusProperty,
pieceOrEditions,
currentUser,
email,
message,
labels,
handleSuccess,
showNotification } = this.props;
const formMessage = message || getAclFormMessage({
aclName: action,

View File

@ -62,15 +62,14 @@ let ConsignForm = React.createClass({
render() {
const { email } = this.state;
const {
autoFocusProperty,
createPublicContractAgreement,
email: defaultEmail,
handleSuccess,
id,
message,
labels,
url } = this.props;
const { autoFocusProperty,
createPublicContractAgreement,
email: defaultEmail,
handleSuccess,
id,
message,
labels,
url } = this.props;
return (
<Form

View File

@ -118,21 +118,20 @@ let LoanForm = React.createClass({
render() {
const { email } = this.state;
const {
children,
createPublicContractAgreement,
email: defaultEmail,
handleSuccess,
gallery,
loanHeading,
message,
showPersonalMessage,
endDate,
startDate,
showEndDate,
showStartDate,
showPassword,
url } = this.props;
const { children,
createPublicContractAgreement,
email: defaultEmail,
handleSuccess,
gallery,
loanHeading,
message,
showPersonalMessage,
endDate,
startDate,
showEndDate,
showStartDate,
showPassword,
url } = this.props;
return (
<Form

View File

@ -44,10 +44,9 @@ let LoginForm = React.createClass({
},
render() {
const {
headerMessage,
location: { query: { email: emailQuery } },
submitMessage } = this.props;
const { headerMessage,
location: { query: { email: emailQuery } },
submitMessage } = this.props;
return (
<Form

View File

@ -117,17 +117,16 @@ let RegisterPieceForm = React.createClass({
},
render() {
const {
children,
currentUser,
disabled,
enableLocalHashing,
handleSuccess,
headerMessage,
isFineUploaderActive,
isFineUploaderEditable,
location,
submitMessage } = this.props;
const { children,
currentUser,
disabled,
enableLocalHashing,
handleSuccess,
headerMessage,
isFineUploaderActive,
isFineUploaderEditable,
location,
submitMessage } = this.props;
const profileHashLocally = currentUser && currentUser.profile ? currentUser.profile.hash_locally : false;
const hashLocally = profileHashLocally && enableLocalHashing;

View File

@ -58,11 +58,10 @@ let SignupForm = React.createClass({
},
render() {
const {
children,
headerMessage,
location: { query: { email: emailQuery } },
submitMessage } = this.props;
const { children,
headerMessage,
location: { query: { email: emailQuery } },
submitMessage } = this.props;
const tooltipPassword = getLangText('Your password must be at least 10 characters') + '.\n ' +
getLangText('This password is securing your digital property like a bank account') + '.\n ' +

View File

@ -143,16 +143,14 @@ const InputContractAgreementCheckbox = React.createClass({
getContractCheckbox() {
const contractAgreement = this.getContractAgreement();
if(contractAgreement) {
const {
datetime_accepted: datetimeAccepted,
contract: {
issuer: contractIssuer,
blob: { url_safe: contractUrl }
}
} = contractAgreement;
if (contractAgreement) {
const { contract: {
issuer: contractIssuer,
blob: { url_safe: contractUrl }
},
datetime_accepted: datetimeAccepted } = contractAgreement;
if(datetimeAccepted) {
if (datetimeAccepted) {
return (
<div
className="notification-contract-pdf"
@ -168,10 +166,7 @@ const InputContractAgreementCheckbox = React.createClass({
</div>
);
} else {
const {
name,
disabled,
style } = this.props;
const { disabled, name, style } = this.props;
return (
<InputCheckbox

View File

@ -60,11 +60,11 @@ const InputFineUploader = React.createClass({
value: file.key
});
if(this.state.value && typeof this.props.onChange === 'function') {
if (this.state.value && typeof this.props.onChange === 'function') {
this.props.onChange({ target: { value: this.state.value } });
}
if(typeof this.props.submitFile === 'function') {
if (typeof this.props.submitFile === 'function') {
this.props.submitFile(file);
}
},
@ -81,28 +81,27 @@ const InputFineUploader = React.createClass({
},
render() {
const {
areAssetsDownloadable,
createBlobRoutine,
enableLocalHashing,
disabled,
fileClassToUpload,
fileInputElement,
handleChangedFile,
isFineUploaderActive,
isReadyForFormSubmission,
keyRoutine,
onValidationFailed,
setIsUploadReady,
setWarning,
showErrorPrompt,
uploadMethod,
validation } = this.props;
const { areAssetsDownloadable,
createBlobRoutine,
enableLocalHashing,
disabled,
fileClassToUpload,
fileInputElement,
handleChangedFile,
isFineUploaderActive,
isReadyForFormSubmission,
keyRoutine,
onValidationFailed,
setIsUploadReady,
setWarning,
showErrorPrompt,
uploadMethod,
validation } = this.props;
let editable = isFineUploaderActive;
// if disabled is actually set by property, we want to override
// isFineUploaderActive
if(typeof disabled !== 'undefined') {
if (typeof disabled !== 'undefined') {
editable = !disabled;
}

View File

@ -158,7 +158,7 @@ let FileDragAndDrop = React.createClass({
handlePauseFile={this.handlePauseFile}
handleResumeFile={this.handleResumeFile}
areAssetsDownloadable={areAssetsDownloadable}
areAssetsEditable={areAssetsEditable}/>
areAssetsEditable={areAssetsEditable} />
);
},
@ -176,16 +176,14 @@ let FileDragAndDrop = React.createClass({
},
render: function () {
const {
filesToUpload,
dropzoneInactive,
hashingProgress,
handleCancelHashing,
multiple,
showError,
errorClass,
fileClassToUpload,
allowedExtensions } = this.props;
const { allowedExtensions,
dropzoneInactive,
errorClass,
filesToUpload,
handleCancelHashing,
hashingProgress,
multiple,
showError } = this.props;
// has files only is true if there are files that do not have the status deleted, canceled, or failed
const hasFiles = filesToUpload

View File

@ -34,12 +34,11 @@ let FileDragAndDropDialog = React.createClass({
},
render() {
const {
multipleFiles,
enableLocalHashing,
uploadMethod,
fileClassToUpload,
onClick } = this.props;
const { enableLocalHashing,
fileClassToUpload,
multipleFiles,
onClick,
uploadMethod } = this.props;
let dialogElement;
if (enableLocalHashing && !uploadMethod) {

View File

@ -146,9 +146,7 @@ export default function UploadButton({ className = 'btn btn-default btn-sm', sho
},
render() {
const {
multiple,
allowedExtensions } = this.props;
const { allowedExtensions, multiple } = this.props;
const { disabled } = this.state;

View File

@ -1058,15 +1058,14 @@ const ReactS3FineUploader = React.createClass({
render() {
const { errorState: { errorClass }, filesToUpload, uploadInProgress } = this.state;
const {
areAssetsDownloadable,
areAssetsEditable,
enableLocalHashing,
fileClassToUpload,
fileInputElement: FileInputElement,
multiple,
showErrorPrompt,
uploadMethod } = this.props;
const { areAssetsDownloadable,
areAssetsEditable,
enableLocalHashing,
fileClassToUpload,
fileInputElement: FileInputElement,
multiple,
showErrorPrompt,
uploadMethod } = this.props;
// Only show the error state once all files are finished
const showError = !uploadInProgress && showErrorPrompt && errorClass != null;

View File

@ -53,11 +53,10 @@ let GlobalNotification = React.createClass({
},
renderNotification() {
const {
notificationQueue: [notification],
notificationStatus,
notificationsPaused,
containerWidth } = this.state;
const { containerWidth,
notificationsPaused,
notificationQueue: [notification],
notificationStatus } = this.state;
const notificationClasses = [];

View File

@ -277,15 +277,14 @@ let PieceList = React.createClass({
},
render() {
const {
accordionListItemType: AccordionListItemType,
bulkModalButtonListType: BulkModalButtonListType,
currentUser,
customSubmitButton,
customThumbnailPlaceholder,
filterParams,
orderParams,
whitelabel } = this.props;
const { accordionListItemType: AccordionListItemType,
bulkModalButtonListType: BulkModalButtonListType,
currentUser,
customSubmitButton,
customThumbnailPlaceholder,
filterParams,
orderParams,
whitelabel } = this.props;
const loadingElement = <AscribeSpinner color='dark-blue' size='lg'/>;

View File

@ -281,13 +281,12 @@ let PrizePieceRatings = React.createClass({
},
fetchRatingsIfAuthorized(state = this.state) {
const {
currentUser: {
is_admin: isAdmin,
is_judge: isJudge,
is_jury: isJury
},
piece: { id: pieceId } } = this.props;
const { currentUser: {
is_admin: isAdmin,
is_judge: isJudge,
is_jury: isJury
},
piece: { id: pieceId } } = this.props;
if (state.prize && 'active_round' in state.prize && (isAdmin || isJudge || isJury)) {
PrizeRatingActions.fetchOne(pieceId, state.prize.active_round);

View File

@ -34,13 +34,12 @@ let WalletPieceContainer = React.createClass({
},
render() {
const {
children,
currentUser,
handleDeleteSuccess,
loadPiece,
piece,
submitButtonType } = this.props;
const { children,
currentUser,
handleDeleteSuccess,
loadPiece,
piece,
submitButtonType } = this.props;
if (piece && piece.id) {
return (

View File

@ -27,14 +27,13 @@ let MarketAclButtonList = React.createClass({
},
render() {
const {
availableAcls,
children,
className,
currentUser,
handleSuccess,
pieceOrEditions,
whitelabel } = this.props;
const { availableAcls,
children,
className,
currentUser,
handleSuccess,
pieceOrEditions,
whitelabel } = this.props;
const buttonProps = selectFromObject(this.props, [
'availableAcls',

View File

@ -32,14 +32,13 @@ let MarketSubmitButton = React.createClass({
canEditionBeSubmitted(edition) {
if (edition && edition.extra_data && edition.other_data) {
const {
extra_data: {
artist_bio: artistBio,
display_instructions: displayInstructions,
technology_details: technologyDetails,
work_description: workDescription
},
other_data: otherData } = edition;
const { extra_data: {
artist_bio: artistBio,
display_instructions: displayInstructions,
technology_details: technologyDetails,
work_description: workDescription
},
other_data: otherData } = edition;
return artistBio && displayInstructions && technologyDetails && workDescription && otherData.length;
}
@ -78,13 +77,12 @@ let MarketSubmitButton = React.createClass({
},
render() {
const {
availableAcls,
currentUser,
className,
editions,
handleSuccess,
whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.props;
const { availableAcls,
currentUser,
className,
editions,
handleSuccess,
whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.props;
const { solePieceId, canSubmit } = this.getAggregateEditionDetails();
const message = getAclFormMessage({

View File

@ -107,16 +107,15 @@ let MarketAdditionalDataForm = React.createClass({
},
render() {
const {
editable,
extraData = {},
isInline,
handleSuccess,
otherData,
pieceId,
showHeading,
showNotification,
submitLabel } = this.props;
const { editable,
extraData = {},
isInline,
handleSuccess,
otherData,
pieceId,
showHeading,
showNotification,
submitLabel } = this.props;
let buttons;
let heading;

View File

@ -27,12 +27,11 @@ let MarketPieceList = React.createClass({
},
render() {
const {
currentUser: { email: userEmail },
whitelabel: {
name: whitelabelName = 'Market',
user: whitelabelAdminEmail
} } = this.props;
const { currentUser: { email: userEmail },
whitelabel: {
name: whitelabelName = 'Market',
user: whitelabelAdminEmail
} } = this.props;
let filterParams = null;
let isUserAdmin = null;

View File

@ -101,11 +101,10 @@ let MarketRegisterPiece = React.createClass({
},
render() {
const {
location,
whitelabel: {
name: whitelabelName = 'Market'
} } = this.props
const { location,
whitelabel: {
name: whitelabelName = 'Market'
} } = this.props
const { piece, step } = this.state;
setDocumentTitle(getLangText('Register a new piece'));