govuk_admin_template 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.1.1
2
+
3
+ * When filtering tables, allow users to easily go to the first item
4
+
1
5
  # 1.1.0
2
6
 
3
7
  * Upgrade to JQuery 1.11.1
@@ -66,6 +66,10 @@
66
66
  $('[data-toggle="tooltip"]').tooltip();
67
67
  }
68
68
 
69
+ GOVUKAdmin.redirect = function(path) {
70
+ window.location.href = path;
71
+ }
72
+
69
73
  // Google Analytics event tracking
70
74
  // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
71
75
  // Label and value are optional
@@ -10,6 +10,10 @@
10
10
 
11
11
  element.on('keyup change', '.js-filter-table-input', filterTableBasedOnInput);
12
12
 
13
+ if (element.find('a.js-open-on-submit').length > 0) {
14
+ element.on('submit', 'form', openFirstVisibleLink);
15
+ }
16
+
13
17
  function filterTableBasedOnInput(event) {
14
18
  var searchString = $.trim(tableInput.val()),
15
19
  regExp = new RegExp(searchString, 'i');
@@ -23,6 +27,12 @@
23
27
  }
24
28
  });
25
29
  }
30
+
31
+ function openFirstVisibleLink(evt) {
32
+ evt.preventDefault();
33
+ var link = element.find('a.js-open-on-submit:visible').first();
34
+ GOVUKAdmin.redirect(link.attr('href'));
35
+ }
26
36
  }
27
37
  };
28
38
 
@@ -272,15 +272,21 @@
272
272
  </thead>
273
273
  <tbody>
274
274
  <tr>
275
- <td>Apples</td>
275
+ <td>
276
+ <a href="#apples" class="js-open-on-submit">Apples</a>
277
+ </td>
276
278
  <td>100</td>
277
279
  </tr>
278
280
  <tr>
279
- <td>Bananas</td>
281
+ <td>
282
+ <a href="#bananas" class="js-open-on-submit">Bananas</a>
283
+ </td>
280
284
  <td>25</td>
281
285
  </tr>
282
286
  <tr>
283
- <td>Peaches</td>
287
+ <td>
288
+ <a href="#peaches" class="js-open-on-submit">Peaches</a>
289
+ </td>
284
290
  <td>13</td>
285
291
  </tr>
286
292
  </tbody>
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_admin_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
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: 2014-07-22 00:00:00.000000000 Z
12
+ date: 2014-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -219,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  segments:
221
221
  - 0
222
- hash: 2496046958828964519
222
+ hash: -3613484220432523315
223
223
  required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  none: false
225
225
  requirements:
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  segments:
230
230
  - 0
231
- hash: 2496046958828964519
231
+ hash: -3613484220432523315
232
232
  requirements: []
233
233
  rubyforge_project:
234
234
  rubygems_version: 1.8.23