table_beet 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. data/README.md +1 -1
  2. data/lib/table_beet/formatters/html_template/data/js/jquery.quicksearch.js +181 -0
  3. data/lib/table_beet/formatters/html_template/index.erb +45 -7
  4. data/lib/table_beet/version.rb +1 -1
  5. metadata +5 -32
  6. data/lib/table_beet/formatters/html_template/data/js/coffee/groundwork.coffee +0 -207
  7. data/lib/table_beet/formatters/html_template/data/scss/_buttons.scss +0 -178
  8. data/lib/table_beet/formatters/html_template/data/scss/_callouts.scss +0 -51
  9. data/lib/table_beet/formatters/html_template/data/scss/_font-awesome.scss +0 -534
  10. data/lib/table_beet/formatters/html_template/data/scss/_forms.scss +0 -164
  11. data/lib/table_beet/formatters/html_template/data/scss/_global.scss +0 -31
  12. data/lib/table_beet/formatters/html_template/data/scss/_grid.scss +0 -384
  13. data/lib/table_beet/formatters/html_template/data/scss/_layout.scss +0 -78
  14. data/lib/table_beet/formatters/html_template/data/scss/_messages.scss +0 -59
  15. data/lib/table_beet/formatters/html_template/data/scss/_mixins.scss +0 -197
  16. data/lib/table_beet/formatters/html_template/data/scss/_mobile-reset.scss +0 -11
  17. data/lib/table_beet/formatters/html_template/data/scss/_modals.scss +0 -101
  18. data/lib/table_beet/formatters/html_template/data/scss/_navigation.scss +0 -284
  19. data/lib/table_beet/formatters/html_template/data/scss/_orbit.scss +0 -239
  20. data/lib/table_beet/formatters/html_template/data/scss/_popovers.scss +0 -10
  21. data/lib/table_beet/formatters/html_template/data/scss/_reset.scss +0 -77
  22. data/lib/table_beet/formatters/html_template/data/scss/_responsive.scss +0 -293
  23. data/lib/table_beet/formatters/html_template/data/scss/_social-icons.scss +0 -92
  24. data/lib/table_beet/formatters/html_template/data/scss/_tables.scss +0 -80
  25. data/lib/table_beet/formatters/html_template/data/scss/_tabs.scss +0 -137
  26. data/lib/table_beet/formatters/html_template/data/scss/_tooltips.scss +0 -161
  27. data/lib/table_beet/formatters/html_template/data/scss/_typography.scss +0 -263
  28. data/lib/table_beet/formatters/html_template/data/scss/_ui-elements.scss +0 -10
  29. data/lib/table_beet/formatters/html_template/data/scss/_variables.scss +0 -134
  30. data/lib/table_beet/formatters/html_template/data/scss/_webfonts.scss +0 -19
  31. data/lib/table_beet/formatters/html_template/data/scss/groundwork-ie.scss +0 -64
  32. data/lib/table_beet/formatters/html_template/data/scss/groundwork.scss +0 -37
  33. data/lib/table_beet/formatters/html_template/data/scss/no-svg.scss +0 -69
data/README.md CHANGED
@@ -43,7 +43,7 @@ e.g.
43
43
  Add `(1)` and `(2)` line to your application's `spec_helper` file.
44
44
 
45
45
  ```ruby
46
- require 'table_beet'
46
+ require 'table_beet' # (1)
47
47
 
48
48
  Dir.glob("spec/steps/**/*steps.rb") { |f| load f, true }
49
49
 
@@ -0,0 +1,181 @@
1
+ (function($, window, document, undefined) {
2
+ $.fn.quicksearch = function (target, opt) {
3
+
4
+ var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
5
+ delay: 100,
6
+ selector: null,
7
+ stripeRows: null,
8
+ loader: null,
9
+ noResults: '',
10
+ matchedResultsCount: 0,
11
+ bind: 'keyup',
12
+ onBefore: function () {
13
+ return;
14
+ },
15
+ onAfter: function () {
16
+ return;
17
+ },
18
+ show: function () {
19
+ this.style.display = "";
20
+ },
21
+ hide: function () {
22
+ this.style.display = "none";
23
+ },
24
+ prepareQuery: function (val) {
25
+ return val.toLowerCase().split(' ');
26
+ },
27
+ testQuery: function (query, txt, _row) {
28
+ for (var i = 0; i < query.length; i += 1) {
29
+ if (txt.indexOf(query[i]) === -1) {
30
+ return false;
31
+ }
32
+ }
33
+ return true;
34
+ }
35
+ }, opt);
36
+
37
+ this.go = function () {
38
+
39
+ var i = 0,
40
+ numMatchedRows = 0,
41
+ noresults = true,
42
+ query = options.prepareQuery(val),
43
+ val_empty = (val.replace(' ', '').length === 0);
44
+
45
+ for (var i = 0, len = rowcache.length; i < len; i++) {
46
+ if (val_empty || options.testQuery(query, cache[i], rowcache[i])) {
47
+ options.show.apply(rowcache[i]);
48
+ noresults = false;
49
+ numMatchedRows++;
50
+ } else {
51
+ options.hide.apply(rowcache[i]);
52
+ }
53
+ }
54
+
55
+ if (noresults) {
56
+ this.results(false);
57
+ } else {
58
+ this.results(true);
59
+ this.stripe();
60
+ }
61
+
62
+ this.matchedResultsCount = numMatchedRows;
63
+ this.loader(false);
64
+ options.onAfter();
65
+
66
+ return this;
67
+ };
68
+
69
+ /*
70
+ * External API so that users can perform search programatically.
71
+ * */
72
+ this.search = function (submittedVal) {
73
+ val = submittedVal;
74
+ e.trigger();
75
+ };
76
+
77
+ /*
78
+ * External API to get the number of matched results as seen in
79
+ * https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6
80
+ * */
81
+ this.currentMatchedResults = function() {
82
+ return this.matchedResultsCount;
83
+ };
84
+
85
+ this.stripe = function () {
86
+
87
+ if (typeof options.stripeRows === "object" && options.stripeRows !== null)
88
+ {
89
+ var joined = options.stripeRows.join(' ');
90
+ var stripeRows_length = options.stripeRows.length;
91
+
92
+ jq_results.not(':hidden').each(function (i) {
93
+ $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
94
+ });
95
+ }
96
+
97
+ return this;
98
+ };
99
+
100
+ this.strip_html = function (input) {
101
+ var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
102
+ output = $.trim(output.toLowerCase());
103
+ return output;
104
+ };
105
+
106
+ this.results = function (bool) {
107
+ if (typeof options.noResults === "string" && options.noResults !== "") {
108
+ if (bool) {
109
+ $(options.noResults).hide();
110
+ } else {
111
+ $(options.noResults).show();
112
+ }
113
+ }
114
+ return this;
115
+ };
116
+
117
+ this.loader = function (bool) {
118
+ if (typeof options.loader === "string" && options.loader !== "") {
119
+ (bool) ? $(options.loader).show() : $(options.loader).hide();
120
+ }
121
+ return this;
122
+ };
123
+
124
+ this.cache = function () {
125
+
126
+ jq_results = $(target);
127
+
128
+ if (typeof options.noResults === "string" && options.noResults !== "") {
129
+ jq_results = jq_results.not(options.noResults);
130
+ }
131
+
132
+ var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults);
133
+ cache = t.map(function () {
134
+ return e.strip_html(this.innerHTML);
135
+ });
136
+
137
+ rowcache = jq_results.map(function () {
138
+ return this;
139
+ });
140
+
141
+ /*
142
+ * Modified fix for sync-ing "val".
143
+ * Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1
144
+ * */
145
+ val = val || this.val() || "";
146
+
147
+ return this.go();
148
+ };
149
+
150
+ this.trigger = function () {
151
+ this.loader(true);
152
+ options.onBefore();
153
+
154
+ window.clearTimeout(timeout);
155
+ timeout = window.setTimeout(function () {
156
+ e.go();
157
+ }, options.delay);
158
+
159
+ return this;
160
+ };
161
+
162
+ this.cache();
163
+ this.results(true);
164
+ this.stripe();
165
+ this.loader(false);
166
+
167
+ return this.each(function () {
168
+
169
+ /*
170
+ * Changed from .bind to .on.
171
+ * */
172
+ $(this).on(options.bind, function () {
173
+
174
+ val = $(this).val();
175
+ e.trigger();
176
+ });
177
+ });
178
+
179
+ };
180
+
181
+ }(jQuery, this, document));
@@ -43,8 +43,18 @@
43
43
  <body>
44
44
  <header>
45
45
  <div class="container">
46
- <div class="align-left">
47
- <h1>TableBeet</h1>
46
+ <div class="row">
47
+ <div class="two sixth padded align-left">
48
+ <div class="align-left">
49
+ <h1>TableBeet</h1>
50
+ </div>
51
+ </div>
52
+ <div class="two sixth padded align-right" id="loading">
53
+ <i class="icon-spinner icon-2x icon-spin" style="display: none;"></i>
54
+ </div>
55
+ <div class="two sixth padded align-right">
56
+ <input type="text" id="keyword" name="keyword" placeholder="Search step name">
57
+ </div>
48
58
  </div>
49
59
  </div>
50
60
  </header>
@@ -63,12 +73,12 @@
63
73
  <h1><i class="icon-th-large"></i> Step list</h1>
64
74
 
65
75
  <% scopes.each do |scope, steps| %>
66
- <div class="row">
76
+ <div class="row scope_title">
67
77
  <div class="padded">
68
78
  <h2><i class="icon-caret-right"></i> <a name="<%= ERB::Util.h(scope) %>"><%= ERB::Util.h(scope) %></a></h2>
69
79
  </div>
70
80
  </div>
71
- <table>
81
+ <table class="scope">
72
82
  <thead>
73
83
  <tr>
74
84
  <th>Step name</th>
@@ -108,10 +118,38 @@
108
118
  <!-- scripts -->
109
119
  <script type="text/javascript" src="./js/plugins/jquery.orbit-1.4.0.js"></script>
110
120
  <script type="text/javascript" src="./js/groundwork.js"></script>
121
+ <script type="text/javascript" src="./js/jquery.quicksearch.js"></script>
111
122
  <script type="text/javascript">
112
- $('th.step_name').each(function() {
113
- var decoration = $(this).text().replace(/(:[\w]+)/g, function() { return "<code>" + RegExp.$1 + "</code>"; });
114
- $(this).html(decoration);
123
+ $(function () {
124
+ $('th.step_name').each(function() {
125
+ var decoration = $(this).text().replace(/(:[\w]+)/g, function() { return "<code>" + RegExp.$1 + "</code>"; });
126
+ $(this).html(decoration);
127
+ });
128
+
129
+ $('input#keyword').quicksearch('table.scope tbody tr', {
130
+ 'delay' : 100,
131
+ 'selector' : 'th',
132
+ 'loader' : 'div#loading i',
133
+
134
+ 'show' : function () {
135
+ $(this).show();
136
+ var table = $(this).closest('table.scope');
137
+ var title = table.prev('div.scope_title');
138
+ table.show();
139
+ title.show();
140
+ },
141
+
142
+ 'hide' : function () {
143
+ $(this).hide();
144
+ if ($(this).siblings(':visible').size() == 0) {
145
+ var table = $(this).closest('table.scope');
146
+ var title = table.prev('div.scope_title');
147
+ table.hide();
148
+ title.hide();
149
+ }
150
+ }
151
+ });
152
+
115
153
  });
116
154
  </script>
117
155
  </body>
@@ -1,3 +1,3 @@
1
1
  module TableBeet
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-24 00:00:00.000000000 Z
12
+ date: 2013-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turnip
@@ -358,8 +358,8 @@ files:
358
358
  - lib/table_beet/formatters/html_template/data/images/social-icons/zerply-s.png
359
359
  - lib/table_beet/formatters/html_template/data/images/social-icons/zerply.png
360
360
  - lib/table_beet/formatters/html_template/data/images/social-icons/zerply.svg
361
- - lib/table_beet/formatters/html_template/data/js/coffee/groundwork.coffee
362
361
  - lib/table_beet/formatters/html_template/data/js/groundwork.js
362
+ - lib/table_beet/formatters/html_template/data/js/jquery.quicksearch.js
363
363
  - lib/table_beet/formatters/html_template/data/js/libs/boxsizing.htc
364
364
  - lib/table_beet/formatters/html_template/data/js/libs/html5shiv.js
365
365
  - lib/table_beet/formatters/html_template/data/js/libs/html5shiv.min.js
@@ -381,33 +381,6 @@ files:
381
381
  - lib/table_beet/formatters/html_template/data/js/plugins/jquery.responsiveTables.js
382
382
  - lib/table_beet/formatters/html_template/data/js/plugins/jquery.responsiveText.js
383
383
  - lib/table_beet/formatters/html_template/data/js/plugins/jquery.tooltip.js
384
- - lib/table_beet/formatters/html_template/data/scss/_buttons.scss
385
- - lib/table_beet/formatters/html_template/data/scss/_callouts.scss
386
- - lib/table_beet/formatters/html_template/data/scss/_font-awesome.scss
387
- - lib/table_beet/formatters/html_template/data/scss/_forms.scss
388
- - lib/table_beet/formatters/html_template/data/scss/_global.scss
389
- - lib/table_beet/formatters/html_template/data/scss/_grid.scss
390
- - lib/table_beet/formatters/html_template/data/scss/_layout.scss
391
- - lib/table_beet/formatters/html_template/data/scss/_messages.scss
392
- - lib/table_beet/formatters/html_template/data/scss/_mixins.scss
393
- - lib/table_beet/formatters/html_template/data/scss/_mobile-reset.scss
394
- - lib/table_beet/formatters/html_template/data/scss/_modals.scss
395
- - lib/table_beet/formatters/html_template/data/scss/_navigation.scss
396
- - lib/table_beet/formatters/html_template/data/scss/_orbit.scss
397
- - lib/table_beet/formatters/html_template/data/scss/_popovers.scss
398
- - lib/table_beet/formatters/html_template/data/scss/_reset.scss
399
- - lib/table_beet/formatters/html_template/data/scss/_responsive.scss
400
- - lib/table_beet/formatters/html_template/data/scss/_social-icons.scss
401
- - lib/table_beet/formatters/html_template/data/scss/_tables.scss
402
- - lib/table_beet/formatters/html_template/data/scss/_tabs.scss
403
- - lib/table_beet/formatters/html_template/data/scss/_tooltips.scss
404
- - lib/table_beet/formatters/html_template/data/scss/_typography.scss
405
- - lib/table_beet/formatters/html_template/data/scss/_ui-elements.scss
406
- - lib/table_beet/formatters/html_template/data/scss/_variables.scss
407
- - lib/table_beet/formatters/html_template/data/scss/_webfonts.scss
408
- - lib/table_beet/formatters/html_template/data/scss/groundwork-ie.scss
409
- - lib/table_beet/formatters/html_template/data/scss/groundwork.scss
410
- - lib/table_beet/formatters/html_template/data/scss/no-svg.scss
411
384
  - lib/table_beet/formatters/html_template/index.erb
412
385
  - lib/table_beet/formatters/text_formatter.rb
413
386
  - lib/table_beet/loader.rb
@@ -431,7 +404,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
431
404
  version: '0'
432
405
  segments:
433
406
  - 0
434
- hash: 2881766382480119071
407
+ hash: 3448460025646917409
435
408
  required_rubygems_version: !ruby/object:Gem::Requirement
436
409
  none: false
437
410
  requirements:
@@ -440,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
440
413
  version: '0'
441
414
  segments:
442
415
  - 0
443
- hash: 2881766382480119071
416
+ hash: 3448460025646917409
444
417
  requirements: []
445
418
  rubyforge_project:
446
419
  rubygems_version: 1.8.23
@@ -1,207 +0,0 @@
1
- ###
2
- *
3
- * GroundworkCSS JS by Gary Hepting - https://github.com/groundworkcss/groundwork
4
- *
5
- * Open source under the BSD License.
6
- *
7
- * Copyright © 2013 Gary Hepting. All rights reserved.
8
- *
9
- ###
10
-
11
- $(document).ready ->
12
-
13
- # navigation menus
14
- delay = ''
15
- $('nav > ul > li.menu').on
16
- mouseenter: (e) ->
17
- if $(window).width() > 768
18
- clearTimeout(delay)
19
- $('nav > ul > li').removeClass('on')
20
- $('nav > ul > li > ul').hide()
21
- $(this).addClass('on')
22
- mouseleave: (e) ->
23
- if $(window).width() > 768
24
- delay = setTimeout (->
25
- $('nav > ul > li').removeClass('on')
26
- $('nav > ul > li > ul').hide()
27
- ), 350
28
- click: (e) ->
29
- if $(window).width() < 768
30
- if $(e.target).parent('li.menu').size() > 0
31
- $this = $(this)
32
- $(this).children('ul').slideToggle 300, ->
33
- $this.toggleClass('on')
34
- e.preventDefault()
35
- return false
36
- tap: (e) ->
37
- if $(e.target).parent('li.menu').size() > 0
38
- $this = $(this)
39
- $(this).children('ul').slideToggle 300, ->
40
- $this.toggleClass('on')
41
- e.preventDefault()
42
- return false
43
-
44
- # dynamically adjust pagination items
45
- limitPaginationItems()
46
- # change active page
47
- $('.pagination ul > li:not(.next, .prev) a').on 'click', ( (e) ->
48
- $('.pagination ul > li:not(.next, .prev)').removeClass('active')
49
- $(this).parent('li').addClass('active')
50
- # toggle previous button state
51
- if $(this).parent('li').hasClass('first')
52
- $('.pagination ul > li.prev').addClass('disabled')
53
- else
54
- $('.pagination ul > li.prev').removeClass('disabled')
55
- # toggle next button state
56
- if $(this).parent('li').hasClass('last')
57
- $('.pagination ul > li.next').addClass('disabled')
58
- else
59
- $('.pagination ul > li.next').removeClass('disabled')
60
- # adjust pagination
61
- limitPaginationItems()
62
- e.preventDefault()
63
- false
64
- )
65
- # handle previous pagination button
66
- $('.pagination ul > li.prev:not(.disabled)').on 'click', ( (e) ->
67
- # enable next button
68
- $('.pagination ul > li.next').removeClass('disabled')
69
- el = $('.pagination ul > li.active')
70
- if !el.hasClass('first')
71
- # set previous page active
72
- el.removeClass('active')
73
- el.prev().addClass('active')
74
- # adjust pagination
75
- limitPaginationItems()
76
- # disable previous button if at first page
77
- if $('.pagination ul > li.active').hasClass('first')
78
- $(this).addClass('disabled')
79
- e.preventDefault()
80
- false
81
- )
82
- # handle next pagination button
83
- $('.pagination ul > li.next:not(.disabled)').on 'click', ( (e) ->
84
- # enable previous button
85
- $('.pagination ul > li.prev').removeClass('disabled')
86
- el = $('.pagination ul > li.active')
87
- if !el.hasClass('last')
88
- # set next page active
89
- el.removeClass('active')
90
- el.next().addClass('active')
91
- # adjust pagination
92
- limitPaginationItems()
93
- # disable next button if at last page
94
- if $('.pagination ul > li.active').hasClass('last')
95
- $(this).addClass('disabled')
96
- e.preventDefault()
97
- false
98
- )
99
- # disable page jump for disabled pagination links
100
- $('.pagination ul > li.disabled a').on 'click', ( (e) ->
101
- e.preventDefault()
102
- false
103
- )
104
-
105
- # select all text on invalid input field entries
106
- $('.error input, .error textarea,
107
- .invalid input, .invalid textarea,
108
- input.error, textarea.error,
109
- input.invalid, textarea.invalid').on
110
- click: ->
111
- $(this).focus()
112
- $(this).select()
113
-
114
- # polyfill select box placeholders
115
- $('span.select select').each ->
116
- if $(this).children('option').first().val() == '' and $(this).children('option').first().attr('selected')
117
- $(this).addClass('unselected')
118
- else
119
- $(this).removeClass('unselected')
120
- $('span.select select').on
121
- change: ->
122
- if $(this).children('option').first().val() == '' and $(this).children('option').first().attr('selected')
123
- $(this).addClass('unselected')
124
- else
125
- $(this).removeClass('unselected')
126
-
127
- # tabs
128
- $('.tabs > ul > li > a').not('.disabled').click (e) ->
129
- tabs = $(this).parents('.tabs')
130
- tabs.find('> ul li a').removeClass('active')
131
- $(this).addClass('active')
132
- tabs.children('div').removeClass('active')
133
- tabs.children($(this).attr('href')).addClass('active')
134
- e.preventDefault()
135
- return false
136
-
137
- # responsive headings
138
- $('.responsive').not('table').each (index, object) ->
139
- compression = 10
140
- min = 10
141
- max = 200
142
- compression = parseFloat $(this).attr('data-compression') || compression
143
- min = parseFloat $(this).attr('data-min') || min
144
- max = parseFloat $(this).attr('data-max') || max
145
- $(object).responsiveText
146
- compressor: compression,
147
- minSize: min,
148
- maxSize: max
149
-
150
- # responsive tables
151
- $('table.responsive').each (index, object) ->
152
- compression = 30
153
- min = 8
154
- max = 13
155
- padding = 0
156
- compression = parseFloat $(this).attr('data-compression') || compression
157
- min = parseFloat $(this).attr('data-min') || min
158
- max = parseFloat $(this).attr('data-max') || max
159
- padding = parseFloat $(this).attr('data-padding') || padding
160
- $(object).responsiveTable
161
- compressor: compression,
162
- minSize: min,
163
- maxSize: max,
164
- padding: padding
165
-
166
- # tooltips
167
- $('.tooltip[title]').tooltip()
168
-
169
- # modals
170
- $('div.modal').modal()
171
-
172
-
173
- $(window).load ->
174
- $('.slider').orbit()
175
-
176
- $(window).resize ->
177
- limitPaginationItems()
178
-
179
- # responsive pagination
180
- limitPaginationItems = ->
181
- #process pagination lists
182
- $('.pagination ul').each ->
183
- pagination = $(this)
184
- # pagination dimensions
185
- visibleSpace = pagination.outerWidth() - pagination.children('li.prev').outerWidth() - pagination.children('li.next').outerWidth()
186
- # hide pages that don't fit
187
- pagination.children('li').not('.prev, .next, .active').hide()
188
- visibleItemsWidth = 0
189
- pagination.children('li:visible').each ->
190
- visibleItemsWidth += $(this).outerWidth()
191
- # loop
192
- while (visibleItemsWidth + 29) < visibleSpace
193
- # show the next page number
194
- pagination.children('li:visible').not('.next').last().next().show()
195
- visibleItemsWidth = 0
196
- pagination.children('li:visible').each ->
197
- visibleItemsWidth += $(this).outerWidth()
198
- if (visibleItemsWidth + 29) <= visibleSpace
199
- # show the previous page number
200
- pagination.children('li:visible').not('.prev').first().prev().show()
201
- visibleItemsWidth = 0
202
- pagination.children('li:visible').each ->
203
- visibleItemsWidth += $(this).outerWidth()
204
- # recalculate visibleItemsWidth
205
- visibleItemsWidth = 0
206
- pagination.children('li:visible').each ->
207
- visibleItemsWidth += $(this).outerWidth()