rails_admin_boolean_toggle 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGU2ODNkMTkzZDMxNjU1NzI1MDkwNzJhODM3ZTBlYmZkNGNjNWI2MQ==
4
+ ZDBmZDJkYTQ3MzQzMmE3MjFmNjAxNWFjYTA1MmE1YzcxZGZkZDc2Mg==
5
5
  data.tar.gz: !binary |-
6
- Mjg2NDhlZTI2MDc4NDMxMjQyYTljNTEwZmE5YTQ1YWEyZTg5MWU1Yg==
6
+ ZTc4Y2E3MzNhYzg5MDc0ODcxZjljYTQ1NjJhZDJiZDliZGY0ZjRlOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTAxYzg0YWYxMTNjZDYyM2U3ZDU3ZmIxMTVhNjljM2M5YWM4YTA4NjQ0NGM4
10
- MWY5YjEwOTdlNjQyNzlhN2U5YTJiNzBlYWVhZjlhNjVlZTM1MGYzYWI0NGNj
11
- YjMwOWYyMzJlNzhiYmViZGUxMzBmMzA5NWEwYjU0NTc0YWFlMjQ=
9
+ ZDU1MWFiZDg3ZWJjMjM3YzZmMzFiMzkyMTliNzQwY2Y5N2NlZTdmMjVlMzNl
10
+ ZTkxOWU0YmZjZjA5YzI3Y2I1MzAwZGE0NWU2NGZkMmRlMTVkMDQ3OGMwYTg0
11
+ NWU0ZjE0ODE4ZDcwZWZiYjQ1ZGM4ZjNlN2M1OGUyZDk3NTI2OGQ=
12
12
  data.tar.gz: !binary |-
13
- ZTMyYjhhZThmODVhMWE0OWM4ZjllOWNlOGFkYzkzOWExNmNiNjEyMTU2YWI0
14
- MDFkMzdlNDhiMWJjNjY4M2U2YTk2MDNmMjk4ZjMyZDlkZWM2NjJiODJhNzU4
15
- NjQyMWY3YzAyOTE4MjEyYjgwMDg2NTdhZjViZTA3ZGZkM2I0MzE=
13
+ ZTUwNjZmNGQwYjJhOWQ5NjUyZmQxZDhmNGI2ZGJlNTgwNDk1YTU3ZjZmMzQx
14
+ MThkNWI3ZTliZDYwZDE0ZTFiZTcwMjczMTM3MjE1OTExZWQwOTcyOWUwZWM1
15
+ ZTM1ZjJkMDk0MmI0ZWI0ODE0NWI2N2Y1ODY4MDA1ZTBiNjYyM2M=
@@ -0,0 +1,6 @@
1
+ en:
2
+ admin:
3
+ toggle:
4
+ pretty_yes: Yes
5
+ pretty_no: No
6
+ pretty_undef: Undefined
@@ -0,0 +1,6 @@
1
+ ru:
2
+ admin:
3
+ toggle:
4
+ pretty_yes: Да
5
+ pretty_no: Нет
6
+ pretty_undef: Не задано
@@ -18,16 +18,33 @@ module RailsAdminBooleanToggle
18
18
  )
19
19
  end
20
20
 
21
- case value
22
- when nil
23
- g_link('✘', 0, 'badge-important') + g_link('✓', 1, 'badge-success')
24
- when false
25
- g_link('✘', 1, 'badge-important')
26
- when true
27
- g_link('&#x2713', 0, 'badge-success')
28
- else
29
- %{<span class="badge">-</span>}
30
- end.html_safe
21
+ def out
22
+ if read_only?
23
+ return case value
24
+ when nil
25
+ I18n.t('admin.toggle.pretty_undef')
26
+ when false
27
+ I18n.t('admin.toggle.pretty_no')
28
+ when true
29
+ I18n.t('admin.toggle.pretty_yes')
30
+ else
31
+ value
32
+ end
33
+ end
34
+
35
+ case value
36
+ when nil
37
+ g_link('&#x2718;', 0, 'badge-important') + g_link('&#x2713;', 1, 'badge-success')
38
+ when false
39
+ g_link('&#x2718;', 1, 'badge-important')
40
+ when true
41
+ g_link('&#x2713', 0, 'badge-success')
42
+ else
43
+ %{<span class="badge">-</span>}
44
+ end
45
+ end
46
+
47
+ out.html_safe
31
48
  end
32
49
 
33
50
  register_instance_option :export_value do
@@ -1,3 +1,3 @@
1
1
  module RailsAdminBooleanToggle
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_boolean_toggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Malykh
@@ -50,6 +50,8 @@ files:
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - Rakefile
53
+ - config/locales/en.rails_admin_boolean_toggle.yml
54
+ - config/locales/ru.rails_admin_boolean_toggle.yml
53
55
  - lib/rails_admin_boolean_toggle.rb
54
56
  - lib/rails_admin_boolean_toggle/engine.rb
55
57
  - lib/rails_admin_boolean_toggle/version.rb