govuk_admin_template 1.1.7 → 1.2.0

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.2.0
2
+
3
+ * Remove selectable table javascript module
4
+
1
5
  # 1.1.7
2
6
 
3
7
  * Fix display of `lead` styles when using `text-muted` class
data/JAVASCRIPT.md CHANGED
@@ -102,5 +102,4 @@ auto_show_modal.js | `AutoShowModal` | `auto-show-modal` | Initialise a Bootstra
102
102
  auto_track_event.js | `AutoTrackEvent` | `auto-track-event` | Use data attributes to track events in Google Analytics on page load
103
103
  filterable_table.js | `FilterableTable` | `filterable-table` | Filter the contents of a table, showing only matching rows
104
104
  fixed_table_header.js | `FixedTableHeader` | `fixed-table-header` | Fix the `<thead>` portion of a table when scrolling offscreen
105
- selectable_table.js | `SelectableTable` | `selectable-table` | Select rows in a table and perform an action on them
106
105
  toggle.js | `Toggle` | `toggle` | A simple toggle
@@ -26,53 +26,3 @@ thead .table-header-secondary td {
26
26
  box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 0.3);
27
27
  }
28
28
  }
29
-
30
- /* Selectable rows
31
- ==========================================================================
32
- Fill table cell with label to make the whole cell clickable.
33
- This is achieved with a bit of a hack, the label is set to a height always
34
- guaranteed to be larger than the cell height, and the cell has its overflow
35
- hidden.
36
- */
37
-
38
- .selectable-row {
39
- padding: 0 !important;
40
- overflow: hidden;
41
- width: 40px;
42
-
43
- tbody & {
44
- background-color: #ccc;
45
- }
46
-
47
- label {
48
- height: 300px;
49
- width: 100%;
50
- margin-bottom: 0;
51
- position: absolute;
52
- text-align: center;
53
- }
54
-
55
- input {
56
- margin-top: 12px;
57
- cursor: pointer;
58
- }
59
- }
60
-
61
- .selectable-row-helper {
62
- border-bottom: 1px dotted #999;
63
- cursor: help;
64
- }
65
-
66
- /* Slightly different spacing for table headers */
67
- .table-header-secondary .selectable-row {
68
- vertical-align: top;
69
-
70
- input {
71
- margin-top: 18px;
72
- }
73
- }
74
-
75
- .selected-row td,
76
- .table-hover .selected-row:hover td {
77
- background-color: #fffbcc; /* yellow highlight */
78
- }
@@ -185,8 +185,6 @@
185
185
  <div class="row">
186
186
  <div class="col-md-6 lead">
187
187
  <p>When using a table with two layers of headings, usually for interacting with table content, <code>table-header</code> and <code>table-header-secondary</code> classes are used.</p>
188
-
189
- <p>The second example shows a table with selectable rows. Selected rows highlight in yellow. The checkbox in the header selects all rows.</p>
190
188
  </div>
191
189
  <div class="col-md-6">
192
190
  <table class="table table-bordered table-hover">
@@ -207,47 +205,6 @@
207
205
  </tr>
208
206
  </tbody>
209
207
  </table>
210
-
211
- <table class="table table-bordered" data-module="selectable-table">
212
- <thead>
213
- <tr class="table-header">
214
- <th></th>
215
- <th>Primary header</th>
216
- </tr>
217
- <tr class="table-header-secondary">
218
- <th class="selectable-row">
219
- <div class="relative">
220
- <label>
221
- <input type="checkbox" class="js-toggle-all" />
222
- </label>
223
- </div>
224
- </th>
225
- <th><a href="<%= @normal_link_href %>" class="btn btn-default">Action</a></th>
226
- </tr>
227
- </thead>
228
- <tbody>
229
- <tr class="selected-row">
230
- <td class="selectable-row">
231
- <div class="relative">
232
- <label>
233
- <input type="checkbox" checked="checked" class="js-toggle-row" />
234
- </label>
235
- </div>
236
- </td>
237
- <td>Selected row</td>
238
- </tr>
239
- <tr>
240
- <td class="selectable-row">
241
- <div class="relative">
242
- <label>
243
- <input type="checkbox" class="js-toggle-row" />
244
- </label>
245
- </div>
246
- </td>
247
- <td>Typical row</td>
248
- </tr>
249
- </tbody>
250
- </table>
251
208
  </div>
252
209
  </div>
253
210
  <div class="row">
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "1.1.7"
2
+ VERSION = "1.2.0"
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.7
4
+ version: 1.2.0
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-11-06 00:00:00.000000000 Z
12
+ date: 2014-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -170,7 +170,6 @@ files:
170
170
  - app/assets/javascripts/govuk-admin-template/vendor/html5.js
171
171
  - app/assets/javascripts/govuk-admin-template/vendor/respond.min.js
172
172
  - app/assets/javascripts/govuk-admin-template/govuk-admin.js
173
- - app/assets/javascripts/govuk-admin-template/modules/selectable_table.js
174
173
  - app/assets/javascripts/govuk-admin-template/modules/filterable_table.js
175
174
  - app/assets/javascripts/govuk-admin-template/modules/fixed_table_header.js
176
175
  - app/assets/javascripts/govuk-admin-template/modules/auto_track_event.js
@@ -209,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
208
  version: '0'
210
209
  segments:
211
210
  - 0
212
- hash: 3294391031137274422
211
+ hash: -4369990551354532832
213
212
  requirements: []
214
213
  rubyforge_project:
215
214
  rubygems_version: 1.8.23.2
