rails_admin_toggleable 0.7.1 → 0.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: 8a9fd801d9ebdbc4149d8ae8e3d3e9bd8ea730c5
4
- data.tar.gz: ad222d22285625d77cc8ddbb83d810eb5ba9a900
3
+ metadata.gz: d7f78b2ecaa7d7f9dc2d92a7c77670300ed91aed
4
+ data.tar.gz: b5d52fe6de375db85a94737aaa24a7ee89067528
5
5
  SHA512:
6
- metadata.gz: 84ebef932b34a2b415861d988bf0bcaa60cd3f532aa745a2789d020a74d477e2399bd3ddd531eae7eb5ed63028abe1c7b659d1d24d8f4a64af3905cb1751af11
7
- data.tar.gz: d6d1a1c970a862db6e34264c25c7d5c7a0133059a0e60ad1038225d21b64272dffc98e553541636caf33636e02b00867020375cfdaded7930a82292405626021
6
+ metadata.gz: 2b4af91a34af534992fdd5729c5f6e0132ed10378b03b703f0e394aa106fe48c97bb80d519eaa90c22798f6b4c5e85dbb227e7de89ae089867a3cfd9f1384180
7
+ data.tar.gz: 6612d51c2cdc8d5d5287319822d42a2ed0702a85c7cf3fcf49f88bf81642d65d1c9fc39893202189aff746d4e29ee3255613af8ea42433ac534560c87825846d
@@ -1,156 +1,176 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_admin_toggleable (0.7.1)
4
+ rails_admin_toggleable (0.8.0)
5
5
  rails_admin
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (4.2.6)
11
- actionpack (= 4.2.6)
12
- actionview (= 4.2.6)
13
- activejob (= 4.2.6)
10
+ actioncable (5.1.3)
11
+ actionpack (= 5.1.3)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.1.3)
15
+ actionpack (= 5.1.3)
16
+ actionview (= 5.1.3)
17
+ activejob (= 5.1.3)
14
18
  mail (~> 2.5, >= 2.5.4)
15
- rails-dom-testing (~> 1.0, >= 1.0.5)
16
- actionpack (4.2.6)
17
- actionview (= 4.2.6)
18
- activesupport (= 4.2.6)
19
- rack (~> 1.6)
20
- rack-test (~> 0.6.2)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.1.3)
21
+ actionview (= 5.1.3)
22
+ activesupport (= 5.1.3)
23
+ rack (~> 2.0)
24
+ rack-test (~> 0.6.3)
25
+ rails-dom-testing (~> 2.0)
22
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- actionview (4.2.6)
24
- activesupport (= 4.2.6)
27
+ actionview (5.1.3)
28
+ activesupport (= 5.1.3)
25
29
  builder (~> 3.1)
26
- erubis (~> 2.7.0)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- activejob (4.2.6)
30
- activesupport (= 4.2.6)
31
- globalid (>= 0.3.0)
32
- activemodel (4.2.6)
33
- activesupport (= 4.2.6)
34
- builder (~> 3.1)
35
- activerecord (4.2.6)
36
- activemodel (= 4.2.6)
37
- activesupport (= 4.2.6)
38
- arel (~> 6.0)
39
- activesupport (4.2.6)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.1.3)
34
+ activesupport (= 5.1.3)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.1.3)
37
+ activesupport (= 5.1.3)
38
+ activerecord (5.1.3)
39
+ activemodel (= 5.1.3)
40
+ activesupport (= 5.1.3)
41
+ arel (~> 8.0)
42
+ activesupport (5.1.3)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
40
44
  i18n (~> 0.7)
41
- json (~> 1.7, >= 1.7.7)
42
45
  minitest (~> 5.1)
43
- thread_safe (~> 0.3, >= 0.3.4)
44
46
  tzinfo (~> 1.1)
45
- arel (6.0.3)
46
- builder (3.2.2)
47
- coffee-rails (4.1.1)
47
+ arel (8.0.0)
48
+ builder (3.2.3)
49
+ coffee-rails (4.2.2)
48
50
  coffee-script (>= 2.2.0)
49
- railties (>= 4.0.0, < 5.1.x)
51
+ railties (>= 4.0.0)
50
52
  coffee-script (2.4.1)
51
53
  coffee-script-source
52
54
  execjs
53
- coffee-script-source (1.10.0)
54
- concurrent-ruby (1.0.2)
55
- erubis (2.7.0)
55
+ coffee-script-source (1.12.2)
56
+ concurrent-ruby (1.0.5)
57
+ erubi (1.6.1)
56
58
  execjs (2.7.0)
57
- font-awesome-rails (4.6.3.0)
58
- railties (>= 3.2, < 5.1)
59
- globalid (0.3.6)
60
- activesupport (>= 4.1.0)
61
- haml (4.0.7)
59
+ ffi (1.9.18)
60
+ font-awesome-rails (4.7.0.2)
61
+ railties (>= 3.2, < 5.2)
62
+ globalid (0.4.0)
63
+ activesupport (>= 4.2.0)
64
+ haml (5.0.2)
65
+ temple (>= 0.8.0)
62
66
  tilt
63
- i18n (0.7.0)
64
- jquery-rails (4.1.1)
67
+ i18n (0.8.6)
68
+ jquery-rails (4.3.1)
65
69
  rails-dom-testing (>= 1, < 3)
66
70
  railties (>= 4.2.0)
67
71
  thor (>= 0.14, < 2.0)
68
72
  jquery-ui-rails (5.0.5)
69
73
  railties (>= 3.2.16)
70
- json (1.8.3)
71
- kaminari (0.17.0)
72
- actionpack (>= 3.0.0)
73
- activesupport (>= 3.0.0)
74
+ kaminari (1.0.1)
75
+ activesupport (>= 4.1.0)
76
+ kaminari-actionview (= 1.0.1)
77
+ kaminari-activerecord (= 1.0.1)
78
+ kaminari-core (= 1.0.1)
79
+ kaminari-actionview (1.0.1)
80
+ actionview
81
+ kaminari-core (= 1.0.1)
82
+ kaminari-activerecord (1.0.1)
83
+ activerecord
84
+ kaminari-core (= 1.0.1)
85
+ kaminari-core (1.0.1)
74
86
  loofah (2.0.3)
75
87
  nokogiri (>= 1.5.9)
76
- mail (2.6.4)
88
+ mail (2.6.6)
77
89
  mime-types (>= 1.16, < 4)
90
+ method_source (0.8.2)
78
91
  mime-types (3.1)
79
92
  mime-types-data (~> 3.2015)
80
93
  mime-types-data (3.2016.0521)
81
- mini_portile2 (2.1.0)
82
- minitest (5.9.0)
94
+ mini_portile2 (2.2.0)
95
+ minitest (5.10.3)
83
96
  nested_form (0.3.2)
84
- nokogiri (1.6.8)
85
- mini_portile2 (~> 2.1.0)
86
- pkg-config (~> 1.1.7)
87
- pkg-config (1.1.7)
88
- rack (1.6.4)
89
- rack-pjax (0.8.0)
97
+ nio4r (2.1.0)
98
+ nokogiri (1.8.0)
99
+ mini_portile2 (~> 2.2.0)
100
+ rack (2.0.3)
101
+ rack-pjax (1.0.0)
90
102
  nokogiri (~> 1.5)
91
- rack (~> 1.1)
103
+ rack (>= 1.1)
92
104
  rack-test (0.6.3)
93
105
  rack (>= 1.0)
94
- rails (4.2.6)
95
- actionmailer (= 4.2.6)
96
- actionpack (= 4.2.6)
97
- actionview (= 4.2.6)
98
- activejob (= 4.2.6)
99
- activemodel (= 4.2.6)
100
- activerecord (= 4.2.6)
101
- activesupport (= 4.2.6)
102
- bundler (>= 1.3.0, < 2.0)
103
- railties (= 4.2.6)
104
- sprockets-rails
105
- rails-deprecated_sanitizer (1.0.3)
106
- activesupport (>= 4.2.0.alpha)
107
- rails-dom-testing (1.0.7)
108
- activesupport (>= 4.2.0.beta, < 5.0)
109
- nokogiri (~> 1.6.0)
110
- rails-deprecated_sanitizer (>= 1.0.1)
106
+ rails (5.1.3)
107
+ actioncable (= 5.1.3)
108
+ actionmailer (= 5.1.3)
109
+ actionpack (= 5.1.3)
110
+ actionview (= 5.1.3)
111
+ activejob (= 5.1.3)
112
+ activemodel (= 5.1.3)
113
+ activerecord (= 5.1.3)
114
+ activesupport (= 5.1.3)
115
+ bundler (>= 1.3.0)
116
+ railties (= 5.1.3)
117
+ sprockets-rails (>= 2.0.0)
118
+ rails-dom-testing (2.0.3)
119
+ activesupport (>= 4.2.0)
120
+ nokogiri (>= 1.6)
111
121
  rails-html-sanitizer (1.0.3)
112
122
  loofah (~> 2.0)
113
- rails_admin (0.8.1)
123
+ rails_admin (1.2.0)
114
124
  builder (~> 3.1)
115
125
  coffee-rails (~> 4.0)
116
126
  font-awesome-rails (>= 3.0, < 5)
117
- haml (~> 4.0)
127
+ haml (>= 4.0, < 6)
118
128
  jquery-rails (>= 3.0, < 5)
119
129
  jquery-ui-rails (~> 5.0)
120
- kaminari (~> 0.14)
130
+ kaminari (>= 0.14, < 2.0)
121
131
  nested_form (~> 0.3)
122
- rack-pjax (~> 0.7)
123
- rails (~> 4.0)
124
- remotipart (~> 1.0)
125
- safe_yaml (~> 1.0)
132
+ rack-pjax (>= 0.7)
133
+ rails (>= 4.0, < 6)
134
+ remotipart (~> 1.3)
126
135
  sass-rails (>= 4.0, < 6)
