Skip to content

Commit 53ed0bf

Browse files
committed
[Frontend] Refactoring glyphs to classes
fixes #1047 In progress, really: view icons, timer/clock
1 parent 47dc7f2 commit 53ed0bf

File tree

7 files changed

+38
-30
lines changed

7 files changed

+38
-30
lines changed

platform/commonUI/general/res/templates/controls/switcher.html

+8-12
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,22 @@
2020
at runtime from the About dialog for additional information.
2121
-->
2222
<span ng-controller="ViewSwitcherController">
23-
<div
24-
class="view-switcher menu-element s-menu-btn"
23+
<div class="view-switcher menu-element s-menu-btn {{ngModel.selected.cssclass}}"
2524
ng-if="view.length > 1"
26-
ng-controller="ClickAwayController as toggle"
27-
>
25+
ng-controller="ClickAwayController as toggle">
2826

29-
<span
30-
class="l-click-area"
27+
<span class="l-click-area"
3128
ng-click="toggle.toggle()"
32-
title="{{ngModel.selected.name}}"
33-
></span>
34-
35-
<span class="ui-symbol icon type-icon">{{ngModel.selected.glyph}}</span>
29+
title="{{ngModel.selected.name}}"></span>
30+
<!--span class="ui-symbol icon type-icon">{{ngModel.selected.glyph}}</span-->
3631
<span class="title-label">{{ngModel.selected.name}}</span>
3732

3833
<div class="menu" ng-show="toggle.isActive()">
3934
<ul>
4035
<li ng-repeat="option in view"
41-
ng-click="ngModel.selected = option; toggle.setState(false)">
42-
<span class="ui-symbol type-icon icon">{{option.glyph}}</span>
36+
ng-click="ngModel.selected = option; toggle.setState(false)"
37+
class="{{option.cssclass}}">
38+
<!--span class="type-icon icon">{{option.glyph}}</span-->
4339
{{option.name}}
4440
</li>
4541
</ul>

platform/features/clock/bundle.js

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ define([
137137
"category": "contextual",
138138
"name": "Start",
139139
"glyph": "ï",
140+
"cssclass": "icon-play",
140141
"priority": "preferred"
141142
},
142143
{
@@ -148,6 +149,7 @@ define([
148149
"category": "contextual",
149150
"name": "Restart at 0",
150151
"glyph": "r",
152+
"cssclass": "icon-refresh",
151153
"priority": "preferred"
152154
}
153155
],

platform/features/clock/res/templates/timer.html

+6-13
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,13 @@
2121
-->
2222
<div class="l-time-display l-digital l-timer s-timer" ng-controller="TimerController as timer">
2323
<div class="l-elem-wrapper l-flex-row">
24-
<a
25-
ng-click="timer.clickButton()"
24+
<a ng-click="timer.clickButton()"
2625
title="{{timer.buttonText()}}"
27-
class="flex-elem s-icon-btn control"
28-
>
29-
{{timer.buttonGlyph()}}
30-
</a>
31-
<span class="flex-elem l-value">
32-
<span class="ui-symbol direction">{{timer.sign()}}</span>
33-
<span
34-
class="value"
35-
ng-class="{ active:timer.text() }"
36-
>{{timer.text() || "--:--:--"}}
37-
</span>
26+
class="flex-elem control {{timer.buttonCssClass()}}"></a>
27+
<span class="flex-elem l-value {{timer.signClass()}}">
28+
<span class="value"
29+
ng-class="{ active:timer.text() }">{{timer.text() || "--:--:--"}}
30+
</span>
3831
</span>
3932
<span ng-controller="RefreshingController"></span>
4033
</div>

platform/features/clock/src/controllers/TimerController.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ define(
5050
if (formatter && !isNaN(timeDelta)) {
5151
self.textValue = formatter(timeDelta);
5252
self.signValue = timeDelta < 0 ? "-" :
53-
timeDelta >= 1000 ? "+" : "";
53+
timeDelta >= 1000 ? "+" : "";
54+
self.signCssClass = timeDelta < 0 ? "icon-minus" :
55+
timeDelta >= 1000 ? "icon-plus" : "";
5456
} else {
5557
self.textValue = "";
5658
self.signValue = "";
59+
self.signCssClass = "";
5760
}
5861
}
5962

@@ -126,12 +129,13 @@ define(
126129
}
127130

128131
/**
129-
* Get the glyph to display for the start/restart button.
130-
* @returns {string} glyph to display
132+
* Get the CSS class to display the right icon
133+
* for the start/restart button.
134+
* @returns {string} cssclass to display
131135
*/
132-
TimerController.prototype.buttonGlyph = function () {
136+
TimerController.prototype.buttonCssClass = function () {
133137
return this.relevantAction ?
134-
this.relevantAction.getMetadata().glyph : "";
138+
this.relevantAction.getMetadata().cssclass : "";
135139
};
136140

137141
/**
@@ -164,6 +168,15 @@ define(
164168
return this.signValue;
165169
};
166170

171+
/**
172+
* Get the sign (+ or -) of the current timer value, as
173+
* a CSS class.
174+
* @returns {string} sign of the current timer value
175+
*/
176+
TimerController.prototype.signClass = function () {
177+
return this.signCssClass;
178+
};
179+
167180
/**
168181
* Get the text to display for the current timer value.
169182
* @returns {string} current timer value

platform/features/layout/bundle.js

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ define([
6767
"key": "fixed",
6868
"name": "Fixed Position",
6969
"glyph": "3",
70+
"cssclass": "icon-telemetry-panel",
7071
"type": "telemetry.panel",
7172
"template": fixedTemplate,
7273
"uses": [

platform/features/plot/bundle.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ define([
4646
"name": "Plot",
4747
"key": "plot",
4848
"glyph": "6",
49+
"cssclass": "icon-sine",
4950
"template": plotTemplate,
5051
"needs": [
5152
"telemetry"

platform/features/table/bundle.js

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ define([
130130
"name": "Historical Table",
131131
"key": "table",
132132
"glyph": "\ue604",
133+
"cssclass": "icon-tabular",
133134
"templateUrl": "templates/historical-table.html",
134135
"needs": [
135136
"telemetry"
@@ -141,6 +142,7 @@ define([
141142
"name": "Real-time Table",
142143
"key": "rt-table",
143144
"glyph": "\ue620",
145+
"cssclass": "icon-tabular-realtime",
144146
"templateUrl": "templates/rt-table.html",
145147
"needs": [
146148
"telemetry"

0 commit comments

Comments
 (0)