[Frontend] Refactoring glyphs to classes

fixes #1047
In progress, really: view icons, timer/clock
This commit is contained in:
Charles Hacskaylo
2016-06-27 17:01:45 -07:00
parent 47dc7f2f6b
commit 53ed0bfb22
7 changed files with 38 additions and 30 deletions

View File

@ -20,26 +20,22 @@
at runtime from the About dialog for additional information. at runtime from the About dialog for additional information.
--> -->
<span ng-controller="ViewSwitcherController"> <span ng-controller="ViewSwitcherController">
<div <div class="view-switcher menu-element s-menu-btn {{ngModel.selected.cssclass}}"
class="view-switcher menu-element s-menu-btn"
ng-if="view.length > 1" ng-if="view.length > 1"
ng-controller="ClickAwayController as toggle" ng-controller="ClickAwayController as toggle">
>
<span <span class="l-click-area"
class="l-click-area"
ng-click="toggle.toggle()" ng-click="toggle.toggle()"
title="{{ngModel.selected.name}}" title="{{ngModel.selected.name}}"></span>
></span> <!--span class="ui-symbol icon type-icon">{{ngModel.selected.glyph}}</span-->
<span class="ui-symbol icon type-icon">{{ngModel.selected.glyph}}</span>
<span class="title-label">{{ngModel.selected.name}}</span> <span class="title-label">{{ngModel.selected.name}}</span>
<div class="menu" ng-show="toggle.isActive()"> <div class="menu" ng-show="toggle.isActive()">
<ul> <ul>
<li ng-repeat="option in view" <li ng-repeat="option in view"
ng-click="ngModel.selected = option; toggle.setState(false)"> ng-click="ngModel.selected = option; toggle.setState(false)"
<span class="ui-symbol type-icon icon">{{option.glyph}}</span> class="{{option.cssclass}}">
<!--span class="type-icon icon">{{option.glyph}}</span-->
{{option.name}} {{option.name}}
</li> </li>
</ul> </ul>

View File

@ -137,6 +137,7 @@ define([
"category": "contextual", "category": "contextual",
"name": "Start", "name": "Start",
"glyph": "ï", "glyph": "ï",
"cssclass": "icon-play",
"priority": "preferred" "priority": "preferred"
}, },
{ {
@ -148,6 +149,7 @@ define([
"category": "contextual", "category": "contextual",
"name": "Restart at 0", "name": "Restart at 0",
"glyph": "r", "glyph": "r",
"cssclass": "icon-refresh",
"priority": "preferred" "priority": "preferred"
} }
], ],

View File

@ -21,20 +21,13 @@
--> -->
<div class="l-time-display l-digital l-timer s-timer" ng-controller="TimerController as timer"> <div class="l-time-display l-digital l-timer s-timer" ng-controller="TimerController as timer">
<div class="l-elem-wrapper l-flex-row"> <div class="l-elem-wrapper l-flex-row">
<a <a ng-click="timer.clickButton()"
ng-click="timer.clickButton()"
title="{{timer.buttonText()}}" title="{{timer.buttonText()}}"
class="flex-elem s-icon-btn control" class="flex-elem control {{timer.buttonCssClass()}}"></a>
> <span class="flex-elem l-value {{timer.signClass()}}">
{{timer.buttonGlyph()}} <span class="value"
</a> ng-class="{ active:timer.text() }">{{timer.text() || "--:--:--"}}
<span class="flex-elem l-value"> </span>
<span class="ui-symbol direction">{{timer.sign()}}</span>
<span
class="value"
ng-class="{ active:timer.text() }"
>{{timer.text() || "--:--:--"}}
</span>
</span> </span>
<span ng-controller="RefreshingController"></span> <span ng-controller="RefreshingController"></span>
</div> </div>

View File

@ -50,10 +50,13 @@ define(
if (formatter && !isNaN(timeDelta)) { if (formatter && !isNaN(timeDelta)) {
self.textValue = formatter(timeDelta); self.textValue = formatter(timeDelta);
self.signValue = timeDelta < 0 ? "-" : self.signValue = timeDelta < 0 ? "-" :
timeDelta >= 1000 ? "+" : ""; timeDelta >= 1000 ? "+" : "";
self.signCssClass = timeDelta < 0 ? "icon-minus" :
timeDelta >= 1000 ? "icon-plus" : "";
} else { } else {
self.textValue = ""; self.textValue = "";
self.signValue = ""; self.signValue = "";
self.signCssClass = "";
} }
} }
@ -126,12 +129,13 @@ define(
} }
/** /**
* Get the glyph to display for the start/restart button. * Get the CSS class to display the right icon
* @returns {string} glyph to display * for the start/restart button.
* @returns {string} cssclass to display
*/ */
TimerController.prototype.buttonGlyph = function () { TimerController.prototype.buttonCssClass = function () {
return this.relevantAction ? return this.relevantAction ?
this.relevantAction.getMetadata().glyph : ""; this.relevantAction.getMetadata().cssclass : "";
}; };
/** /**
@ -164,6 +168,15 @@ define(
return this.signValue; return this.signValue;
}; };
/**
* Get the sign (+ or -) of the current timer value, as
* a CSS class.
* @returns {string} sign of the current timer value
*/
TimerController.prototype.signClass = function () {
return this.signCssClass;
};
/** /**
* Get the text to display for the current timer value. * Get the text to display for the current timer value.
* @returns {string} current timer value * @returns {string} current timer value

View File

@ -67,6 +67,7 @@ define([
"key": "fixed", "key": "fixed",
"name": "Fixed Position", "name": "Fixed Position",
"glyph": "3", "glyph": "3",
"cssclass": "icon-telemetry-panel",
"type": "telemetry.panel", "type": "telemetry.panel",
"template": fixedTemplate, "template": fixedTemplate,
"uses": [ "uses": [

View File

@ -46,6 +46,7 @@ define([
"name": "Plot", "name": "Plot",
"key": "plot", "key": "plot",
"glyph": "6", "glyph": "6",
"cssclass": "icon-sine",
"template": plotTemplate, "template": plotTemplate,
"needs": [ "needs": [
"telemetry" "telemetry"

View File

@ -130,6 +130,7 @@ define([
"name": "Historical Table", "name": "Historical Table",
"key": "table", "key": "table",
"glyph": "\ue604", "glyph": "\ue604",
"cssclass": "icon-tabular",
"templateUrl": "templates/historical-table.html", "templateUrl": "templates/historical-table.html",
"needs": [ "needs": [
"telemetry" "telemetry"
@ -141,6 +142,7 @@ define([
"name": "Real-time Table", "name": "Real-time Table",
"key": "rt-table", "key": "rt-table",
"glyph": "\ue620", "glyph": "\ue620",
"cssclass": "icon-tabular-realtime",
"templateUrl": "templates/rt-table.html", "templateUrl": "templates/rt-table.html",
"needs": [ "needs": [
"telemetry" "telemetry"