Skip to content

Commit

Permalink
When min/max/step are specified on action inputs it is added to the i…
Browse files Browse the repository at this point in the history
…nput element
  • Loading branch information
AdamMagaluk committed Oct 14, 2014
1 parent 4b66d47 commit 3595c18
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 46 deletions.
25 changes: 13 additions & 12 deletions dist/partials/device-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
<fieldset>
<legend># {{ action.name }}</legend>
<label ng-repeat-start="field in action.fields" for="{{ action.name + field.name }}" class="{{ field.type }}"></label>

<ng-switch on="field.type">
<div ng-switch-when="radio" ng-if="!action.renderOptionsAsButtons">
<!-- regular radios -->
<label class="pure-radio" ng-repeat="val in action.radioField.value" for="{{ action.name + field.name }}_{{ $index }}" >
<input id="{{ action.name + field.name }}_{{ $index }}" type="radio" name="{{ action.name + field.name }}" value="{{ val.value }}"/>
{{ val.value }}
</label>
</label>

</div>

<div ng-switch-when="radio" ng-if="action.renderOptionsAsButtons">
<button ng-repeat="val in action.radioField.value" class="pure-button {{ action.name + '-button' }}" ng-click="val.execute()">{{ val.title || val.value}}</button>
</div>

<textarea ng-switch-when="textarea" name="{{ field.name }}" value="{{ field.value }}"

<textarea ng-switch-when="textarea" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value" class="pure-u-1"></textarea>

<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value" ng-switch-default/>

<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" step="{{field.step}}" min="{{field.min}}" max="{{field.max}}" ng-model="field.value" ng-switch-default/>

</ng-switch>
<span ng-repeat-end></span>

<button class="pure-button {{ action.name + '-button' }}" ng-disabled="!action.available" ng-click="execute()" ng-if="!action.renderOptionsAsButtons">{{ action.name }}</button>
</fieldset>

</form>

<!--
<div class="field pure-u-1 pure-u-lg-3-4" ng-repeat="field in action.fields">
<div class="field" >
<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value"/>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions dist/partials/overview-action.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<div class="value pure-u-1 pure-u-md-1-4">
<form ng-repeat="val in action.radioField.value" class="pure-form overview-action-form">
<button class="pure-button {{ action.name + '-button' }}" ng-click="val.execute()">{{ val.title || val.value}}</button>
</form>
</form>
</div>

</div>

<form class="pure-form action-content" ng-if="!action.renderOptionsAsButtons">
<div class="vis pure-u-1 pure-u-md-5-8" ng-if="!action.renderOptionsAsButtons">
<div class="vis pure-u-1 pure-u-md-5-8">
<div class="fields">
<input ng-repeat="field in action.fields" placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
<input ng-repeat="field in action.fields" placeholder="{{ field.name }}" step="{{field.step}}" min="{{field.min}}" max="{{field.max}}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value"/>
</div>
</div>
Expand Down
28 changes: 14 additions & 14 deletions dist/scripts/zetta.js

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions src/partials/device-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
<fieldset>
<legend># {{ action.name }}</legend>
<label ng-repeat-start="field in action.fields" for="{{ action.name + field.name }}" class="{{ field.type }}"></label>

<ng-switch on="field.type">
<div ng-switch-when="radio" ng-if="!action.renderOptionsAsButtons">
<!-- regular radios -->
<label class="pure-radio" ng-repeat="val in action.radioField.value" for="{{ action.name + field.name }}_{{ $index }}" >
<input id="{{ action.name + field.name }}_{{ $index }}" type="radio" name="{{ action.name + field.name }}" value="{{ val.value }}"/>
{{ val.value }}
</label>
</label>

</div>

<div ng-switch-when="radio" ng-if="action.renderOptionsAsButtons">
<button ng-repeat="val in action.radioField.value" class="pure-button {{ action.name + '-button' }}" ng-click="val.execute()">{{ val.title || val.value}}</button>
</div>

<textarea ng-switch-when="textarea" name="{{ field.name }}" value="{{ field.value }}"

<textarea ng-switch-when="textarea" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value" class="pure-u-1"></textarea>

<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value" ng-switch-default/>

<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" step="{{field.step}}" min="{{field.min}}" max="{{field.max}}" ng-model="field.value" ng-switch-default/>

</ng-switch>
<span ng-repeat-end></span>

<button class="pure-button {{ action.name + '-button' }}" ng-disabled="!action.available" ng-click="execute()" ng-if="!action.renderOptionsAsButtons">{{ action.name }}</button>
</fieldset>

</form>

<!--
<div class="field pure-u-1 pure-u-lg-3-4" ng-repeat="field in action.fields">
<div class="field" >
<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
<input placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value"/>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/partials/overview-action.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<div class="value pure-u-1 pure-u-md-1-4">
<form ng-repeat="val in action.radioField.value" class="pure-form overview-action-form">
<button class="pure-button {{ action.name + '-button' }}" ng-click="val.execute()">{{ val.title || val.value}}</button>
</form>
</form>
</div>

</div>

<form class="pure-form action-content" ng-if="!action.renderOptionsAsButtons">
<div class="vis pure-u-1 pure-u-md-5-8" ng-if="!action.renderOptionsAsButtons">
<div class="vis pure-u-1 pure-u-md-5-8">
<div class="fields">
<input ng-repeat="field in action.fields" placeholder="{{ field.name }}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
<input ng-repeat="field in action.fields" placeholder="{{ field.name }}" step="{{field.step}}" min="{{field.min}}" max="{{field.max}}" type="{{ field.type }}" class="pure-u-1" name="{{ field.name }}" value="{{ field.value }}"
id="{{ action.name + field.name }}" ng-model="field.value"/>
</div>
</div>
Expand Down

0 comments on commit 3595c18

Please sign in to comment.