-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
405 lines (367 loc) · 19.7 KB
/
demo.html
File metadata and controls
405 lines (367 loc) · 19.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<!--
Demo page for implementation of shared and UX spec'd Reusable Components
https://confluence.tm.tmcs/confluence/display/UE/TM360+SDK+-+Reusable+UI+Components
-->
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
<title>tm360 Shared UI Demo</title>
<!-- 3rd party Shared CSS Libs (not in git repo) -->
<link rel="stylesheet" href="https://portal.shared.dev2.websys.tmcs/shared/css/lib/normalize-1.1.0.css" />
<link rel="stylesheet" href="https://portal.shared.dev2.websys.tmcs/shared/css/lib/bootstrap-2.1.0/css/bootstrap.min.css" />
<!-- tm360 Shared-UI CSS -->
<link rel="stylesheet" href="css/tm360-base.css" />
<link rel="stylesheet" href="css/tm360-universal.css" />
<!-- tm360 Shared-UI LESS (Add *.less files to "less/" folder, then include them here) -->
<link rel="stylesheet/less" type="text/css" href="less/tm360-sample.less" />
<!-- a few styles for this demo page only -->
<style>
.tm360 .well {
background-color: #FFFFFF;
}
</style>
<!--
Client-side LESS compiler for development.
- Append #!watch to URL to enable *.less file watch mode.
-->
<script type="text/javascript">
less = {
env: "development"
};
</script>
<script src="lib/less-1.3.3/less-1.3.3.min.js"></script>
<!-- Note: LESS files will be compiled to CSS via command line before checking into tm360 versioned "shared" folder for deployment. -->
<script>
// mock gadgets.Prefs for modalDialog
var Prefs = function(){};
Prefs.prototype.getMsg = function() {};
gadgets = {Prefs : Prefs};
</script>
</head>
<body class="tm360">
<div id="container">
<div class="container-fluid" style="background-color: #EBEBEE;">
<div class="row-fluid">
<div class="span12">
<h1>Shared UI Demos</h1>
<p style="padding-left: 1em" id="pIntro">This is the demo page for tm360 Shared-UI components. </p>
<p style="padding-left: 1em">Javascript unit tests are available for <a href="specRunner.html" target="_blank">utility methods</a> and <a href="specRunner-requirejs.html" target="_blank">Widgets (uses RequireJS)</a>.</p>
<p style="padding-left: 1em">Note: This page references assets on Dev2. If layout isn't being rendered properly, <a href="https://portal.shared.dev2.websys.tmcs/" target="_blank">click here</a> to "unlock", then return to this page and refresh.</p>
<p> </p>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<h5>Snap Width</h5>
</div>
<div class="span9">
<div class="well">
<p>The app/gadget you are viewing now has 2-width snapping enabled. Resize your browser window width around the 1244px threshold to see gadget maintain alignment with tm360 nav logo and icons. See <a href='https://confluence.tm.tmcs/confluence/display/PJ31/Shared+UI+components+for+new+app+development#SharedUIcomponentsfornewappdevelopment-Width"Snapping"' target="_blank">Width "Snapping"</a> for implementation details.</p>
</div>
</div>
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<h5>Primary Text Styles</h5>
</div>
<div class="span9">
<div class="well">
<p>This sampling of text styles represents a safe standard for tm360 apps. However variations will arise on a design-by-design basis. But colors, link styles, and text shadows will all follow this standard.</p>
<br/>
<strong>Dark Text on White Background:</strong>
<div style="padding: 10px 24px;">
<h1>30px Museo Sans 500 <h1></h1>
<h2>24px Museo Sans 500 <h2> <a href="javascript:;">with link style</a></h2>
<p>14px Arial Regular <p> <a href="javascript:;">with link style</a></p>
</div>
<br/>
<strong>Dark Text on Gray Background:</strong>
<div style="background-color: #d3d3d7; padding: 10px 24px;">
<h1>30px Museo Sans 500 <h1></h1>
<h2>24px Museo Sans 500 <h2> <a href="javascript:;">with link style</a></h2>
<p>14px Arial Regular <p> <a href="javascript:;">with link style</a></p>
</div>
<br/>
<strong>White Text on Dark Background:</strong>
<div class="textOnDark" style="background-color: #4f5258; padding: 10px 24px;">
<h1>30px Museo Sans 500 <h1></h1>
<h2>24px Museo Sans 500 <h2> <a href="javascript:;">with link style</a></h2>
<p>14px Arial Regular <p> <a href="javascript:;">with link style</a></p>
</div>
</div>
</div>
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<h5>Search and Filter</h5>
</div>
<div class="span9">
<div class="well">
<p>Initially, there is an input hint in the field. This hint disappears when user clicks into the field.</p>
<p>As user begins typing in the field, the “X” icon appears, which when clicked, clears out the search.</p>
<strong>White Background:</strong>
<div style="padding: 10px 24px;">
<form class="form-search" style="margin-top: 20px">
<div style="position: relative;">
<input type="text" class="input-medium search-query" placeholder="Search 1" />
<i class="search-clear-icon"></i>
</div>
</form>
</div>
<br/>
<strong>Darker Background:</strong>
<div class="search-filter-bg" style="padding: 10px 24px;">
<form class="form-search" style="margin-top: 20px">
<div class="darker" style="position: relative;">
<input type="text" class="input-medium search-query" placeholder="Search 2" />
<i class="search-clear-icon"></i>
</div>
</form>
</div>
</div>
</div>
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<h5>Text Input Fields</h5>
</div>
<div class="span9">
<form>
<div class="well">
<div class="control-group">
<label class="control-label" for="input1">Input Label</label>
<div class="controls">
<input type="text" id="input1" />
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="text" value="Disabled" disabled />
</div>
</div>
<div class="control-group">
<label class="control-label" for="textarea1">Textarea Label</label>
<div class="controls">
<textarea id="textarea1" rows="3"></textarea>
</div>
</div>
<div class="control-group error">
<label class="control-label" for="input2">Input Error</label>
<div class="controls">
<input type="text" id="input2" value="invalid text" />
<i class="help-error-icon"></i>
<span class="help-error">Error help text</span>
</div>
</div>
</div>
</form>
</div>
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<h5>Buttons</h5>
</div>
<div class="span9">
<form>
<div class="well">
<div class="control-group">
<div class="controls">
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-primary disabled" disabled>Disabled</button>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="button" class="btn">Secondary</button>
<button type="button" class="btn disabled" disabled>Disabled</button>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="button" class="btn btn-success">Important</button>
<button type="button" class="btn btn-success disabled" disabled>Disabled</button>
</div>
</div>
<div>
<a href="demo/index.html?url=demo%2Fbuttons-examples%2Fall" target="_blank">See more buttons</a>
</div>
</div>
</form>
</div>
</div> <!-- .row-fluid -->
<!--
<div class="row-fluid">
<div class="span3">
<h5>3. Loading Spinners</h5>
</div>
<div class="span3">
<div class="well">
24x24: <img src="css/img/spinner-24x24.gif" />
</div>
</div>
<div class="span3">
<div class="well">
16x16: <img src="css/img/loader_16px_on_fff.gif" />
</div>
</div>
</div>--> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<h5>Modal Dialog</h5>
</div>
<div class="span9">
<div class="well">
<div class="control-group">
<div id="button-list"></div>
<button type="button" id="button-list-button" class="btn btn-primary">Click me</button>
</div>
<div>
<a href="demo/index.html?url=demo%2FmodalDialog-examples%2Fall" target="_blank">See more modal dialogs</a>
</div>
</div>
</div>
</div> <!-- .row-fluid -->
<!--
<div class="row-fluid">
<div class="span3">
<h5>ShortLink Component</h5>
</div>
<div class="span9">
<div class="well">
<p>Click to generate a sample (non-working) shortlink:
<button class="shortlink-btn btn">
<img src="css/img/link-icon.png"/></button>
</p>
<p>And another, where the popover appears to the right:
<button class="shortlink-btn btn" data-placement="right">
<img src="css/img/link-icon.png"/></button>
</p>
<p>See the <a href="https://confluence.tm.tmcs/confluence/display/PJ31/URL+Shortening+in+tm360" target="_blank">URL Shortening in tm360</a> Confluence page for more info.</p>
</div>
</div>
</div> --> <!-- .row-fluid -->
</div>
</div>
<!-- 3rd party Shared JS Libs (not in git repo) -->
<script src="https://portal.shared.dev2.websys.tmcs/shared/js/lib/jquery-1.7.2.min.js"></script>
<script src="https://portal.shared.dev2.websys.tmcs/shared/js/lib/jquery.ba-throttle-debounce-1.1.min.js"></script>
<script src="https://portal.shared.dev2.websys.tmcs/shared/js/lib/underscore_1.3.3.min.js"></script>
<script src="https://portal.shared.dev2.websys.tmcs/shared/js/lib/bootstrap-2.1.0.min.js"></script>
<!-- tm360 Shared-UI JS -->
<script src="js/tm/core.js"></script>
<script src="js/tm/widgets/widgetFactory.js"></script>
<script src="js/tm/widgets/modalDialog.js"></script>
<script>
(function(){
function adjustDisplayArea(){
// check/apply 'small-screen' class to body for 2-width container
tm.widthCheck();
// check on resize too, throttling calls to once every 200ms
var resizeHandler = $.throttle(200, function(){
tm.widthCheck();
});
$(window).resize( resizeHandler );
}
function activateSearchFields(){
var fields = $("input.search-query[placeholder]");
fields.focus(function(){
var input = $(this);
if (input.val() === input.attr("placeholder")) {
input.val("");
input.removeClass("placeholder");
}
})
.blur(function(){
var input = $(this);
if (input.val() === "" || input.val() === input.attr("placeholder")) {
input.addClass("placeholder");
input.val(input.attr("placeholder"));
}
});
// initialize
fields.blur();
// prevent submitting placeholder as value
fields.parents("form").submit(function() {
$(this).find("[placeholder]").each(function() {
var input = $(this);
if (input.val() === input.attr("placeholder")) {
input.val("");
}
})
});
var showHideIcon = function(){
if (this.data("iconActive")) {
if (this.val() === "" || this.val() === this.attr("placeholder")){
// hide icon
this.siblings(".search-clear-icon").css({
display: "none"
});
this.data("iconActive", false);
}
} else {
if (this.val() !== "" && this.val() !== this.attr("placeholder")){
// position and show icon
this.siblings(".search-clear-icon").css({
display: "block",
left: this.outerWidth() - 21
});
this.data("iconActive", true);
}
}
};
// init clear icon click handler
fields.siblings(".search-clear-icon").click(function(){
var input = $(this).siblings(".search-query");
input.addClass("placeholder");
input.val(input.attr("placeholder"));
showHideIcon.apply(input);
});
// check to show/hide clear icon now and on keyup
fields.each(function(){
showHideIcon.apply($(this));
}).keyup(function(){
showHideIcon.apply($(this));
});
}
function activateModalDialog(){
var yesButton = {
text: 'Yes',
type: 'primary',
callback: function(e, dialog) {
dialog.tmModalDialog('hide');
}
};
var noButton = {
text: 'No',
callback: function(e, dialog) {
dialog.tmModalDialog('hide');
}
};
var dialog = $('#button-list').tmModalDialog({
title: 'button-list',
content: 'Are you sure?',
buttons: [noButton, yesButton]
});
$('#button-list-button').click(function() {
dialog.tmModalDialog('show');
});
}
function init(){
adjustDisplayArea();
activateSearchFields();
activateModalDialog();
// disable iOS overscroll
if (tm.iOS){
$(document).on('touchmove', function(e) {
e.preventDefault();
});
}
}
// jquery onload
$(init);
})();
</script>
</body>
</html>