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() { render() {
const { const { badge,
linkData, buttons,
className, children,
thumbnail, className,
heading, heading,
subheading, linkData,
subsubheading, subheading,
buttons, subsubheading,
badge, thumbnail } = this.props;
children } = this.props;
return ( return (
<div className="row"> <div className="row">

View File

@ -44,15 +44,14 @@ let AccordionListItemPiece = React.createClass({
}, },
render() { render() {
const { const { artistName,
artistName, badge,
badge, buttons,
buttons, children,
children, className,
className, piece,
piece, subsubheading,
subsubheading, thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail; const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail;
// Display the 300x300 thumbnail if we have it, otherwise just use the safe url // 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() { render() {
const { const { availableAcls,
availableAcls, buttonsStyle,
buttonsStyle, className,
className, currentUser,
currentUser, handleSuccess,
handleSuccess, pieceOrEditions } = this.props;
pieceOrEditions } = this.props;
const buttonProps = selectFromObject(this.props, [ const buttonProps = selectFromObject(this.props, [
'availableAcls', 'availableAcls',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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