hushed 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/hushed.gemspec +1 -0
  2. data/lib/hushed/client.rb +8 -0
  3. data/lib/hushed/version.rb +1 -1
  4. data/lib/hushed/web.rb +49 -0
  5. data/web/assets/bootstrap/css/bootstrap-docs.css +1067 -0
  6. data/web/assets/bootstrap/css/bootstrap-responsive.css +1109 -0
  7. data/web/assets/bootstrap/css/bootstrap.css +6167 -0
  8. data/web/assets/bootstrap/css/prettify.css +30 -0
  9. data/web/assets/bootstrap/img/glyphicons-halflings-white.png +0 -0
  10. data/web/assets/bootstrap/img/glyphicons-halflings.png +0 -0
  11. data/web/assets/bootstrap/js/application.js +156 -0
  12. data/web/assets/bootstrap/js/google-code-prettify/prettify.js +28 -0
  13. data/web/assets/bootstrap/js/holder.js +401 -0
  14. data/web/assets/images/demo/browser-2x.png +0 -0
  15. data/web/assets/images/demo/browser-author.jpg +0 -0
  16. data/web/assets/images/demo/browser-pic-1.jpg +0 -0
  17. data/web/assets/images/demo/browser-pic-2.jpg +0 -0
  18. data/web/assets/images/demo/browser-pic-3.jpg +0 -0
  19. data/web/assets/images/demo/browser-pic-4.jpg +0 -0
  20. data/web/assets/images/demo/browser-pic-5.jpg +0 -0
  21. data/web/assets/images/demo/browser-pic-6.jpg +0 -0
  22. data/web/assets/images/demo/browser.png +0 -0
  23. data/web/assets/images/demo/html-icon.png +0 -0
  24. data/web/assets/images/demo/logo-mask-2x.png +0 -0
  25. data/web/assets/images/demo/logo-mask.png +0 -0
  26. data/web/assets/images/demo/video.jpg +0 -0
  27. data/web/assets/images/favicon.ico +0 -0
  28. data/web/assets/images/footer/logo.png +0 -0
  29. data/web/assets/images/icons/Book@2x.png +0 -0
  30. data/web/assets/images/icons/Calendar@2x.png +0 -0
  31. data/web/assets/images/icons/Chat@2x.png +0 -0
  32. data/web/assets/images/icons/Clipboard@2x.png +0 -0
  33. data/web/assets/images/icons/Compas@2x.png +0 -0
  34. data/web/assets/images/icons/Gift-Box@2x.png +0 -0
  35. data/web/assets/images/icons/Infinity-Loop@2x.png +0 -0
  36. data/web/assets/images/icons/Mail@2x.png +0 -0
  37. data/web/assets/images/icons/Map@2x.png +0 -0
  38. data/web/assets/images/icons/Pensils@2x.png +0 -0
  39. data/web/assets/images/icons/Pocket@2x.png +0 -0
  40. data/web/assets/images/icons/Retina-Ready@2x.png +0 -0
  41. data/web/assets/images/icons/Toilet-Paper@2x.png +0 -0
  42. data/web/assets/images/icons/Watches@2x.png +0 -0
  43. data/web/assets/images/login/icon.png +0 -0
  44. data/web/assets/images/login/imac-2x.png +0 -0
  45. data/web/assets/images/login/imac.png +0 -0
  46. data/web/assets/images/switch/mask-square.png +0 -0
  47. data/web/assets/images/switch/mask.png +0 -0
  48. data/web/assets/images/tile/ribbon-2x.png +0 -0
  49. data/web/assets/images/tile/ribbon.png +0 -0
  50. data/web/assets/images/todo/done-2x.png +0 -0
  51. data/web/assets/images/todo/done.png +0 -0
  52. data/web/assets/images/todo/search-2x.png +0 -0
  53. data/web/assets/images/todo/search.png +0 -0
  54. data/web/assets/images/todo/todo-2x.png +0 -0
  55. data/web/assets/images/todo/todo.png +0 -0
  56. data/web/assets/images/video/fullscreen-2x.png +0 -0
  57. data/web/assets/images/video/fullscreen.png +0 -0
  58. data/web/assets/images/video/pause-2x.png +0 -0
  59. data/web/assets/images/video/pause.png +0 -0
  60. data/web/assets/images/video/play-2x.png +0 -0
  61. data/web/assets/images/video/play.png +0 -0
  62. data/web/assets/images/video/poster.jpg +0 -0
  63. data/web/assets/images/video/volume-full-2x.png +0 -0
  64. data/web/assets/images/video/volume-full.png +0 -0
  65. data/web/assets/images/video/volume-off-2x.png +0 -0
  66. data/web/assets/images/video/volume-off.png +0 -0
  67. data/web/assets/javascripts/application.js +68 -0
  68. data/web/assets/javascripts/bootstrap-select.js +412 -0
  69. data/web/assets/javascripts/bootstrap-switch.js +251 -0
  70. data/web/assets/javascripts/bootstrap.min.js +7 -0
  71. data/web/assets/javascripts/flatui-checkbox.js +112 -0
  72. data/web/assets/javascripts/flatui-radio.js +141 -0
  73. data/web/assets/javascripts/html5shiv.js +8 -0
  74. data/web/assets/javascripts/icon-font-ie7.js +57 -0
  75. data/web/assets/javascripts/jquery-1.8.3.min.js +2 -0
  76. data/web/assets/javascripts/jquery-ui-1.10.3.custom.min.js +6 -0
  77. data/web/assets/javascripts/jquery.placeholder.js +157 -0
  78. data/web/assets/javascripts/jquery.stacktable.js +54 -0
  79. data/web/assets/javascripts/jquery.tagsinput.js +355 -0
  80. data/web/assets/javascripts/jquery.ui.touch-punch.min.js +11 -0
  81. data/web/assets/stylesheets/flat-ui.css +3865 -0
  82. data/web/views/blackboard_contents.erb +31 -0
  83. data/web/views/blackboards.erb +14 -0
  84. data/web/views/dashboard.erb +11 -0
  85. data/web/views/layout.erb +48 -0
  86. data/web/views/queues.erb +22 -0
  87. metadata +103 -4
