Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Removes slider from number item on control page #3437

Merged
merged 3 commits into from
May 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ angular.module('PaperUI.controllers.control', []).controller('ControlPageControl
if (!item.stateDescription || isNaN(item.stateDescription.minimum)) {
return '';
} else if (!item.stateDescription.pattern) {
return item.stateDescription.minimum;
return ''+item.stateDescription.minimum;
} else {
return sprintf(item.stateDescription.pattern, item.stateDescription.minimum);
}
Expand All @@ -254,7 +254,7 @@ angular.module('PaperUI.controllers.control', []).controller('ControlPageControl
if (!item.stateDescription || isNaN(item.stateDescription.maximum)) {
return '';
} else if (!item.stateDescription.pattern) {
return item.stateDescription.maximum;
return ''+item.stateDescription.maximum;
} else {
return sprintf(item.stateDescription.pattern, item.stateDescription.maximum);
}
Expand Down Expand Up @@ -558,22 +558,6 @@ angular.module('PaperUI.controllers.control', []).controller('ControlPageControl

var hexColor = $scope.getHexColor();
$($element).find('.hue .md-thumb').css('background-color', hexColor);
}).controller('NumberItemController', function($scope) {
$scope.shouldRenderSlider = function(item) {
if (item.stateDescription) {
var stateDescription = item.stateDescription;
if (stateDescription.readOnly) {
return false;
} else {
if (isNaN(stateDescription.minimum) || isNaN(stateDescription.maximum)) {
return false;
} else {
return true;
}
}
}
return false;
}
}).controller('RollershutterItemController', function($scope) {
if ($scope.item.state === 'UNDEF' || $scope.item.state === 'NULL') {
$scope.item.state = '-';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section id="main" class="control header-tabs">
<section id="main" class="control header-tabs" ng-form name="controlForm">
<div class="header-toolbar">
<md-button ng-click="refresh()" aria-label="Refresh"> <i class="material-icons">refresh</i></md-button>
</div>
Expand Down Expand Up @@ -103,7 +103,7 @@ <h2>{{item.state}}</h2>
</div>
<div layout="row" item-state-dropdown layout-align="end center" ng-if="isOptionList(item) && !isReadOnly(item)"></div>
</div>
<div ng-switch-when="Number" class="numberWidget" ng-controller="NumberItemController">
<div ng-switch-when="Number" class="numberWidget">
<div layout="row" layout-align="start center">
<div flex="40" layout="row" layout-align="start center">
<p>
Expand All @@ -114,18 +114,13 @@ <h2>{{item.state}}</h2>
<div ng-show="isReadOnly(item)">
<h2 class="state" ng-if="isReadOnly(item)">{{getStateText(item)}}</h2>
</div>
<div layout="row" layout-align="end center" ng-if="!isReadOnly(item) && !isOptionList(item) && !shouldRenderSlider(item)">
<div layout="row" layout-align="end center" ng-if="!isReadOnly(item) && !isOptionList(item)">
<h2 class="state edit" ng-if="!editMode" ng-click="editState()">{{getStateText(item)}}</h2>
<md-input-container ng-show="editMode"> <input ng-model="item.state" aria-label={{item.label}} type="number"></input> </md-input-container>
<i class="md-button control-button material-icons" ng-show="editMode" ng-click="updateState()">check</i>
<md-input-container ng-show="editMode"> <input name="{{item.name}}" ng-model="item.state" aria-label={{item.label}} type="number" ng-min="item.stateDescription.minimum" ng-max="item.stateDescription.maximum"></input> </md-input-container>
<i class="md-button control-button material-icons" ng-disabled="controlForm[item.name].$invalid" ng-show="editMode" ng-click="controlForm[item.name].$invalid || updateState()">check</i>
</div>
</div>
</div>
<div ng-if="!isOptionList(item) && !isReadOnly(item) && shouldRenderSlider(item)" layout="row" layout-align="start center" class="number-control-widget">
<span flex="15" class="text-left" ng-if="getMinText(item)">{{getMinText(item)}}</span>
<md-slider flex="70" class="md-default-theme" min="{{item.stateDescription.minimum}}" max="{{item.stateDescription.maximum}}" step="{{item.stateDescription.step!==undefined && item.stateDescription.step!==null?item.stateDescription.step:1}}" ng-model="item.state" md-discrete="true" ng-show="getMinText(item) && getMaxText(item)" ng-change="sendCommand(item.state)" aria-label={{item.label}}></md-slider>
<span flex="15" class="text-right" ng-if="getMaxText(item)">{{getMaxText(item)}}</span>
</div>
<div layout="row" item-state-dropdown layout-align="start center" ng-if="isOptionList(item) && !isReadOnly(item)"></div>
</div>
<div ng-switch-when="Rollershutter" ng-controller="RollershutterItemController">
Expand All @@ -141,8 +136,8 @@ <h2 class="state" ng-if="isReadOnly(item)">{{getStateText(item)}}</h2>
</div>
<div layout="row" layout-align="end center" ng-if="!isReadOnly(item) && !isOptionList(item)">
<h2 class="state edit" ng-if="!editMode" ng-click="editState()">{{getStateText(item)}}</h2>
<md-input-container ng-show="editMode"> <input ng-model="item.state" aria-label={{item.label}} type="number" min="0" max="100"></input> </md-input-container>
<i class="md-button control-button material-icons" ng-show="editMode" ng-click="updateState()">check</i>
<md-input-container ng-show="editMode"> <input name="{{item.name}}" ng-model="item.state" aria-label={{item.label}} type="number" min="0" max="100"></input> </md-input-container>
<i class="md-button control-button material-icons" ng-disabled="controlForm[item.name].$invalid" ng-show="editMode" ng-click="controlForm[item.name].$invalid || updateState()">check</i>
</div>
</div>
</div>
Expand Down