Commit ff6f9c8c authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

[quality] Use ref* as a prefix for all the ref functions;

parent 1bebb395
......@@ -37,7 +37,6 @@ class CategoryList extends React.Component {
}
render() {
let items = this.props.categories.map(cat =>
<CategoryListItem
cat={ cat }
......
......@@ -147,9 +147,10 @@ class CategoryListItem extends React.Component {
title={ $t('client.general.delete') }
/>);
let replacementSelectorCb = selector => {
let refReplacementSelector = selector => {
this.replacementSelector = selector;
};
let modalBody = (<div>
<div className="alert alert-info">
{ $t('client.category.erase', { title: c.title }) }
......@@ -157,7 +158,7 @@ class CategoryListItem extends React.Component {
<div>
<select
className="form-control"
ref={ replacementSelectorCb }>
ref={ refReplacementSelector }>
{ replacementOptions }
</select>
</div>
......@@ -170,10 +171,10 @@ class CategoryListItem extends React.Component {
/>);
}
let colorInputCb = input => {
let refColorInput = input => {
this.colorInput = input;
};
let titleInputCb = input => {
let refTitleInput = input => {
this.titleInput = input;
};
......@@ -183,7 +184,7 @@ class CategoryListItem extends React.Component {
<ColorPicker
defaultValue={ c.color }
onChange={ this.handleColorSave }
ref={ colorInputCb }
ref={ refColorInput }
/>
</td>
<td>
......@@ -194,7 +195,7 @@ class CategoryListItem extends React.Component {
defaultValue={ c.title }
onKeyUp={ this.handleKeyUp }
onBlur={ this.handleBlur }
ref={ titleInputCb }
ref={ refTitleInput }
/>
</td>
<td>
......
......@@ -31,11 +31,11 @@ const OpAmountTypeSelect = props => {
onChange(result);
};
let refPositive = node => {
let refShowPositive = node => {
inputs.showPositiveOps = node;
};
let refNegative = node => {
let refShowNegative = node => {
inputs.showNegativeOps = node;
};
......@@ -46,7 +46,7 @@ const OpAmountTypeSelect = props => {
name="showPositiveOps"
checked={ props.showPositiveOps }
onChange={ handleChange }
ref={ refPositive }
ref={ refShowPositive }
/>
<span>{ $t('client.charts.positive') }</span>
</label>
......@@ -57,7 +57,7 @@ const OpAmountTypeSelect = props => {
name="showNegativeOps"
checked={ props.showNegativeOps }
onChange={ handleChange }
ref={ refNegative }
ref={ refShowNegative }
/>
<span>{ $t('client.charts.negative') }</span>
</label>
......
......@@ -138,23 +138,23 @@ class OperationsComponent extends React.Component {
let negativeSum = computeTotal(format, x => x.amount < 0, wellOperations, 0);
let sum = computeTotal(format, () => true, wellOperations, 0);
let detailsModalCb = node => {
let refDetailsModal = node => {
this.detailsModal = node;
};
let operationPanelCb = node => {
let refOperationPanel = node => {
this.operationPanel = node;
};
let panelHeadingCb = node => {
let refPanelHeading = node => {
this.panelHeading = node;
};
let theadCb = node => {
let refThead = node => {
this.thead = node;
};
return (
<div>
<DetailsModal
ref={ detailsModalCb }
ref={ refDetailsModal }
formatCurrency={ format }
categories={ this.props.categories }
types={ this.props.types }
......@@ -199,10 +199,10 @@ class OperationsComponent extends React.Component {
<div
className="operation-panel panel panel-default"
ref={ operationPanelCb }>
ref={ refOperationPanel }>
<div
className="panel-heading"
ref={ panelHeadingCb }>
ref={ refPanelHeading }>
<h3 className="title panel-title">
{ $t('client.operations.title') }
</h3>
......@@ -211,7 +211,7 @@ class OperationsComponent extends React.Component {
<div className="table-responsive">
<table className="table table-hover table-bordered">
<thead ref={ theadCb }>
<thead ref={ refThead }>
<tr>
<th className="hidden-xs" />
<th className="col-sm-1 col-xs-2">
......
......@@ -94,20 +94,20 @@ class SearchComponent extends React.Component {
let handleDateLow = value => this.props.setDateLow(value);
let handleDateHigh = value => this.props.setDateHigh(value);
let searchFormCb = node => {
let refSearchForm = node => {
this.searchForm = node;
};
let lowAmountInputCb = node => {
let refLowAmountInput = node => {
this.lowAmountInput = node;
};
let highAmountInputCb = node => {
let refHighAmountInput = node => {
this.highAmountInput = node;
};
details = (
<form
className="panel-body transition-expand"
ref={ searchFormCb }>
ref={ refSearchForm }>
<div className="form-group">
<label htmlFor="keywords">
......@@ -173,7 +173,7 @@ class SearchComponent extends React.Component {
<AmountInput
onChange={ handleAmountLow }
id="amount-low"
ref={ lowAmountInputCb }
ref={ refLowAmountInput }
signId="search-sign-amount-low"
/>
</div>
......@@ -188,7 +188,7 @@ class SearchComponent extends React.Component {
<AmountInput
onChange={ handleAmountHigh }
id="amount-high"
ref={ highAmountInputCb }
ref={ refHighAmountInput }
signId="search-sign-amount-high"
/>
</div>
......
......@@ -40,10 +40,10 @@ const ImportModule = props => {
fileNameInput.value = e.target.value;
};
let fileNameInputCb = input => {
let refFileNameInput = input => {
fileNameInput = input;
};
let fileInputCb = input => {
let refFileInput = input => {
fileInput = input;
};
......@@ -53,7 +53,7 @@ const ImportModule = props => {
type="text"
className="form-control"
readOnly={ true }
ref={ fileNameInputCb }
ref={ refFileNameInput }
/>
<span className="input-group-btn">
......@@ -62,7 +62,7 @@ const ImportModule = props => {
<input
type="file"
name="importFile"
ref={ fileInputCb }
ref={ refFileInput }
onChange={ handleChange }
/>
</div>
......
......@@ -85,13 +85,13 @@ class AddOperationModal extends React.Component {
let labelTitle = $t('client.addoperationmodal.label');
let labelAmount = $t('client.addoperationmodal.amount');
let dateInputCb = input => {
let refDateInput = input => {
this.dateInput = input;
};
let titleInputCb = input => {
let refTitleInput = input => {
this.titleInput = input;
};
let amountInputCb = input => {
let refAmountInput = input => {
this.amountInput = input;
};
......@@ -110,7 +110,7 @@ class AddOperationModal extends React.Component {
onChange={ this.handleChangeDate }
inputID={ `date${this.props.account.id}` }
label={ labelDate }
ref={ dateInputCb }
ref={ refDateInput }
/>
<div className="form-group">
......@@ -130,7 +130,7 @@ class AddOperationModal extends React.Component {
inputID={ `title${this.props.account.id}` }
onChange={ this.handleChangeLabel }
label={ labelTitle }
ref={ titleInputCb }
ref={ refTitleInput }
/>
<ValidatedAmountInput
......@@ -138,7 +138,7 @@ class AddOperationModal extends React.Component {
label={ labelAmount }
inputID={ `amount${this.props.account.id}` }
className="form-control"
ref={ amountInputCb }
ref={ refAmountInput }
/>
<div className="form-group">
......
......@@ -37,6 +37,7 @@ class CustomBankField extends React.Component {
render() {
let customFieldFormInput, customFieldOptions, defaultValue;
let refFieldInput = input => {
this.fieldInput = input;
};
......
......@@ -50,17 +50,17 @@ class EditAccessModal extends React.Component {
render() {
this.customFieldsInputs = [];
let customFields;
let customFields;
if (this.props.customFields) {
customFields = this.props.customFields.map((field, index) => {
let customFieldsInputCb = input => {
let refCustomFieldInput = input => {
this.customFieldsInputs.push(input);
};
return (
<CustomBankField
key={ index }
ref={ customFieldsInputCb }
ref={ refCustomFieldInput }
params={ field }
/>
);
......@@ -68,10 +68,11 @@ class EditAccessModal extends React.Component {
}
let modalTitle = $t('client.editaccessmodal.title');
let loginInputCb = element => {
let refLoginInput = element => {
this.loginInput = element;
};
let passwordInputCb = element => {
let refPasswordInput = element => {
this.passwordInput = element;
};
......@@ -91,7 +92,7 @@ class EditAccessModal extends React.Component {
type="text"
className="form-control"
id="login"
ref={ loginInputCb }
ref={ refLoginInput }
/>
</div>
......@@ -101,7 +102,7 @@ class EditAccessModal extends React.Component {
</label>
<PasswordInput
id="password"
ref={ passwordInputCb }
ref={ refPasswordInput }
/>
</div>
......
......@@ -128,13 +128,13 @@ class NewBankForm extends React.Component {
if (selectedBank.customFields.length > 0) {
maybeCustomFields = selectedBank.customFields.map((field, index) => {
let key = `${index}${selectedBank.uuid}`;
let customFieldCb = input => {
let refCustomField = input => {
this.customFieldsInputs.set(key, input);
};
return (
<CustomBankField
ref={ customFieldCb }
ref={ refCustomField }
params={ field }
key={ key }
/>
......@@ -142,15 +142,16 @@ class NewBankForm extends React.Component {
});
}
let bankSelectorCb = element => {
let refBankSelector = element => {
this.bankSelector = element;
};
let loginInputCb = element => {
let refLoginInput = element => {
this.loginInput = element;
};
let passwordInputCb = element => {
let refPasswordInput = element => {
this.passwordInput = element;
};
let form = (
<div className="panel-body transition-expand">
<form
......@@ -163,7 +164,7 @@ class NewBankForm extends React.Component {
<select
className="form-control"
id="bank"
ref={ bankSelectorCb }
ref={ refBankSelector }
onChange={ this.handleChangeBank }
defaultValue={ selectedBank.uuid }>
{ options }
......@@ -180,7 +181,7 @@ class NewBankForm extends React.Component {
type="text"
className="form-control"
id="id"
ref={ loginInputCb }
ref={ refLoginInput }
/>
</div>
......@@ -189,7 +190,7 @@ class NewBankForm extends React.Component {
{ $t('client.settings.password') }
</label>
<PasswordInput
ref={ passwordInputCb }
ref={ refPasswordInput }
id="password"
/>
</div>
......
......@@ -24,13 +24,14 @@ class AccountSelector extends React.Component {
</option>
);
let selectorCb = selector => {
let refSelector = selector => {
this.selector = selector;
};
return (
<select
className="form-control"
ref={ selectorCb }>
ref={ refSelector }>
{ options }
</select>
);
......
......@@ -51,10 +51,10 @@ class AlertCreationModal extends React.Component {
let modalTitle = $t(this.props.titleTranslationKey);
let isBalanceAlert = this.props.alertType === 'balance';
let accountSelectorCb = selector => {
let refAccountSelector = selector => {
this.accountSelector = selector;
};
let orderSelectorCb = selector => {
let refOrderSelector = selector => {
this.orderSelector = selector;
};
......@@ -65,7 +65,7 @@ class AlertCreationModal extends React.Component {
{ $t('client.settings.emails.account') }
</label>
<AccountSelector
ref={ accountSelectorCb }
ref={ refAccountSelector }
id="account"
/>
</div>
......@@ -75,7 +75,7 @@ class AlertCreationModal extends React.Component {
<select
className="form-control"
ref={ orderSelectorCb }>
ref={ refOrderSelector }>
<option value="gt">{ $t('client.settings.emails.greater_than') }</option>
<option value="lt">{ $t('client.settings.emails.less_than') }</option>
</select>
......
......@@ -24,10 +24,11 @@ const ReportCreationModal = props => {
};
let modalTitle = $t('client.settings.emails.add_report');
let accountSelectorCb = selector => {
let refAccountSelector = selector => {
accountSelector = selector;
};
let frequencySelectorCb = input => {
let refFrequencySelector = input => {
frequencySelector = input;
};
......@@ -38,7 +39,7 @@ const ReportCreationModal = props => {
{ $t('client.settings.emails.account') }
</label>
<AccountSelector
ref={ accountSelectorCb }
ref={ refAccountSelector }
id="account"
/>
</div>
......@@ -48,7 +49,7 @@ const ReportCreationModal = props => {
<select
className="form-control"
ref={ frequencySelectorCb }>
ref={ refFrequencySelector }>
<option value="daily">
{ $t('client.settings.emails.daily') }
</option>
......
......@@ -85,16 +85,17 @@ class ColorPicker extends React.Component {
}
render() {
let inputCb = input => {
let refInput = input => {
this.input = input;
};
return (
<input
type={ Modernizr.inputtypes.color ? 'color' : 'hidden' }
className="form-control category-color"
defaultValue={ this.props.defaultValue || generateColor() }
onChange={ this.handleChange }
ref={ inputCb }
ref={ refInput }
/>);
}
}
......
......@@ -111,7 +111,7 @@ class DatePicker extends React.Component {
defaultDate = `${defaultValue.getFullYear()}/${defaultMonth}/${defaultDay}`;
}
let inputCb = input => {
let refInput = input => {
this.pickadateInput = input;
};
......@@ -119,7 +119,7 @@ class DatePicker extends React.Component {
<input
className="form-control"
type="text"
ref={ inputCb }
ref={ refInput }
data-value={ defaultDate }
/>
);
......
......@@ -15,6 +15,7 @@ class ValidatedAmountInput extends React.Component {
this.refInput = node => {
this.input = node;
};
this.handleChange = this.handleChange.bind(this);
}
......
......@@ -6,9 +6,11 @@ import React from 'react';
class ValidableInputText extends React.Component {
constructor(props) {
super(props);
this.refInput = node => {
this.input = node;
};
this.state = { valid: false };
this.handleChange = this.handleChange.bind(this);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment