manage 1.3.16 → 1.3.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/manage/application.js +5 -0
- data/app/assets/javascripts/manage/collection_actions.js.coffee +28 -0
- data/app/assets/javascripts/manage/custom.js.coffee +0 -0
- data/app/assets/javascripts/manage/handlers.js.coffee +46 -0
- data/app/assets/javascripts/manage/table_checkboxes.js.coffee +12 -0
- data/app/views/manage/resource/index/_collection_actions.html.slim +1 -1
- data/lib/manage/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fd80e9d3d9ab5d861f685a5d6934a301657cfb0
|
4
|
+
data.tar.gz: 42d1059cd76b1f9dcb0982aaba39240d87eb4cf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3bb285c64acf2249e6bd585ca1fb23a1c4dfdb7f9f88177535949d22c0aa9ee2e19285dbee8e3e38548bfe9724ce12a13c8f5e5af0abe0e0d1c560e32b258e
|
7
|
+
data.tar.gz: f769cc66a9adefc10a78073c24a78d1114a0ef8fc3caf2aa5199e2695dfabc0806b38264e0d4ee39d74558b99bc1241f9153e3f2531ff6fef6d8e713a6e6b128
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class CollectionActions
|
2
|
+
constructor: (el) ->
|
3
|
+
$el = $(el)
|
4
|
+
|
5
|
+
$el.on 'click', 'a', (e) ->
|
6
|
+
e.stopPropagation()
|
7
|
+
e.preventDefault()
|
8
|
+
|
9
|
+
url = $(@).attr('href')
|
10
|
+
requestType = $(@).data('method')
|
11
|
+
|
12
|
+
# TODO : fetch search form params
|
13
|
+
dataParams = []
|
14
|
+
$('.rs:checked').each ->
|
15
|
+
dataParams.push($(@).attr('value'))
|
16
|
+
|
17
|
+
if dataParams.length == 0
|
18
|
+
alert 'Няма направвен избор'
|
19
|
+
return false
|
20
|
+
|
21
|
+
$.ajax(
|
22
|
+
url: url
|
23
|
+
type: requestType
|
24
|
+
data: { selected_ids: dataParams }
|
25
|
+
).fail ->
|
26
|
+
alert('Възникна грешка')
|
27
|
+
|
28
|
+
Handlers.register 'CollectionActions', CollectionActions
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class @Handlers
|
2
|
+
@handlers = {}
|
3
|
+
|
4
|
+
@register: (handler, registeredClass) ->
|
5
|
+
throw "No constructor on " + handler unless registeredClass.constructor
|
6
|
+
@handlers[handler] = registeredClass
|
7
|
+
|
8
|
+
@instantiate: (handlers, element) ->
|
9
|
+
handlers = handlers.replace(/\s/g, '').split(',')
|
10
|
+
element.handlers = []
|
11
|
+
$.each handlers, (index, handler) =>
|
12
|
+
if @handlers[handler]
|
13
|
+
instance = new @handlers[handler](element)
|
14
|
+
element.handlers.push instance
|
15
|
+
else
|
16
|
+
throw "Unknown handler " + handler
|
17
|
+
|
18
|
+
@destroy: (instances) ->
|
19
|
+
$.each instances, (index, instance) ->
|
20
|
+
instance.destroy() if instance.destroy
|
21
|
+
|
22
|
+
@unregisterAll: ->
|
23
|
+
@handlers = {}
|
24
|
+
|
25
|
+
$(document).on 'handlers:pageChanged', ->
|
26
|
+
$('[data-handler]').each ->
|
27
|
+
Handlers.instantiate $(this).attr('data-handler'), this
|
28
|
+
|
29
|
+
$(document).on 'handlers:pageUpdated', (event, scope) ->
|
30
|
+
$(scope).find('[data-handler]').each ->
|
31
|
+
Handlers.instantiate $(this).attr('data-handler'), this
|
32
|
+
|
33
|
+
$(document).on 'handlers:pageUpdating', (event, scope) ->
|
34
|
+
$(scope).find('[data-handler]').each ->
|
35
|
+
Handlers.destroy @handlers if @handlers
|
36
|
+
delete @handlers if @handlers
|
37
|
+
|
38
|
+
if typeof(Turbolinks) != undefined
|
39
|
+
$(document).on 'page:fetch', ->
|
40
|
+
$(document).trigger 'handlers:pageUpdating', 'body'
|
41
|
+
|
42
|
+
$(document).on 'page:change', ->
|
43
|
+
$(document).trigger 'handlers:pageUpdated', 'body'
|
44
|
+
|
45
|
+
$ ->
|
46
|
+
$(document).trigger 'handlers:pageChanged'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class TableCheckboxes
|
2
|
+
constructor: (el) ->
|
3
|
+
$el = $(el)
|
4
|
+
$mainContainer = $el.closest('table')
|
5
|
+
|
6
|
+
$el.on 'click', (event, element)->
|
7
|
+
check = if $el.is(':checked') then true else false
|
8
|
+
|
9
|
+
$mainContainer.find('.rs').each ->
|
10
|
+
$(@).prop('checked', check)
|
11
|
+
|
12
|
+
Handlers.register 'TableCheckboxes', TableCheckboxes
|
data/lib/manage/version.rb
CHANGED
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.
|
4
|
+
version: 1.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Empower United
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -272,7 +272,11 @@ files:
|
|
272
272
|
- app/views/manage/sessions/new.html.slim
|
273
273
|
- app/views/manage/admin_users/_form.html.slim
|
274
274
|
- app/models/admin_user.rb
|
275
|
+
- app/assets/javascripts/manage/collection_actions.js.coffee
|
276
|
+
- app/assets/javascripts/manage/handlers.js.coffee
|
277
|
+
- app/assets/javascripts/manage/custom.js.coffee
|
275
278
|
- app/assets/javascripts/manage/application.js
|
279
|
+
- app/assets/javascripts/manage/table_checkboxes.js.coffee
|
276
280
|
- app/assets/javascripts/manage/init.js.coffee
|
277
281
|
- app/assets/stylesheets/manage/application.css.scss
|
278
282
|
- app/assets/stylesheets/manage/custom.css.scss
|