Skip to content

Commit

Permalink
[xprototype#4/feature] Improvements on example that use hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcorrea committed Mar 29, 2019
1 parent 402057d commit f13c44c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/app/Prototype/Contracts/Form/FormComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ export default {
field.attrs.after = this.parseFieldAfter(field)
}

if (field.attrs.label) {
field.attrs.label = this.$lang(
[
`domains.${this.domain}.fields.${field.$key}.${field.attrs.label}`,
`domains.${this.domain}.${field.attrs.label}`,
field.attrs.label
],
field.attrs.label
)
}
if (!field.parseInput) {
field.parseInput = (value) => value
}
Expand Down
2 changes: 1 addition & 1 deletion src/domains/Example/Test/Prototype/TestWithHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class TestWithHooks extends Test {
*/
configureFields () {
this.field('active')
.fieldIsCheckbox({ label: 'if checked will hide "Description"' })
.fieldIsCheckbox({ label: 'active.label' })
.fieldFormWidth(45)
.fieldFormOrder(3, true)
.fieldOn('input', function ({ $event }) {
Expand Down
3 changes: 3 additions & 0 deletions src/domains/Example/Test/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default {
male: 'Male',
female: 'Female'
},
active: {
label: 'if checked will hide "Description"'
},
actions: {
goToTest: 'Go to Test'
},
Expand Down

0 comments on commit f13c44c

Please sign in to comment.