govuk_admin_template 5.0.1 → 6.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 838f7c3c2aba8f89b0e1bf945a28a6ece5da23e2
4
- data.tar.gz: 80b85e2ba37a358f18b404009e334bcfb1661167
3
+ metadata.gz: 8ff47dba41a87bdfbeb518c142cb0b9e3e7ebbfc
4
+ data.tar.gz: 6e45a0200c7fd797d1221ec7dc5e71ba454ecd70
5
5
  SHA512:
6
- metadata.gz: 5debf727db1e0ece53135fb019bbbcbe837a7ddd5d4a27e726b565d9383eaf134eef539f232bd98b1e14fd864ebbcf23c9630137034d242c15e031475497904b
7
- data.tar.gz: a3b6b529a8f8649effde43b2aa178dd6cd62b3fe038dc1071b5cc29375eaba154a3d387b0d3c47f3229100b2301a1f9b83eb8434dbffd527b066671ae15ac273
6
+ metadata.gz: 60e732a58b171cbb10c45b2cdb1e1264b07a787dba43e38ddef3e67f50f4b03fd3ae61c8cc2df744343feb0992fdd8661f0fe26fa2e663fb3bd0054b494ba24b
7
+ data.tar.gz: a24372fafa8c064552547e3dad18c33e51876b788e4cc1f18e9e1ad996bd44a9238b5a8f9c65d4f259d985458b60c017f4680960c48cd9256846528e9e92afea
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 6.0.0
2
+
3
+ * Changes method call from `GOVUKAdmin.trackEvent(action, label, value)` to `GOVUKAdmin.trackEvent(category, action, options)`. Categories are now mandatory. Calls to `GOVUKAdmin.trackEvent` should be changed to use the latest method signature.
4
+
1
5
  # 5.0.1
2
6
 
3
7
  * Compile correct favicon for production.
data/JAVASCRIPT.md CHANGED
@@ -94,7 +94,7 @@ Modules should have their own tests, whether they’re being included with the g
94
94
 
95
95
  ## Included modules
96
96
 
97
- Found in the [app/assets/javascripts/modules](app/assets/javascripts/modules) directory, with tests in [spec/javascripts/spec/](spec/javascripts/spec/).
97
+ Found in the [app/assets/javascripts/govuk-admin-template/modules](app/assets/javascripts/govuk-admin-template/modules) directory, with tests in [spec/javascripts/spec/](spec/javascripts/spec/).
98
98
 
99
99
  File | Module | Attribute | Description
100
100
  ------ | ------ | --------- | -----------
