Skip to content

Commit

Permalink
Fix tagName to use args
Browse files Browse the repository at this point in the history
  • Loading branch information
joegaudet committed Jul 17, 2020
1 parent 652e064 commit e5344eb
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions addon/components/field-for.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#let (-element (or @tagName "div")) as |Tag|}}
{{#let (-element this.tagName) as |Tag|}}
<Tag
@tagName={{or @tagName "div"}}
@tagName={{this.tagName}}
class={{
concat
"field-for "
Expand Down
10 changes: 10 additions & 0 deletions addon/components/field-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ export default class FieldForComponent extends Component {
@arg()
form = null;

/**
* The tag name that we use for this field
* @property tagName
* @type String
* @default form
* @public
*/
@arg(string)
tagName = 'div';

/**
* The label for this field
* @property field
Expand Down
8 changes: 4 additions & 4 deletions addon/components/form-for.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#let (-element (or @tagName "form")) as |Tag|}}
{{#let (-element this.tagName) as |Tag|}}
<Tag
@tagName={{or @tagName "form"}}
@tagName={{this.tagName}}
class="
form-for
{{if this.formClasses this.formClasses}}
Expand All @@ -17,7 +17,7 @@
field=(component
"field-for"
form=this
tagName=@fieldTagName
tagName=this.fieldTagName
disabled=this.disabled
readonly=this.readonly
inlineEditing=this.inlineEditing
Expand All @@ -31,7 +31,7 @@
fieldFor=(component
"field-for"
form=this
tagName=@fieldTagName
tagName=this.fieldTagName
disabled=this.disabled
readonly=this.readonly
inlineEditing=this.inlineEditing
Expand Down
20 changes: 20 additions & 0 deletions addon/components/form-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ export default class FormForComponent extends Component {
@arg(object)
model = {};

/**
* The tag name that we use for this form
* @property tagName
* @type String
* @default form
* @public
*/
@arg(string)
tagName = 'form';

/**
* The tag name that we use for this form's fields
* @property fieldTagName
* @type String
* @default form
* @public
*/
@arg(string)
fieldTagName = 'div';

/**
* Whether or not this form is disabled
* @property disabled
Expand Down

0 comments on commit e5344eb

Please sign in to comment.