127
- railties (4.2.6)
128
- actionpack (= 4.2.6)
129
- activesupport (= 4.2.6)
136
+ railties (5.1.3)
137
+ actionpack (= 5.1.3)
138
+ activesupport (= 5.1.3)
139
+ method_source
130
140
  rake (>= 0.8.7)
131
141
  thor (>= 0.18.1, < 2.0)
132
- rake (11.2.2)
133
- remotipart (1.2.1)
134
- safe_yaml (1.0.4)
135
- sass (3.4.22)
136
- sass-rails (5.0.4)
137
- railties (>= 4.0.0, < 5.0)
142
+ rake (12.0.0)
143
+ rb-fsevent (0.10.2)
144
+ rb-inotify (0.9.10)
145
+ ffi (>= 0.5.0, < 2)
146
+ remotipart (1.3.1)
147
+ sass (3.5.1)
148
+ sass-listen (~> 4.0.0)
149
+ sass-listen (4.0.0)
150
+ rb-fsevent (~> 0.9, >= 0.9.4)
151
+ rb-inotify (~> 0.9, >= 0.9.7)
152
+ sass-rails (5.0.6)
153
+ railties (>= 4.0.0, < 6)
138
154
  sass (~> 3.1)
139
155
  sprockets (>= 2.8, < 4.0)
140
156
  sprockets-rails (>= 2.0, < 4.0)
141
157
  tilt (>= 1.1, < 3)
142
- sprockets (3.6.2)
158
+ sprockets (3.7.1)
143
159
  concurrent-ruby (~> 1.0)
144
160
  rack (> 1, < 3)
145
- sprockets-rails (3.0.4)
161
+ sprockets-rails (3.2.0)
146
162
  actionpack (>= 4.0)
147
163
  activesupport (>= 4.0)
148
164
  sprockets (>= 3.0.0)
149
- thor (0.19.1)
150
- thread_safe (0.3.5)
151
- tilt (2.0.5)
152
- tzinfo (1.2.2)
165
+ temple (0.8.0)
166
+ thor (0.19.4)
167
+ thread_safe (0.3.6)
168
+ tilt (2.0.8)
169
+ tzinfo (1.2.3)
153
170
  thread_safe (~> 0.1)
171
+ websocket-driver (0.6.5)
172
+ websocket-extensions (>= 0.1.0)
173
+ websocket-extensions (0.1.2)
154
174
 
155
175
  PLATFORMS
156
176
  ruby
@@ -161,4 +181,4 @@ DEPENDENCIES
161
181
  rake
162
182
 
163
183
  BUNDLED WITH
164
- 1.12.5
184
+ 1.15.3
@@ -20,4 +20,4 @@ ru:
20
20
  disabled: '"%{attr}" выключен'
21
21
  error: "Ошибка: %{err}"
22
22
  no_id: "Не указан ID"
23
-
23
+
@@ -30,7 +30,7 @@ module RailsAdmin
30
30
  end
31
31
  if params['id'].present?
32
32
  begin
33
- @object = @abstract_model.model.unscoped.find(params['id'])
33
+ @object = @abstract_model.model.unscoped.lock.find(params['id'])
34
34
  @meth = params[:method]
35
35
  @object.send(@meth + '=', params[:on] == '1' ? true : false)
36
36
  if @object.save
@@ -18,6 +18,10 @@ module RailsAdmin
18
18
  :boolean
19
19
  end
20
20
 
21
+ register_instance_option :ajax do
22
+ true
23
+ end
24
+
21
25
  register_instance_option :pretty_value do
22
26
  def g_js
23
27
  <<-END.strip_heredoc.gsub("\n", ' ').gsub(/ +/, ' ')
@@ -41,13 +45,21 @@ module RailsAdmin
41
45
  return false;
42
46
  END
43
47
  end
48
+
44
49
  def g_link(fv, on, badge)
50
+ options = { class: 'toggle-btn label ' + badge }
51
+
52
+ if self.ajax
53
+ options[:onclick] = g_js
54
+ else
55
+ options[:method] = :post
56
+ options[:onclick] = "$(this).html(\"<i class='fa fa-spinner fa-spin'></i>\");"
57
+ end
58
+
45
59
  bindings[:view].link_to(
46
60
  fv.html_safe,
47
- toggle_path(model_name: @abstract_model, id: bindings[:object].id, method: name, on: on.to_s),
48
- # method: :post,
49
- class: 'toggle-btn label ' + badge,
50
- onclick: g_js
61
+ bindings[:view].toggle_path(model_name: @abstract_model, id: bindings[:object].id, method: name, on: on.to_s),
62
+ options
51
63
  )
52
64
  end
53
65
 
@@ -1,3 +1,3 @@
1
1
  module RailsAdminToggleable
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
-
19
+
20
20
  gem.add_dependency "rails_admin"
21
21
 
22
22
  gem.add_development_dependency "bundler"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_toggleable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails_admin
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.5.1
98
+ rubygems_version: 2.6.11
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Make any boolean field easily toggleable on\off from index view in rails