data/README.md CHANGED
@@ -16,7 +16,6 @@ This gem provides (via a Rails engine):
16
16
  * [Collections publisher](https://github.com/alphagov/collections-publisher)
17
17
  * [Imminence](https://github.com/alphagov/imminence)
18
18
  * [Maslow](https://github.com/alphagov/maslow)
19
- * [Panopticon](https://github.com/alphagov/panopticon)
20
19
  * [Publisher](https://github.com/alphagov/publisher)
21
20
  * [Search admin](https://github.com/alphagov/search-admin)
22
21
  * [Sign on](https://github.com/alphagov/signonotron2)
@@ -85,32 +85,37 @@
85
85
 
86
86
  // Google Analytics event tracking
87
87
  // Label and value are optional
88
- GOVUKAdmin.trackEvent = function(action, label, value) {
89
-
88
+ GOVUKAdmin.trackEvent = function(category, action, options) {
89
+ // Possible values for params: category: 'category', action: 'action', label: 'label', value: 10
90
90
  // https://developers.google.com/analytics/devguides/collection/analyticsjs/events
91
91
  // Default category to the page an event occurs on
92
92
  // Uses sendBeacon for all events
93
93
  // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#transport
94
+
95
+ options = options || {}
96
+ var value;
94
97
  var eventAnalytics = {
95
98
  hitType: 'event',
96
99
  transport: 'beacon',
97
- eventCategory: root.location.pathname,
100
+ eventCategory: category,
98
101
  eventAction: redactEmails(action)
99
- };
102
+ };
100
103
 
101
104
  // Label is optional
102
- if (typeof label === "string") {
103
- eventAnalytics.eventLabel = redactEmails(label);
105
+ if (typeof options.label === "string") {
106
+ eventAnalytics.eventLabel = redactEmails(options.label);
107
+ delete options.label;
104
108
  }
105
109
 
106
110
  // Value is optional, but when used must be an
107
111
  // integer, otherwise the event will be invalid
108
112
  // and not logged
109
- if (value) {
110
- value = parseInt(value, 10);
113
+ if (options.value) {
114
+ value = parseInt(options.value, 10);
111
115
  if (typeof value === "number" && !isNaN(value)) {
112
116
  eventAnalytics.eventValue = value;
113
117
  }
118
+ delete options.value;
114
119
  }
115
120
 
116
121
  if (typeof root.ga === "function") {
@@ -4,11 +4,12 @@
4
4
  Modules.AutoTrackEvent = function() {
5
5
  var that = this;
6
6
  that.start = function(element) {
7
- var action = element.data('track-action'),
7
+ var category = element.data('track-category'),
8
+ action = element.data('track-action'),
8
9
  label = element.data('track-label'),
9
10
  value = element.data('track-value');
10
11
 
11
- GOVUKAdmin.trackEvent(action, label, value);
12
+ GOVUKAdmin.trackEvent(category, action, { label: label, value: value });
12
13
  }
13
14
  };
14
15
 
@@ -6,10 +6,11 @@
6
6
 
7
7
  that.start = function(container) {
8
8
  var trackClick = function() {
9
- var action = container.data("track-action") || "button-pressed",
9
+ var category = container.data("track-category"),
10
+ action = container.data("track-action") || "button-pressed",
10
11
  label = $(this).data("track-label") || $(this).text();
11
12
 
12
- GOVUKAdmin.trackEvent(action, label);
13
+ GOVUKAdmin.trackEvent(category, action, { label: label });
13
14
  };
14
15
 
15
16
  container.on("click", ".js-track", trackClick);
@@ -55,12 +55,12 @@
55
55
  <div class="navbar-header">
56
56
  <% if has_navbar_content %>
57
57
  <%# Bootstrap toggle for collapsed navbar content, used at smaller widths %>
58
- <a class="navbar-toggle" data-toggle="collapse" data-target="header .navbar-collapse">
58
+ <button class="navbar-toggle" data-toggle="collapse" data-target="#navbar-header-menu-items" aria-expanded="false">
59
59
  <span class="sr-only">Toggle navigation</span>
60
60
  <span class="icon-bar"></span>
61
61
  <span class="icon-bar"></span>
62
62
  <span class="icon-bar"></span>
63
- </a>
63
+ </button>
64
64
  <% end %>
65
65
  <%= link_to app_title, app_home_path, :class => 'navbar-brand' %>
66
66
  <% if environment_label %>
@@ -70,7 +70,7 @@
70
70
  <% end %>
71
71
  </div>
72
72
  <% if has_navbar_content %>
73
- <nav role="navigation" class="collapse navbar-collapse">
73
+ <nav role="navigation" class="collapse navbar-collapse" id="navbar-header-menu-items">
74
74
  <% if content_for?(:navbar_items) %>
75
75
  <ul class="nav navbar-nav">
76
76
  <%= yield :navbar_items %>
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "5.0.1"
2
+ VERSION = "6.0.0".freeze
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: 5.0.1
4
+ version: 6.0.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: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -95,33 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.4.4
97
97
  - !ruby/object:Gem::Dependency
98
- name: gem_publisher
98
+ name: jasmine
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3.1
103
+ version: 2.4.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 1.3.1
110
+ version: 2.4.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: jasmine
112
+ name: govuk-lint
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 2.4.0
117
+ version: 1.2.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 2.4.0
124
+ version: 1.2.1
125
125
  description: Styles, scripts and templates for GOV.UK admin applications
126
126
  email:
127
127
  - govuk-dev@digital.cabinet-office.gov.uk