manage 1.3.17 → 1.3.18

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: 5fd80e9d3d9ab5d861f685a5d6934a301657cfb0
4
- data.tar.gz: 42d1059cd76b1f9dcb0982aaba39240d87eb4cf0
3
+ metadata.gz: cbf1333fe8d95a22e52efbeb8fdd8d94aa6c9929
4
+ data.tar.gz: dd7f64df279e0c6b72b829d0353828a0e1aa4d47
5
5
  SHA512:
6
- metadata.gz: 7a3bb285c64acf2249e6bd585ca1fb23a1c4dfdb7f9f88177535949d22c0aa9ee2e19285dbee8e3e38548bfe9724ce12a13c8f5e5af0abe0e0d1c560e32b258e
7
- data.tar.gz: f769cc66a9adefc10a78073c24a78d1114a0ef8fc3caf2aa5199e2695dfabc0806b38264e0d4ee39d74558b99bc1241f9153e3f2531ff6fef6d8e713a6e6b128
6
+ metadata.gz: 77e331d86392ffbee92787ee73157a7ff282440902049b5bf386e6fd63af2d1253577b9071e88f05232e5e3ecee2b12d0517deb1ef2ff4b084eac50c22920db5
7
+ data.tar.gz: f95544838d8d9ec9cb4515eb5f405271ded04e7651e532031a7974a00a5aa35f81dfff14827ddc1d6cad51d7faefa6158cba67462168c0a6c4e111d155090306
@@ -42,7 +42,7 @@ Create controller in your application yourapp/app/controllers/manage/cities_cont
42
42
  # optional
43
43
  def collection_actions collection
44
44
  [
45
- view_context.link_to(t('manage.views.winners.export_as_bank_file'), [:export_as_bank_file, resource_class], method: :post, class: 'button')
45
+ view_context.button_to(t('manage.views.winners.export_as_bank_file'), [:export_as_bank_file, resource_class], method: :post, data: {handler: 'CollectionActions'}, class: 'button')
46
46
  ].join('').html_safe
47
47
  end
48
48
 
@@ -2,27 +2,29 @@ class CollectionActions
2
2
  constructor: (el) ->
3
3
  $el = $(el)
4
4
 
5
- $el.on 'click', 'a', (e) ->
5
+ $form = $el.closest('form')
6
+
7
+ $el.on 'click', (e) ->
6
8
  e.stopPropagation()
7
9
  e.preventDefault()
8
10
 
9
- url = $(@).attr('href')
10
- requestType = $(@).data('method')
11
+ checkedCheckboxes = $('.rs:checked')
12
+ unless checkedCheckboxes.length
13
+ alert 'Select Items'
14
+ return false
15
+
16
+ # clear all hidden fields with class .hidden_selected_ids
17
+ $form.find('input[type="hidden"]').remove()
11
18
 
12
- # TODO : fetch search form params
13
- dataParams = []
14
- $('.rs:checked').each ->
15
- dataParams.push($(@).attr('value'))
19
+ checkedCheckboxes.each ->
20
+ # create a new hidden
21
+ hidden_input = $('<input>').attr({
22
+ type: 'hidden',
23
+ name: 'selected_ids[]',
24
+ value: $(@).val()
25
+ }).appendTo($form)
16
26
 
17
- if dataParams.length == 0
18
- alert 'Няма направвен избор'
19
- return false
27
+ $form.submit()
20
28
 
21
- $.ajax(
22
- url: url
23
- type: requestType
24
- data: { selected_ids: dataParams }
25
- ).fail ->
26
- alert('Възникна грешка')
27
29
 
28
30
  Handlers.register 'CollectionActions', CollectionActions
@@ -1,3 +1,3 @@
1
1
  - if collection.count > 0 and collection_actions(collection).present?
2
- .panel.collection_actions data-handler='CollectionActions'
2
+ .panel.collection_actions
3
3
  = collection_actions(collection)
@@ -1,3 +1,3 @@
1
1
  module Manage
2
- VERSION = "1.3.17"
2
+ VERSION = "1.3.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.17
4
+ version: 1.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Empower United