rails_admin_toggleable 0.5.1 → 0.6.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: 4ada385843f5e0f63f7cf5d8ad1535bc136dd3ef
4
- data.tar.gz: 556740753ad8c713a848c665b2b4011010580fae
3
+ metadata.gz: beb4b2a152d97c6bfe53fc5e12f777007d6adf0d
4
+ data.tar.gz: 2ed2989759b75fa25936138073b1baf69b4f9f83
5
5
  SHA512:
6
- metadata.gz: d48e1185aff20ffc6ada4b4a4c9bf3fbd79c7f9f911826f6d35fb1d8b0687a2fb3fa9218581a1e74948f58902a9c9dbaca4c215dc379a7d4a19187ae631764a6
7
- data.tar.gz: e27c5282ac6ab8a1a251cc5defdcba3e8098dffc6de88eb1fd7ea647e3884f67b1ddd9abab8455c4a511c2d376c15f79de89fa27be7cb0ad4c9ff36fd92ffb25
6
+ metadata.gz: d21adbd9a6d5e2efbfcfc14aef0a41335e095edb88c7528ddabb77f4ba3f79fa38c0570ef19917bb9e22c1a8da38531f5c7508b3ff98704608e3c02747b2319f
7
+ data.tar.gz: 62f7ff687f39a05572f0c6bd49656c8ae4444776f6b17060eb36e270f2a8fbe66143312267d26143941f195ca42598bfe8285a88f4788f687aab78e2257f56ee
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails_admin', github: 'sferik/rails_admin'
4
-
5
3
  # Specify your gem's dependencies in rails_admin_toggleable.gemspec
6
4
  gemspec
@@ -1,85 +1,67 @@
1
- GIT
2
- remote: git://github.com/sferik/rails_admin.git
3
- revision: 5aafa20156439309ce013bcfbaf4120bd03d7cca
4
- specs:
5
- rails_admin (1.0.0.beta)
6
- builder (~> 3.1)
7
- coffee-rails (~> 4.0)
8
- font-awesome-rails (>= 3.0, < 5)
9
- haml (~> 4.0)
10
- jquery-rails (>= 3.0, < 5)
11
- jquery-ui-rails (~> 5.0)
12
- kaminari (~> 0.14)
13
- nested_form (~> 0.3)
14
- rack-pjax (~> 0.7)
15
- rails (~> 4.0)
16
- remotipart (~> 1.0)
17
- safe_yaml (~> 1.0)
18
- sass-rails (>= 4.0, < 6)
19
-
20
1
  PATH
21
2
  remote: .
22
3
  specs:
23
- rails_admin_toggleable (0.5.1)
4
+ rails_admin_toggleable (0.6.0)
24
5
  rails_admin
25
6
 
26
7
  GEM
27
8
  remote: https://rubygems.org/
28
9
  specs:
29
- actionmailer (4.2.3)
30
- actionpack (= 4.2.3)
31
- actionview (= 4.2.3)
32
- activejob (= 4.2.3)
10
+ actionmailer (4.2.5)
11
+ actionpack (= 4.2.5)
12
+ actionview (= 4.2.5)
13
+ activejob (= 4.2.5)
33
14
  mail (~> 2.5, >= 2.5.4)
34
15
  rails-dom-testing (~> 1.0, >= 1.0.5)
35
- actionpack (4.2.3)
36
- actionview (= 4.2.3)
37
- activesupport (= 4.2.3)
16
+ actionpack (4.2.5)
17
+ actionview (= 4.2.5)
18
+ activesupport (= 4.2.5)
38
19
  rack (~> 1.6)
39
20
  rack-test (~> 0.6.2)
40
21
  rails-dom-testing (~> 1.0, >= 1.0.5)
41
22
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
42
- actionview (4.2.3)
43
- activesupport (= 4.2.3)
23
+ actionview (4.2.5)
24
+ activesupport (= 4.2.5)
44
25
  builder (~> 3.1)