@@ -1,154 +0,0 @@
1
- (function(Modules) {
2
- "use strict";
3
-
4
- Modules.SelectableTable = function() {
5
-
6
- var that = this;
7
-
8
- that.start = function(element) {
9
-
10
- var tableRows = element.find('tbody tr'),
11
- SELECTED_ROW_CLASS = 'selected-row',
12
- RECENTLY_CHANGED_CLASS = 'js-most-recently-changed';
13
-
14
- element.on('click', '.js-toggle-row', toggleRow);
15
- element.on('click', '.js-toggle-all', toggleAllRows);
16
- element.on('click', '.js-submit-form', submitForm);
17
-
18
- element.on('ajax:success', 'form', createModal);
19
- element.on('ajax:error', 'form', handleModalError);
20
- element.on('ajax:complete','form', resetSubmitButtons);
21
-
22
- onLoadMarkSelectedRowsWithClass();
23
- updateHeaderToggleState();
24
-
25
- function onLoadMarkSelectedRowsWithClass() {
26
-
27
- var selectedRows = tableRows.find('.js-toggle-row:checked').parents('tr');
28
- selectedRows.addClass(SELECTED_ROW_CLASS);
29
-
30
- }
31
-
32
- function toggleRow(event) {
33
-
34
- var row = $(event.target).parents('tr');
35
-
36
- event.shiftKey ? shiftToggleRow(row) : row.toggleClass(SELECTED_ROW_CLASS);
37
-
38
- markRowAsRecentlyChanged(row);
39
- updateHeaderToggleState();
40
- }
41
-
42
- function updateHeaderToggleState() {
43
-
44
- var selectedRowsCount = tableRows.filter('.' + SELECTED_ROW_CLASS).length,
45
- inputHeader = element.find('.js-toggle-all');
46
-
47
- if (selectedRowsCount > 0 && selectedRowsCount < tableRows.length) {
48
- inputHeader.prop('indeterminate', true);
49
- inputHeader.prop('checked', false);
50
- resetSubmitButtons();
51
- } else if (selectedRowsCount === 0) {
52
- inputHeader.prop('checked', false);
53
- inputHeader.prop('indeterminate', false);
54
- disableSubmitButtons();
55
- } else {
56
- inputHeader.prop('checked', true);
57
- inputHeader.prop('indeterminate', false);
58
- resetSubmitButtons();
59
- }
60
-
61
- }
62
-
63
- function markRowAsRecentlyChanged(row) {
64
- tableRows.removeClass(RECENTLY_CHANGED_CLASS);
65
- row.addClass(RECENTLY_CHANGED_CLASS);
66
- }
67
-
68
- function shiftToggleRow(targetRow) {
69
-
70
- var targetIndex = tableRows.index(targetRow),
71
- targetState = targetRow.is('.' + SELECTED_ROW_CLASS),
72
- mostRecentlyChanged = tableRows.filter('.' + RECENTLY_CHANGED_CLASS),
73
- mostRecentlyChangedIndex = tableRows.index(mostRecentlyChanged),
74
- rows, range;
75
-
76
- // If we don't have a most recently changed, only toggle the current row
77
- if (mostRecentlyChangedIndex < 0) {
78
- mostRecentlyChangedIndex = targetIndex;
79
- }
80
-
81
- range = mostRecentlyChangedIndex < targetIndex ? [mostRecentlyChangedIndex, targetIndex + 1] : [targetIndex, mostRecentlyChangedIndex + 1];
82
- rows = tableRows.slice.apply(tableRows, range);
83
- toggleRows(rows, ! targetState);
84
-
85
- }
86
-
87
- function toggleAllRows(event) {
88
-
89
- var rows = element.find('tbody tr');
90
-
91
- // If everything selected
92
- if (tableRows.length == element.find('.' + SELECTED_ROW_CLASS).length) {
93
- toggleRows(rows, false);
94
- } else {
95
- toggleRows(rows, true);
96
- }
97
-
98
- updateHeaderToggleState();
99
- }
100
-
101
- function toggleRows(rows, select) {
102
- if (select) {
103
- rows.addClass(SELECTED_ROW_CLASS)
104
- } else {
105
- rows.removeClass(SELECTED_ROW_CLASS)
106
- }
107
- rows.find('input').prop('checked', select);
108
- }
109
-
110
- function submitForm(event) {
111
- var target = $(event.target),
112
- type = target.data('type');
113
-
114
- if (target.is('.disabled')) {
115
- event.preventDefault();
116
- return;
117
- }
118
-
119
- disableSubmitButtons();
120
- target.button('loading');
121
-
122
- element.find('input[type="radio"][value="' + type + '"]').prop('checked', true);
123
- element.find('form').submit();
124
- event.preventDefault();
125
- }
126
-
127
- function createModal(event, html, status) {
128
- var modal = $(html);
129
-
130
- $('body').append(modal);
131
-
132
- modal.modal('show').on('hidden.bs.modal', function () {
133
- modal.remove();
134
- });
135
-
136
- GOVUKAdmin.start(modal);
137
- }
138
-
139
- function handleModalError(xhr, status, error) {
140
- alert('There was a problem loading this. Please try again.');
141
- }
142
-
143
- function resetSubmitButtons() {
144
- element.find('.js-submit-form').removeClass('disabled').button('reset');
145
- element.find('.js-submit-container').addClass('buttons-enabled');
146
- }
147
-
148
- function disableSubmitButtons() {
149
- element.find('.js-submit-form').addClass('disabled');
150
- element.find('.js-submit-container').removeClass('buttons-enabled');
151
- }
152
- }
153
- };
154
- })(window.GOVUKAdmin.Modules);