Skip to content

Commit

Permalink
HBW-159 Submit each form on it's own button
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Smirnov committed Sep 9, 2019
1 parent e449169 commit a466c77
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ v1.8.0 [unreleased]
- [#317](https://github.com/latera/homs/pull/317) Validate `hbw.yml` config.
- [#318](https://github.com/latera/homs/pull/318) Improve scroll style in select_table.

v1.7.4 [unreleased]
v1.7.6 [unreleased]
-------------------
### Bugfixes
- [#323](https://github.com/latera/homs/pull/323) Submit each form on it's own button.

v1.7.5 [2019-07-11]
-------------------
### Bugfixes
- [#315](https://github.com/latera/homs/pull/315) Add additional exceptions for Oracle's date formats.
- [#316](https://github.com/latera/homs/pull/316) Fix the way ajax request are made in lookup select.

v1.7.4 [2019-07-04]
-------------------
### Bugfixes
- [#315](https://github.com/latera/homs/pull/315) Add additional exceptions for Oracle's date formats.

v1.7.3 [2019-06-28]
-------------------
### Bugfixes
Expand All @@ -60,7 +69,6 @@ v1.7.2 [2019-06-13]
-------------------
### Bugfixes
- [#301](https://github.com/latera/homs/pull/301) Change deprecated `render nothing: true` to `head`.
- [#311](https://github.com/latera/homs/pull/311) Fix overflow after form collapsing.

v1.7.1 [2019-05-17]
-------------------
Expand Down
6 changes: 4 additions & 2 deletions hbw/app/javascript/packs/hbw/components/entity_task.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ modulejs.define(
loading: true,
pending: null,
form: null,
collapsed: this.props.collapsed || false
collapsed: this.props.collapsed || false,
id: this.props.getComponentId()
};

componentDidMount () {
this.loadForm(this.props.task.id);
this.props.bind('hbw:submit-form', this.submitForm);
this.props.bind(`hbw:submit-form-${this.state.id}`, this.submitForm);

const e = jQuery(this.rootNode);
e.on('hidden.bs.collapse', this.choose);
Expand Down Expand Up @@ -63,6 +64,7 @@ modulejs.define(
renderForm = () => {
if (this.state.form) {
const opts = {
id: this.state.id,
form: this.state.form,
env: this.props.env,
error: this.state.error,
Expand Down
7 changes: 4 additions & 3 deletions hbw/app/javascript/packs/hbw/components/form.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ modulejs.define('HBWForm', ['React', 'jQuery', 'HBWError', 'HBWFormDatetime',

componentDidMount () {
jQuery(':input:enabled:visible:first').focus();
this.props.bind('hbw:submit-form', () => this.setState({ submitting: true }));
this.props.bind(`hbw:submit-form-${this.props.id}`, () => this.setState({ submitting: true }));
this.props.bind('hbw:form-submitting-failed', () => this.setState({ submitting: false }));
this.props.bind('hbw:file-upload-started', () => this.setState({ fileUploading: true }));
this.props.bind('hbw:file-upload-finished', () => this.setState({ fileUploading: false }));
Expand All @@ -43,6 +43,7 @@ modulejs.define('HBWForm', ['React', 'jQuery', 'HBWError', 'HBWFormDatetime',
const opts = {
name,
params,
id: this.props.id,
value: this.props.variables[name],
formSubmitting: this.state.submitting || this.state.fileUploading,
env: this.props.env,
Expand Down Expand Up @@ -128,10 +129,10 @@ modulejs.define('HBWForm', ['React', 'jQuery', 'HBWError', 'HBWFormDatetime',
return null;
}

this.props.trigger('hbw:validate-form');
this.props.trigger(`hbw:validate-form-${this.props.id}`);

if (this.isFormValid()) {
return this.props.trigger('hbw:submit-form', this.serializeForm());
return this.props.trigger(`hbw:submit-form-${this.props.id}`, this.serializeForm());
}

return null;
Expand Down
1 change: 1 addition & 0 deletions hbw/app/javascript/packs/hbw/components/form/group.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ modulejs.define('HBWFormGroup', ['React', 'HBWFormDatetime',
const opts = {
name,
params,
id: this.props.id,
value: this.props.variables[name],
formSubmitting: this.props.formSubmitting,
env: this.props.env
Expand Down
2 changes: 1 addition & 1 deletion hbw/app/javascript/packs/hbw/components/form/select.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ modulejs.define('HBWFormSelect',
}

validateOnSubmit = () => {
this.props.bind('hbw:validate-form', this.onFormSubmit);
this.props.bind(`hbw:validate-form-${this.props.id}`, this.onFormSubmit);
};

onFormSubmit = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ modulejs.define('HBWFormSelectTable',
}

validateOnSubmit = () => {
this.props.bind('hbw:validate-form', this.onFormSubmit);
this.props.bind(`hbw:validate-form-${this.props.id}`, this.onFormSubmit);
};

onFormSubmit = () => {
Expand Down
2 changes: 1 addition & 1 deletion hbw/app/javascript/packs/hbw/components/form/string.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ modulejs.define('HBWFormString', ['React'], (React) => {
}

validateOnSubmit = () => {
this.props.bind('hbw:validate-form', this.onFormSubmit);
this.props.bind(`hbw:validate-form-${this.props.id}`, this.onFormSubmit);
};

hijackFormatter = () => {
Expand Down

0 comments on commit a466c77

Please sign in to comment.