govuk_admin_template 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05b446a77b5540fe25898d6d3d4ddb8d1d019e98
4
- data.tar.gz: 41e69f7e09148dd7127e1eaea2a5aff923d8530f
3
+ metadata.gz: 5dcd6d554293f6eb45fa6666b54ee2066b517c50
4
+ data.tar.gz: 4f965d6a42d966acb878a495d886d25cb743e339
5
5
  SHA512:
6
- metadata.gz: 5b18bfbc9babd4668e0e83f5809b126a1a0a4088534bfb8e21ecc85fea7bf8779c142510620f8a5cd71f65c71c478ebc318582662b8c9fab5dc98c31706af105
7
- data.tar.gz: b2b2d9ed13c2a77ae1f728f437f65de8084b711f29ca0f61cd97654431d918adf0fe357d4dac48147cc5632c1250470b03bbfcd17d0851c059be99973f8e6190
6
+ metadata.gz: 364d87846817a5f58d08d2a91bcba0e4abdbec0817c72edc72b0e236137af6de8febb1798e35417feb91a282c61ed3597e3b3069fbe94593fb6b89d07998de4f
7
+ data.tar.gz: 6d08370f1075f350aa38c17f138283d522947f9ccad72b7b3e903bb1997a018ce1723ec4f2bead3c2827cb86667cb4d7cc7572cd1713f11545156c185c8d5955
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.5.0
2
+
3
+ * Allow apps to disable Google Analytics
4
+ * Fix table filtering for queries containing special characters
5
+
1
6
  # 2.4.0
2
7
 
3
8
  * Add a table filter partial for re-use in apps
data/README.md CHANGED
@@ -82,7 +82,8 @@ The gem [uses nested layouts](http://guides.rubyonrails.org/layouts_and_renderin
82
82
  `:footer_top` (optional) | Footer content before copyright text
83
83
  `:footer_version` (optional) | Text indicating the release, eg commit SHA
84
84
  `:body_end` (optional) | Just before the `</body>` tag
85
- `:full_width` (optional, boolean) | Expand content to edges of screen. Must be used on a per-page basis. Apps must not be full width by default.
85
+ `:full_width` (optional, boolean) | Expand content to edges of screen.
86
+ `:exclude_analytics` (optional, boolean) | Don’t use the default Google Analytics snippet and profile.
86
87
  `:navbar` (optional) | Custom navbar content, overrides default navbar
87
88
 
88
89
  Example navbar_items:
@@ -20,7 +20,7 @@
20
20
 
21
21
  function filterTableBasedOnInput(event) {
22
22
  var searchString = $.trim(tableInput.val()),
23
- regExp = new RegExp(searchString, 'i');
23
+ regExp = new RegExp(escapeStringForRegexp(searchString), 'i');
24
24
 
25
25
  rows.each(function() {
26
26
  var row = $(this);
@@ -37,6 +37,13 @@
37
37
  var link = element.find('a.js-open-on-submit:visible').first();
38
38
  GOVUKAdmin.redirect(link.attr('href'));
39
39
  }
40
+
41
+ // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
42
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/regexp
43
+ // Escape ~!@#$%^&*(){}[]`/=?+\|-_;:'",<.>
44
+ function escapeStringForRegexp(str) {
45
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
46
+ }
40
47
  }
41
48
  };
42
49
 
@@ -96,17 +96,19 @@
96
96
  </footer>
97
97
  </section>
98
98
  <%= yield :body_end %>
99
- <% if Rails.env.production? %>
100
- <script class="analytics">
101
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
102
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
103
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
104
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
99
+ <% unless content_for?(:exclude_analytics) %>
100
+ <% if Rails.env.production? %>
101
+ <script class="analytics">
102
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
103
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
104
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
105
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
105
106
 
106
- ga('create', 'UA-26179049-6', 'alphagov.co.uk');
107
- ga('set', 'anonymizeIp', true);
108
- ga('send', 'pageview');
109
- </script>
107
+ ga('create', 'UA-26179049-6', 'alphagov.co.uk');
108
+ ga('set', 'anonymizeIp', true);
109
+ ga('send', 'pageview');
110
+ </script>
111
+ <% end %>
110
112
  <% end %>
111
113
  </body>
112
114
  </html>
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_admin_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  requirements: []
194
194
  rubyforge_project:
195
- rubygems_version: 2.2.2
195
+ rubygems_version: 2.2.3
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Styles, scripts and templates for GOV.UK admin applications