@@ -0,0 +1,68 @@
1
+ // Some general UI pack related JS
2
+ // Extend JS String with repeat method
3
+ String.prototype.repeat = function(num) {
4
+ return new Array(num + 1).join(this);
5
+ };
6
+
7
+ (function($) {
8
+
9
+ // Add segments to a slider
10
+ $.fn.addSliderSegments = function (amount) {
11
+ return this.each(function () {
12
+ var segmentGap = 100 / (amount - 1) + "%"
13
+ , segment = "<div class='ui-slider-segment' style='margin-left: " + segmentGap + ";'></div>";
14
+ $(this).prepend(segment.repeat(amount - 2));
15
+ });
16
+ };
17
+
18
+ $(function() {
19
+
20
+ // Todo list
21
+ $(".todo li").click(function() {
22
+ $(this).toggleClass("todo-done");
23
+ });
24
+
25
+ // Custom Select
26
+ $("select[name='herolist']").selectpicker({style: 'btn-primary', menuStyle: 'dropdown-inverse'});
27
+
28
+ // Tooltips
29
+ $("[data-toggle=tooltip]").tooltip("show");
30
+
31
+ // Tags Input
32
+ $(".tagsinput").tagsInput();
33
+
34
+ // jQuery UI Sliders
35
+ var $slider = $("#slider");
36
+ if ($slider.length) {
37
+ $slider.slider({
38
+ min: 1,
39
+ max: 5,
40
+ value: 2,
41
+ orientation: "horizontal",
42
+ range: "min"
43
+ }).addSliderSegments($slider.slider("option").max);
44
+ }
45
+
46
+ // Placeholders for input/textarea
47
+ $("input, textarea").placeholder();
48
+
49
+ // Make pagination demo work
50
+ $(".pagination a").on('click', function() {
51
+ $(this).parent().siblings("li").removeClass("active").end().addClass("active");
52
+ });
53
+
54
+ $(".btn-group a").on('click', function() {
55
+ $(this).siblings().removeClass("active").end().addClass("active");
56
+ });
57
+
58
+ // Disable link clicks to prevent page scrolling
59
+ $('a[href="#fakelink"]').on('click', function (e) {
60
+ e.preventDefault();
61
+ });
62
+
63
+ // Switch
64
+ $("[data-toggle='switch']").wrap('<div class="switch" />').parent().bootstrapSwitch();
65
+
66
+ });
67
+
68
+ })(jQuery);
@@ -0,0 +1,412 @@
1
+ !function($) {
2
+ var Selectpicker = function(element, options, e) {
3
+ if (e ) {
4
+ e.stopPropagation();
5
+ e.preventDefault();
6
+ }
7
+ this.$element = $(element);
8
+ this.$newElement = null;
9
+ this.button = null;
10
+
11
+ //Merge defaults, options and data-attributes to make our options
12
+ this.options = $.extend({}, $.fn.selectpicker.defaults, this.$element.data(), typeof options == 'object' && options);
13
+
14
+ //If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
15
+ if(this.options.title==null)
16
+ this.options.title = this.$element.attr('title');
17
+
18
+ //Expose public methods
19
+ this.val = Selectpicker.prototype.val;
20
+ this.render = Selectpicker.prototype.render;
21
+ this.init();
22
+ };
23
+
24
+ Selectpicker.prototype = {
25
+
26
+ constructor: Selectpicker,
27
+
28
+ init: function (e) {
29
+ var _this = this;
30
+ this.$element.hide();
31
+ this.multiple = this.$element.prop('multiple');
32
+
33
+
34
+ var classList = this.$element.attr('class') !== undefined ? this.$element.attr('class').split(/\s+/) : '';
35
+ var id = this.$element.attr('id');
36
+ this.$element.after( this.createView() );
37
+ this.$newElement = this.$element.next('.select');
38
+ var select = this.$newElement;
39
+ var menu = this.$newElement.find('.dropdown-menu');
40
+ var menuArrow = this.$newElement.find('.dropdown-arrow');
41
+ var menuA = menu.find('li > a');
42
+ var liHeight = select.addClass('open').find('.dropdown-menu li > a').outerHeight();
43
+ select.removeClass('open');
44
+ var divHeight = menu.find('li .divider').outerHeight(true);
45
+ var selectOffset_top = this.$newElement.offset().top;
46
+ var size = 0;
47
+ var menuHeight = 0;
48
+ var selectHeight = this.$newElement.outerHeight();
49
+ this.button = this.$newElement.find('> button');
50
+ if (id !== undefined) {
51
+ this.button.attr('id', id);
52
+ $('label[for="' + id + '"]').click(function(){ select.find('button#'+id).focus(); })
53
+ }
54
+ for (var i = 0; i < classList.length; i++) {
55
+ if(classList[i] != 'selectpicker') {
56
+ this.$newElement.addClass(classList[i]);
57
+ }
58
+ }
59
+ //If we are multiple, then add the show-tick class by default
60
+ if(this.multiple) {
61
+ this.$newElement.addClass('select-multiple');
62
+ }
63
+ this.button.addClass(this.options.style);
64
+ menu.addClass(this.options.menuStyle);
65
+ menuArrow.addClass(function() {
66
+ if (_this.options.menuStyle) {
67
+ return _this.options.menuStyle.replace('dropdown-', 'dropdown-arrow-');
68
+ }
69
+ });
70
+ this.checkDisabled();
71
+ this.checkTabIndex();
72
+ this.clickListener();
73
+ var menuPadding = parseInt(menu.css('padding-top')) + parseInt(menu.css('padding-bottom')) + parseInt(menu.css('border-top-width')) + parseInt(menu.css('border-bottom-width'));
74
+ if (this.options.size == 'auto') {
75
+ function getSize() {
76
+ var selectOffset_top_scroll = selectOffset_top - $(window).scrollTop();
77
+ var windowHeight = window.innerHeight;
78
+ var menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2;
79
+ var selectOffset_bot = windowHeight - selectOffset_top_scroll - selectHeight - menuExtras;
80
+ menuHeight = selectOffset_bot;
81
+ if (select.hasClass('dropup')) {
82
+ menuHeight = selectOffset_top_scroll - menuExtras;
83
+ }
84
+ menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'auto', 'min-height' : liHeight*3 + 'px'});
85
+ }
86
+ getSize();
87
+ $(window).resize(getSize);
88
+ $(window).scroll(getSize);
89
+ this.$element.bind('DOMNodeInserted', getSize);
90
+ } else if (this.options.size && this.options.size != 'auto' && menu.find('li').length > this.options.size) {
91
+ var optIndex = menu.find("li > *").filter(':not(.divider)').slice(0,this.options.size).last().parent().index();
92
+ var divLength = menu.find("li").slice(0,optIndex + 1).find('.divider').length;
93
+ menuHeight = liHeight*this.options.size + divLength*divHeight + menuPadding;
94
+ menu.css({'max-height' : menuHeight + 'px', 'overflow-y' : 'scroll'});
95
+ }
96
+
97
+ //Listen for updates to the DOM and re render...
98
+ this.$element.bind('DOMNodeInserted', $.proxy(this.reloadLi, this));
99
+
100
+ this.render();
101
+ },
102
+
103
+ createDropdown: function() {
104
+ var drop =
105
+ "<div class='btn-group select'>" +
106
+ "<i class='dropdown-arrow'></i>" +
107
+ "<button class='btn dropdown-toggle clearfix' data-toggle='dropdown'>" +
108
+ "<span class='filter-option pull-left'></span>&nbsp;" +
109
+ "<span class='caret'></span>" +
110
+ "</button>" +
111
+ "<ul class='dropdown-menu' role='menu'>" +
112
+ "</ul>" +
113
+ "</div>";
114
+
115
+ return $(drop);
116
+ },
117
+
118
+
119
+ createView: function() {
120
+ var $drop = this.createDropdown();
121
+ var $li = this.createLi();
122
+ $drop.find('ul').append($li);
123
+ return $drop;
124
+ },
125
+
126
+ reloadLi: function() {
127
+ //Remove all children.
128
+ this.destroyLi();
129
+ //Re build
130
+ $li = this.createLi();
131
+ this.$newElement.find('ul').append( $li );
132
+ //render view
133
+ this.render();
134
+ },
135
+
136
+ destroyLi:function() {
137
+ this.$newElement.find('li').remove();
138
+ },
139
+
140
+ createLi: function() {
141
+
142
+ var _this = this;
143
+ var _li = [];
144
+ var _liA = [];
145
+ var _liHtml = '';
146
+
147
+ this.$element.find('option').each(function(){
148
+ _li.push($(this).text());
149
+ });
150
+
151
+ this.$element.find('option').each(function(index) {
152
+ //Get the class and text for the option
153
+ var optionClass = $(this).attr("class") !== undefined ? $(this).attr("class") : '';
154
+ var text = $(this).text();
155
+ var subtext = $(this).data('subtext') !== undefined ? '<small class="muted">'+$(this).data('subtext')+'</small>' : '';
156
+
157
+ //Append any subtext to the main text.
158
+ text+=subtext;
159
+
160
+ if ($(this).parent().is('optgroup') && $(this).data('divider') != true) {
161
+ if ($(this).index() == 0) {
162
+ //Get the opt group label
163
+ var label = $(this).parent().attr('label');
164
+ var labelSubtext = $(this).parent().data('subtext') !== undefined ? '<small class="muted">'+$(this).parent().data('subtext')+'</small>' : '';
165
+ label += labelSubtext;
166
+
167
+ if ($(this)[0].index != 0) {
168
+ _liA.push(
169
+ '<div class="divider"></div>'+
170
+ '<dt>'+label+'</dt>'+
171
+ _this.createA(text, "opt " + optionClass )
172
+ );
173
+ } else {
174
+ _liA.push(
175
+ '<dt>'+label+'</dt>'+
176
+ _this.createA(text, "opt " + optionClass ));
177
+ }
178
+ } else {
179
+ _liA.push( _this.createA(text, "opt " + optionClass ) );
180
+ }
181
+ } else if ($(this).data('divider') == true) {
182
+ _liA.push('<div class="divider"></div>');
183
+ } else {
184
+ _liA.push( _this.createA(text, optionClass ) );
185
+ }
186
+ });
187
+
188
+ if (_li.length > 0) {
189
+ for (var i = 0; i < _li.length; i++) {
190
+ var $option = this.$element.find('option').eq(i);
191
+ _liHtml += "<li rel=" + i + ">" + _liA[i] + "</li>";
192
+ }
193
+ }
194
+
195
+ //If we dont have a selected item, and we dont have a title, select the first element so something is set in the button
196
+ if(this.$element.find('option:selected').length==0 && !_this.options.title) {
197
+ this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
198
+ }
199
+
200
+ return $(_liHtml);
201
+ },
202
+
203
+ createA:function(test, classes) {
204
+ return '<a tabindex="-1" href="#" class="'+classes+'">' +
205
+ '<span class="pull-left">' + test + '</span>' +
206
+ '</a>';
207
+
208
+ },
209
+
210
+ render:function() {
211
+ var _this = this;
212
+
213
+ //Set width of select
214
+ if (this.options.width == 'auto') {
215
+ var ulWidth = this.$newElement.find('.dropdown-menu').css('width');
216
+ this.$newElement.css('width',ulWidth);
217
+ } else if (this.options.width && this.options.width != 'auto') {
218
+ this.$newElement.css('width',this.options.width);
219
+ }
220
+
221
+ //Update the LI to match the SELECT
222
+ this.$element.find('option').each(function(index) {
223
+ _this.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled') );
224
+ _this.setSelected(index, $(this).is(':selected') );
225
+ });
226
+
227
+
228
+
229
+ var selectedItems = this.$element.find('option:selected').map(function(index,value) {
230
+ if($(this).attr('title')!=undefined) {
231
+ return $(this).attr('title');
232
+ } else {
233
+ return $(this).text();
234
+ }
235
+ }).toArray();
236
+
237
+ //Convert all the values into a comma delimited string
238
+ var title = selectedItems.join(", ");
239
+
240
+ //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
241
+ if(_this.multiple && _this.options.selectedTextFormat.indexOf('count') > -1) {
242
+ var max = _this.options.selectedTextFormat.split(">");
243
+ if( (max.length>1 && selectedItems.length > max[1]) || (max.length==1 && selectedItems.length>=2)) {
244
+ title = selectedItems.length +' of ' + this.$element.find('option').length + ' selected';
245
+ }
246
+ }
247
+
248
+ //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
249
+ if(!title) {
250
+ title = _this.options.title != undefined ? _this.options.title : _this.options.noneSelectedText;
251
+ }
252
+
253
+ this.$element.next('.select').find('.filter-option').html( title );
254
+ },
255
+
256
+
257
+
258
+ setSelected:function(index, selected) {
259
+ if(selected) {
260
+ this.$newElement.find('li').eq(index).addClass('selected');
261
+ } else {
262
+ this.$newElement.find('li').eq(index).removeClass('selected');
263
+ }
264
+ },
265
+
266
+ setDisabled:function(index, disabled) {
267
+ if(disabled) {
268
+ this.$newElement.find('li').eq(index).addClass('disabled');
269
+ } else {
270
+ this.$newElement.find('li').eq(index).removeClass('disabled');
271
+ }
272
+ },
273
+
274
+ checkDisabled: function() {
275
+ if (this.$element.is(':disabled')) {
276
+ this.button.addClass('disabled');
277
+ this.button.click(function(e) {
278
+ e.preventDefault();
279
+ });
280
+ }
281
+ },
282
+
283
+ checkTabIndex: function() {
284
+ if (this.$element.is('[tabindex]')) {
285
+ var tabindex = this.$element.attr("tabindex");
286
+ this.button.attr('tabindex', tabindex);
287
+ }
288
+ },
289
+
290
+ clickListener: function() {
291
+ var _this = this;
292
+
293
+ $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
294
+
295
+
296
+
297
+ this.$newElement.on('click', 'li a', function(e){
298
+ var clickedIndex = $(this).parent().index(),
299
+ $this = $(this).parent(),
300
+ $select = $this.parents('.select');
301
+
302
+
303
+ //Dont close on multi choice menu
304
+ if(_this.multiple) {
305
+ e.stopPropagation();
306
+ }
307
+
308
+ e.preventDefault();
309
+
310
+ //Dont run if we have been disabled
311
+ if ($select.prev('select').not(':disabled') && !$(this).parent().hasClass('disabled')){
312
+ //Deselect all others if not multi select box
313
+ if (!_this.multiple) {
314
+ $select.prev('select').find('option').removeAttr('selected');
315
+ $select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
316
+ }
317
+ //Else toggle the one we have chosen if we are multi selet.
318
+ else {
319
+ var selected = $select.prev('select').find('option').eq(clickedIndex).prop('selected');
320
+
321
+ if(selected) {
322
+ $select.prev('select').find('option').eq(clickedIndex).removeAttr('selected');
323
+ } else {
324
+ $select.prev('select').find('option').eq(clickedIndex).prop('selected', true).attr('selected', 'selected');
325
+ }
326
+ }
327
+
328
+
329
+ $select.find('.filter-option').html($this.text());
330
+ $select.find('button').focus();
331
+
332
+ // Trigger select 'change'
333
+ $select.prev('select').trigger('change');
334
+ }
335
+
336
+ });
337
+
338
+ this.$newElement.on('click', 'li.disabled a, li dt, li .divider', function(e) {
339
+ e.preventDefault();
340
+ e.stopPropagation();
341
+ $select = $(this).parent().parents('.select');
342
+ $select.find('button').focus();
343
+ });
344
+
345
+ this.$element.on('change', function(e) {
346
+ _this.render();
347
+ });
348
+ },
349
+
350
+ val:function(value) {
351
+
352
+ if(value!=undefined) {
353
+ this.$element.val( value );
354
+
355
+ this.$element.trigger('change');
356
+ return this.$element;
357
+ } else {
358
+ return this.$element.val();
359
+ }
360
+ }
361
+
362
+ };
363
+
364
+ $.fn.selectpicker = function(option, event) {
365
+ //get the args of the outer function..
366
+ var args = arguments;
367
+ var value;
368
+ var chain = this.each(function () {
369
+ var $this = $(this),
370
+ data = $this.data('selectpicker'),
371
+ options = typeof option == 'object' && option;
372
+
373
+ if (!data) {
374
+ $this.data('selectpicker', (data = new Selectpicker(this, options, event)));
375
+ } else {
376
+ for(var i in option) {
377
+ data[i]=option[i];
378
+ }
379
+ }
380
+
381
+ if (typeof option == 'string') {
382
+ //Copy the value of option, as once we shift the arguments
383
+ //it also shifts the value of option.
384
+ property = option;
385
+ if(data[property] instanceof Function) {
386
+ [].shift.apply(args);
387
+ value = data[property].apply(data, args);
388
+ } else {
389
+ value = data[property];
390
+ }
391
+ }
392
+ });
393
+
394
+ if(value!=undefined) {
395
+ return value;
396
+ } else {
397
+ return chain;
398
+ }
399
+ };
400
+
401
+ $.fn.selectpicker.defaults = {
402
+ style: null,
403
+ size: 'auto',
404
+ title: null,
405
+ selectedTextFormat : 'values',
406
+ noneSelectedText : 'Nothing selected',
407
+ width: null,
408
+ menuStyle: null,
409
+ toggleSize: null
410
+ }
411
+
412
+ }(window.jQuery);