active_list 6.7.6 → 6.8.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: 815f482bc266005ec9cdbfa4ff5c367accfe0584
4
- data.tar.gz: f6c0eebe102fe9bd5b04fa59cae72da00eebc7a0
3
+ metadata.gz: 675ea8ac7abb522168fc6c75a163f3231870ee3a
4
+ data.tar.gz: 205969fb627d1b2e2bc2541940d75fb9a0b2426c
5
5
  SHA512:
6
- metadata.gz: 91f2a45ad3038fb083a1debad255fa078e68c920e958253f1198b5313a1ffb2515b8ceefab72d97019437f9df0c4b04068cf840732c7ad12190eb9a56563f4ab
7
- data.tar.gz: afa39ea6e18c872ac04966af88a65c7c8e03ea2dd3dadac11a9f12ef8bd9bc4ec06d76c9a68860fe8286109d28cc05ca0ffd81f5d560816487ddd86412942a10
6
+ metadata.gz: c7d903bdf0235f855621d0c421dda0b6f6d34ae8612c4d2e3c05c4db2b9227fef2a71f34265f38b617505b8ad003a78fbf19926a6dc53b37f072ee7ef247fa80
7
+ data.tar.gz: cd58bbd9e14793ba3231ee5127c9171082a1206c57f92b81b17379af7242349b9fc9ede02e2b79fad5d67005ae5364dedd8b5fbb7ea7f99a7bd36fb32eb3d8f6
@@ -119,11 +119,16 @@ ActiveList = {}
119
119
  selection = list.prop('selection')
120
120
  list_id = list.attr('id')
121
121
  actions = $("*[data-list-ref='#{list_id}']")
122
- if Object.keys(selection).length > 0
122
+ caption = $(list).find("caption")
123
+ length = Object.keys(selection).length
124
+ caption.text(caption.text().replace(new RegExp('(##NUM##|\\d+)'), length))
125
+ if length > 0
126
+ caption.show()
123
127
  actions.find("*[data-list-actioner='none']:visible").hide()
124
128
  actions.find("*[data-list-actioner='none']:visible").hide()
125
129
  actions.find("*[data-list-actioner='many']:hidden").show()
126
130
  else
131
+ caption.hide()
127
132
  actions.find("*[data-list-actioner='none']:hidden").show()
128
133
  actions.find("*[data-list-actioner='many']:visible").hide()
129
134
  actions.find("*[data-list-actioner='many']").each (index) ->
@@ -142,6 +147,9 @@ ActiveList = {}
142
147
  page: page
143
148
  false
144
149
 
150
+ $(document).on "load", "*[data-list-source]", (event) ->
151
+ AL.refresh $(this)
152
+
145
153
  # Sort by one column
146
154
  $(document).on "click", "*[data-list-source] th[data-list-column][data-list-column-sort]", (event) ->
147
155
  sorter = $(this)
@@ -151,9 +159,8 @@ ActiveList = {}
151
159
  dir: sorter.data("list-column-sort")
152
160
  false
153
161
 
154
-
155
162
  # Select row
156
- $(document).on "click", "*[data-list-source] input[data-list-selector]", (event) ->
163
+ $(document).on "click", "*[data-list-source] td>input[data-list-selector]", (event) ->
157
164
  AL.select $(this)
158
165
  true
159
166
 
@@ -164,7 +171,6 @@ ActiveList = {}
164
171
  element.attr "title", element.html() unless title?
165
172
  return
166
173
 
167
-
168
174
  # Change number of item per page
169
175
  $(document).on "click", "*[data-list-ref] *[data-list-change-page-size]", (event) ->
170
176
  sizer = $(this)
@@ -173,6 +179,9 @@ ActiveList = {}
173
179
  console.error "@list-change-page-size attribute is not a number: #{per_page}"
174
180
  else
175
181
  list = $("##{sizer.closest('*[data-list-ref]').data('list-ref')}")
182
+ list.prop('selection', {})
183
+ AL.updateResults list
184
+ AL.checkGlobalButtons list
176
185
  AL.refresh list,
177
186
  per_page: per_page
178
187
  false
@@ -207,6 +216,11 @@ ActiveList = {}
207
216
  column: columnId
208
217
  false
209
218
 
219
+ $(document).on "change", "input[data-list-selector=all]", (event) ->
220
+ check = $(this).is(':checked')
221
+ $(this).closest("table").find("td > input[data-list-selector]:not(:checked)").click() if check
222
+ $(this).closest("table").find("td > input[data-list-selector]:checked").click() unless check
223
+
210
224
  # Change page of table on link clicks
211
225
  $(document).on "click", "*[data-list-ref] a[data-list-move-to-page]", (event) ->
212
226
  pager = $(this)
@@ -1,5 +1,7 @@
1
1
  en: &en
2
2
  list:
3
+ columns: "Columns"
4
+ selected: "##NUM## selected item(s)."
3
5
  results:
4
6
  sum: "Total"
5
7
  average: "Average"
@@ -1,6 +1,7 @@
1
1
  fr: &fr
2
2
  list:
3
3
  columns: "Colonnes"
4
+ selected: "##NUM## élément(s) selectionné(s)."
4
5
  results:
5
6
  sum: "Total"
6
7
  average: "Moyenne"
@@ -294,7 +294,10 @@ module ActiveList
294
294
  def header_code
295
295
  code = ''
296
296
  code << "'<thead><tr>"
297
- code << '<th class="list-selector"></th>' if table.selectable?
297
+ if table.selectable?
298
+ code << '<th class="list-selector"><input type="checkbox" data-list-selector="all" /></th>'
299
+ disclaimer = '<caption>\'+ "list.selected".t + \'</caption>'
300
+ end
298
301
  table.columns.each do |column|
299
302
  next if column.is_a?(ActiveList::Definition::ActionColumn) && !column.use_single?
300
303
  code << "<th data-list-column=\"#{column.sort_id}\""
@@ -312,7 +315,9 @@ module ActiveList
312
315
  code << '</th>'
313
316
  end
314
317
  # code << "<th class=\"spe\">#{menu_code}</th>"
315
- code << "</tr></thead>'"
318
+ code << '</tr></thead>'
319
+ code << (disclaimer || '')
320
+ code << "'"
316
321
  code
317
322
  end
318
323
 
@@ -1,3 +1,3 @@
1
1
  module ActiveList
2
- VERSION = '6.7.6'.freeze
2
+ VERSION = '6.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.6
4
+ version: 6.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Texier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails