Skip to content

Commit

Permalink
clean example templates
Browse files Browse the repository at this point in the history
  • Loading branch information
esbanarango committed Mar 14, 2018
1 parent c5d02ca commit a22420e
Show file tree
Hide file tree
Showing 15 changed files with 168 additions and 258 deletions.
3 changes: 1 addition & 2 deletions tests/dummy/app/components/config-options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import Component from '@ember/component';

export default Component.extend({
allowBlank: true
});
});
41 changes: 16 additions & 25 deletions tests/dummy/app/templates/validators/date.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<div class="ui masthead vertical segment">
<div class="ui container">
<div class="introduction">

<h1 class="ui header">
Date

<div class="sub header">
Validates that the attributes' values are before the specified date or after it.
</div>
</h1>

<div class="ui hidden divider"></div>

</div>

</div>
</div>

Expand All @@ -26,31 +21,28 @@
</ul>

{{#ui-annotation showing=true type="javascript"}}
validations: {
birthdate: {
date: {
before: new Date()
}
},
graduationDate: {
date: {
after: '2015-01-01'
}
validations: {
birthdate: {
date: {
before: new Date()
}
},
graduationDate: {
date: {
after: '2015-01-01'
}
}
}
{{/ui-annotation}}
</p>

{{config-options defaultMessage=messages.wrongLengthMessage}}

{{#ui-example
header="Examples"
as |showing setCopyCode|}}

{{#ui-html showing=showing}}
<div class="ui two column grid">
<div class="column">

{{#object-form for=model classNames="segment"}}
<div class="disabled field">
<label>Academic degree</label>
Expand Down Expand Up @@ -85,7 +77,6 @@
</div>
</div>
{{/object-form}}

</div>
<div class="column">
<div class="ui segment">
Expand All @@ -96,12 +87,13 @@
{{/ui-html}}

{{#ui-annotation showing=showing type="javascript" setCopyCode=setCopyCode}}
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../mixins/model-validator';

export default DS.Model.extend(Validator,{
birthdate: DS.attr('date'),
graduationDate: DS.attr('date'),
export default Model.extend(Validator, {
birthdate: attr('date'),
graduationDate: attr('date'),

validations: {
birthdate: {
Expand All @@ -117,6 +109,5 @@ export default DS.Model.extend(Validator,{
}
});
{{/ui-annotation}}

{{/ui-example}}
</div>
</div>
17 changes: 5 additions & 12 deletions tests/dummy/app/templates/validators/email.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<div class="ui masthead vertical segment">
<div class="ui container">
<div class="introduction">

<h1 class="ui header">
Email

<div class="sub header">
Validates that the specified attribute is a well formatted email address.
</div>
</h1>

<div class="ui hidden divider"></div>

</div>

</div>
</div>

Expand All @@ -27,9 +22,7 @@ validations: {
}
{{/ui-annotation}}
</p>

{{config-options defaultMessage=messages.presenceMessage}}

{{#ui-example
header="Examples"
as |showing setCopyCode|}}
Expand Down Expand Up @@ -61,11 +54,12 @@ validations: {
{{/ui-html}}

{{#ui-annotation showing=showing type="javascript" setCopyCode=setCopyCode}}
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../mixins/model-validator';

export default DS.Model.extend(Validator,{
emailAddress: DS.attr('string'),
export default Model.extend(Validator, {
emailAddress: attr('string'),

validations: {
emailAddress: {
Expand All @@ -74,6 +68,5 @@ export default DS.Model.extend(Validator,{
}
});
{{/ui-annotation}}

{{/ui-example}}
</div>
</div>
25 changes: 9 additions & 16 deletions tests/dummy/app/templates/validators/exclusion.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<div class="ui masthead vertical segment">
<div class="ui container">
<div class="introduction">

<h1 class="ui header">
Exclusion

<div class="sub header">
Validates that the attributes' values are not included in a given array.
</div>
</h1>

<div class="ui hidden divider"></div>

</div>

</div>
</div>

Expand All @@ -25,16 +20,14 @@
</ul>

{{#ui-annotation showing=true type="javascript"}}
validations: {
playerName: {
exclusion: { in: ['Gionvany Hernandez', 'Wilder Medina'] }
}
validations: {
playerName: {
exclusion: { in: ['Gionvany Hernandez', 'Wilder Medina'] }
}
}
{{/ui-annotation}}
</p>

{{config-options defaultMessage=messages.exclusionMessage}}

{{#ui-example
header="Examples"
as |showing setCopyCode|}}
Expand Down Expand Up @@ -79,11 +72,12 @@
{{/ui-html}}

{{#ui-annotation showing=showing type="javascript" setCopyCode=setCopyCode}}
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../mixins/model-validator';

export default DS.Model.extend(Validator,{
playerName: DS.attr('string'),
export default Model.extend(Validator, {
playerName: attr('string'),

validations: {
playerName: {
Expand All @@ -92,6 +86,5 @@ export default DS.Model.extend(Validator,{
}
});
{{/ui-annotation}}

{{/ui-example}}
</div>
</div>
23 changes: 9 additions & 14 deletions tests/dummy/app/templates/validators/format.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<div class="ui masthead vertical segment">
<div class="ui container">
<div class="introduction">

<h1 class="ui header">
Format

<div class="sub header">
Validates the attributes' values by testing whether they match a given regular expression, which is specified using the <code class="ui label">with:</code> option.
</div>
</h1>

<div class="ui hidden divider"></div>

</div>

</div>
</div>

Expand All @@ -25,7 +20,7 @@

{{#ui-annotation showing=true type="javascript"}}
validations: {
secretLettersCode:{
secretLettersCode: {
format: { with: /^[a-zA-Z]+$/ }
}
}
Expand Down Expand Up @@ -67,23 +62,23 @@ validations: {
{{/ui-html}}

{{#ui-annotation showing=showing type="javascript" setCopyCode=setCopyCode}}
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../mixins/model-validator';

export default DS.Model.extend(Validator,{
secretLettersCode: DS.attr('string'),
secretNumericCode: DS.attr('string'),
export default Model.extend(Validator, {
secretLettersCode: attr('string'),
secretNumericCode: attr('string'),

validations: {
secretLettersCode: {
format: { with: /^[a-zA-Z]+$/, message: 'Only letters pls' }
},
secretNumericCode:{
secretNumericCode: {
format: { with: /^[0-9]+$/, message: 'Only numbers pls' }
},
}
}
});
{{/ui-annotation}}

{{/ui-example}}
</div>
</div>
19 changes: 6 additions & 13 deletions tests/dummy/app/templates/validators/hexcolor.hbs
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
<div class="ui masthead vertical segment">
<div class="ui container">
<div class="introduction">

<h1 class="ui header">
Hex Color

<div class="sub header">
Validates that the specified attributes are a correct Hexadecimal color.
</div>
</h1>

<div class="ui hidden divider"></div>

</div>

</div>
</div>

<div class="ui main container">
<p>
{{#ui-annotation showing=true type="javascript"}}
validations: {
favoriteColor:{
favoriteColor: {
color: true
}
}
{{/ui-annotation}}
</p>

{{config-options defaultMessage=messages.presenceMessage}}

{{#ui-example
header="Examples"
as |showing setCopyCode|}}
Expand Down Expand Up @@ -69,19 +62,19 @@ validations: {
{{/ui-html}}

{{#ui-annotation showing=showing type="javascript" setCopyCode=setCopyCode}}
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import Validator from '../mixins/model-validator';

export default DS.Model.extend(Validator,{
favoriteColor: DS.attr('string'),
export default Model.extend(Validator, {
favoriteColor: attr('string'),

validations: {
favoriteColor:{
favoriteColor: {
color: true
}
}
});
{{/ui-annotation}}

{{/ui-example}}
</div>
Loading

0 comments on commit a22420e

Please sign in to comment.