45
26
  erubis (~> 2.7.0)
46
27
  rails-dom-testing (~> 1.0, >= 1.0.5)
47
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
48
- activejob (4.2.3)
49
- activesupport (= 4.2.3)
29
+ activejob (4.2.5)
30
+ activesupport (= 4.2.5)
50
31
  globalid (>= 0.3.0)
51
- activemodel (4.2.3)
52
- activesupport (= 4.2.3)
32
+ activemodel (4.2.5)
33
+ activesupport (= 4.2.5)
53
34
  builder (~> 3.1)
54
- activerecord (4.2.3)
55
- activemodel (= 4.2.3)
56
- activesupport (= 4.2.3)
35
+ activerecord (4.2.5)
36
+ activemodel (= 4.2.5)
37
+ activesupport (= 4.2.5)
57
38
  arel (~> 6.0)
58
- activesupport (4.2.3)
39
+ activesupport (4.2.5)
59
40
  i18n (~> 0.7)
60
41
  json (~> 1.7, >= 1.7.7)
61
42
  minitest (~> 5.1)
62
43
  thread_safe (~> 0.3, >= 0.3.4)
63
44
  tzinfo (~> 1.1)
64
- arel (6.0.2)
45
+ arel (6.0.3)
65
46
  builder (3.2.2)
66
- coffee-rails (4.1.0)
47
+ coffee-rails (4.1.1)
67
48
  coffee-script (>= 2.2.0)
68
- railties (>= 4.0.0, < 5.0)
49
+ railties (>= 4.0.0, < 5.1.x)
69
50
  coffee-script (2.4.1)
70
51
  coffee-script-source
71
52
  execjs
72
- coffee-script-source (1.9.1.1)
53
+ coffee-script-source (1.10.0)
54
+ concurrent-ruby (1.0.0)
73
55
  erubis (2.7.0)
74
- execjs (2.5.2)
75
- font-awesome-rails (4.3.0.0)
56
+ execjs (2.6.0)
57
+ font-awesome-rails (4.5.0.0)
76
58
  railties (>= 3.2, < 5.0)
77
- globalid (0.3.5)
59
+ globalid (0.3.6)
78
60
  activesupport (>= 4.1.0)
79
- haml (4.0.6)
61
+ haml (4.0.7)
80
62
  tilt
81
63
  i18n (0.7.0)
82
- jquery-rails (4.0.4)
64
+ jquery-rails (4.0.5)
83
65
  rails-dom-testing (~> 1.0)
84
66
  railties (>= 4.2.0)
85
67
  thor (>= 0.14, < 2.0)
@@ -89,65 +71,80 @@ GEM
89
71
  kaminari (0.16.3)
90
72
  actionpack (>= 3.0.0)
91
73
  activesupport (>= 3.0.0)
92
- loofah (2.0.2)
74
+ loofah (2.0.3)
93
75
  nokogiri (>= 1.5.9)
94
76
  mail (2.6.3)
95
77
  mime-types (>= 1.16, < 3)
96
- mime-types (2.6.1)
97
- mini_portile (0.6.2)
98
- minitest (5.7.0)
78
+ mime-types (2.99)
79
+ mini_portile2 (2.0.0)
80
+ minitest (5.8.3)
99
81
  nested_form (0.3.2)
100
- nokogiri (1.6.6.2)
101
- mini_portile (~> 0.6.0)
82
+ nokogiri (1.6.7.1)
83
+ mini_portile2 (~> 2.0.0.rc2)
102
84
  rack (1.6.4)
103
85
  rack-pjax (0.8.0)
104
86
  nokogiri (~> 1.5)
105
87
  rack (~> 1.1)
106
88
  rack-test (0.6.3)
107
89
  rack (>= 1.0)
