rails_admin_toggleable 0.0.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/config/locales/en.rails_admin_toggleable.yml +10 -0
- data/config/locales/ru.rails_admin_toggleable.yml +10 -0
- data/lib/rails_admin_toggleable/action.rb +8 -3
- data/lib/rails_admin_toggleable/engine.rb +4 -0
- data/lib/rails_admin_toggleable/version.rb +1 -1
- data/lib/rails_admin_toggleable.rb +2 -4
- metadata +7 -3
@@ -26,15 +26,20 @@ module RailsAdmin
|
|
26
26
|
method = params[:method]
|
27
27
|
obj.send(method + '=', params[:on] == '1' ? true : false)
|
28
28
|
if obj.save
|
29
|
-
|
29
|
+
if params[:on] == '1'
|
30
|
+
flash[:success] = I18n.t('admin.toggle.enabled', attr: method)
|
31
|
+
else
|
32
|
+
flash[:success] = I18n.t('admin.toggle.disabled', attr: method)
|
33
|
+
end
|
34
|
+
|
30
35
|
else
|
31
36
|
flash[:error] = obj.errors.full_messages.join(', ')
|
32
37
|
end
|
33
38
|
rescue Exception => e
|
34
|
-
flash[:error] =
|
39
|
+
flash[:error] = I18n.t('admin.toggle.error', err: e.to_s)
|
35
40
|
end
|
36
41
|
else
|
37
|
-
flash[:error] = '
|
42
|
+
flash[:error] = I18n.t('admin.toggle.no_id')
|
38
43
|
end
|
39
44
|
redirect_to :back
|
40
45
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require "rails_admin_toggleable/version"
|
2
2
|
|
3
|
-
module RailsAdminToggleable
|
4
|
-
end
|
5
|
-
|
6
3
|
require 'rails_admin/config/actions'
|
7
4
|
require 'rails_admin/config/model'
|
8
5
|
|
9
6
|
require 'rails_admin_toggleable/action'
|
10
|
-
require 'rails_admin_toggleable/field'
|
7
|
+
require 'rails_admin_toggleable/field'
|
8
|
+
require 'rails_admin_toggleable/engine'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_toggleable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Toggleable field for rails admin
|
15
15
|
email:
|
@@ -23,8 +23,11 @@ files:
|
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.md
|
25
25
|
- Rakefile
|
26
|
+
- config/locales/en.rails_admin_toggleable.yml
|
27
|
+
- config/locales/ru.rails_admin_toggleable.yml
|
26
28
|
- lib/rails_admin_toggleable.rb
|
27
29
|
- lib/rails_admin_toggleable/action.rb
|
30
|
+
- lib/rails_admin_toggleable/engine.rb
|
28
31
|
- lib/rails_admin_toggleable/field.rb
|
29
32
|
- lib/rails_admin_toggleable/version.rb
|
30
33
|
- rails_admin_toggleable.gemspec
|
@@ -48,9 +51,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
51
|
version: '0'
|
49
52
|
requirements: []
|
50
53
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
54
|
+
rubygems_version: 1.8.22
|
52
55
|
signing_key:
|
53
56
|
specification_version: 3
|
54
57
|
summary: Make any boolean field easily toggleable on\off from index view in rails
|
55
58
|
admin
|
56
59
|
test_files: []
|
60
|
+
has_rdoc:
|