108
- rails (4.2.3)
109
- actionmailer (= 4.2.3)
110
- actionpack (= 4.2.3)
111
- actionview (= 4.2.3)
112
- activejob (= 4.2.3)
113
- activemodel (= 4.2.3)
114
- activerecord (= 4.2.3)
115
- activesupport (= 4.2.3)
90
+ rails (4.2.5)
91
+ actionmailer (= 4.2.5)
92
+ actionpack (= 4.2.5)
93
+ actionview (= 4.2.5)
94
+ activejob (= 4.2.5)
95
+ activemodel (= 4.2.5)
96
+ activerecord (= 4.2.5)
97
+ activesupport (= 4.2.5)
116
98
  bundler (>= 1.3.0, < 2.0)
117
- railties (= 4.2.3)
99
+ railties (= 4.2.5)
118
100
  sprockets-rails
119
101
  rails-deprecated_sanitizer (1.0.3)
120
102
  activesupport (>= 4.2.0.alpha)
121
- rails-dom-testing (1.0.6)
103
+ rails-dom-testing (1.0.7)
122
104
  activesupport (>= 4.2.0.beta, < 5.0)
123
105
  nokogiri (~> 1.6.0)
124
106
  rails-deprecated_sanitizer (>= 1.0.1)
125
107
  rails-html-sanitizer (1.0.2)
126
108
  loofah (~> 2.0)
127
- railties (4.2.3)
128
- actionpack (= 4.2.3)
129
- activesupport (= 4.2.3)
109
+ rails_admin (0.8.1)
110
+ builder (~> 3.1)
111
+ coffee-rails (~> 4.0)
112
+ font-awesome-rails (>= 3.0, < 5)
113
+ haml (~> 4.0)
114
+ jquery-rails (>= 3.0, < 5)
115
+ jquery-ui-rails (~> 5.0)
116
+ kaminari (~> 0.14)
117
+ nested_form (~> 0.3)
118
+ rack-pjax (~> 0.7)
119
+ rails (~> 4.0)
120
+ remotipart (~> 1.0)
121
+ safe_yaml (~> 1.0)
122
+ sass-rails (>= 4.0, < 6)
123
+ railties (4.2.5)
124
+ actionpack (= 4.2.5)
125
+ activesupport (= 4.2.5)
130
126
  rake (>= 0.8.7)
131
127
  thor (>= 0.18.1, < 2.0)
132
128
  rake (10.4.2)
133
129
  remotipart (1.2.1)
134
130
  safe_yaml (1.0.4)
135
- sass (3.4.16)
136
- sass-rails (5.0.3)
131
+ sass (3.4.20)
132
+ sass-rails (5.0.4)
137
133
  railties (>= 4.0.0, < 5.0)
138
134
  sass (~> 3.1)
139
135
  sprockets (>= 2.8, < 4.0)
140
136
  sprockets-rails (>= 2.0, < 4.0)
141
- tilt (~> 1.1)
142
- sprockets (3.2.0)
143
- rack (~> 1.0)
144
- sprockets-rails (2.3.2)
145
- actionpack (>= 3.0)
146
- activesupport (>= 3.0)
147
- sprockets (>= 2.8, < 4.0)
137
+ tilt (>= 1.1, < 3)
138
+ sprockets (3.5.2)
139
+ concurrent-ruby (~> 1.0)
140
+ rack (> 1, < 3)
141
+ sprockets-rails (3.0.0)
142
+ actionpack (>= 4.0)
143
+ activesupport (>= 4.0)
144
+ sprockets (>= 3.0.0)
148
145
  thor (0.19.1)
149
146
  thread_safe (0.3.5)
150
- tilt (1.4.1)
147
+ tilt (2.0.1)
151
148
  tzinfo (1.2.2)
152
149
  thread_safe (~> 0.1)
153
150
 
@@ -156,9 +153,8 @@ PLATFORMS
156
153
 
157
154
  DEPENDENCIES
158
155
  bundler
159
- rails_admin!
160
156
  rails_admin_toggleable!
161
157
  rake
162
158
 
163
159
  BUNDLED WITH
164
- 1.10.5
160
+ 1.10.6
@@ -30,7 +30,7 @@ module RailsAdmin
30
30
  end
31
31
  if params['id'].present?
32
32
  begin
33
- @object = @abstract_model.model.find(params['id'])
33
+ @object = @abstract_model.model.unscoped.find(params['id'])
34
34
  @meth = params[:method]
35
35
  @object.send(@meth + '=', params[:on] == '1' ? true : false)
36
36
  if @object.save
@@ -36,7 +36,10 @@ module RailsAdmin
36
36
  register_instance_option :controller do
37
37
  Proc.new do |klass|
38
38
  @objects = list_entries(@model_config, :toggle)
39
- @objects.update_all(@action.class.meth => true)
39
+ @objects.each do |obj|
40
+ obj.send("#{@action.class.meth}=", true)
41
+ obj.save!
42
+ end
40
43
  redirect_to :back
41
44
  end
42
45
  end
@@ -45,7 +48,10 @@ module RailsAdmin
45
48
  register_instance_option :controller do
46
49
  Proc.new do |klass|
47
50
  @objects = list_entries(@model_config, :toggle)
48
- @objects.update_all(@action.class.meth => false)
51
+ @objects.each do |obj|
52
+ obj.send("#{@action.class.meth}=", false)
53
+ obj.save!
54
+ end
49
55
  redirect_to :back
50
56
  end
51
57
  end
@@ -15,19 +15,41 @@ module RailsAdmin
15
15
  end
16
16
 
17
17
  register_instance_option :pretty_value do
18
+ def g_js
19
+ <<-END.strip_heredoc.gsub("\n", ' ').gsub(/ +/, ' ')
20
+ var $t = $(this);
21
+ $t.html("<i class='fa fa-spinner fa-spin'></i>");
22
+ $.ajax({
23
+ type: "POST",
24
+ url: $t.attr("href"),
25
+ data: {ajax:true},
26
+ success: function(r) {
27
+ $t.attr("href", r.href);
28
+ $t.attr("class", r.class);
29
+ $t.text(r.text);
30
+ $t.parent().attr("title", r.text);
31
+ $t.siblings(".toggle-btn").remove();
32
+ },
33
+ error: function(e) {
34
+ alert(e.responseText);
35
+ }
36
+ });
37
+ return false;
38
+ END
39
+ end
18
40
  def g_link(fv, on, badge)
19
41
  bindings[:view].link_to(
20
42
  fv.html_safe,
21
43
  toggle_path(model_name: @abstract_model, id: bindings[:object].id, method: name, on: on.to_s),
22
44
  # method: :post,
23
- class: 'label ' + badge,
24
- onclick: 'var $t = $(this); $t.html("<i class=\"fa fa-spinner fa-spin\"></i>"); $.ajax({type: "POST", url: $t.attr("href"), data: {ajax:true}, success: function(r) { $t.attr("href", r.href); $t.attr("class", r.class); $t.text(r.text); $t.parent().attr("title", r.text); }, error: function(e) { alert(e.responseText); }}); return false;'
45
+ class: 'toggle-btn label ' + badge,
46
+ onclick: g_js
25
47
  )
26
48
  end
27
49
 
28
50
  case value
29
51
  when nil
30
- g_link('✘', 0, 'label-danger') + g_link('✓', 1, 'label-success')
52
+ g_link('✘', 0, 'label-danger') + ' ' + g_link('✓', 1, 'label-success')
31
53
  when false
32
54
  g_link('✘', 1, 'label-danger')
33
55
  when true
@@ -1,3 +1,3 @@
1
1
  module RailsAdminToggleable
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.1
4
+ version: 0.6.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: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-12-23 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.4.5
98
+ rubygems_version: 2.4.5.1
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