activeadmin-translate 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/README.md +4 -11
- data/config/locales/de.yml +7 -0
- data/config/locales/en.yml +4 -1
- data/config/locales/fr.yml +7 -0
- data/config/locales/it.yml +7 -0
- data/lib/active_admin/translate/engine.rb +1 -1
- data/lib/active_admin/translate/form_builder.rb +9 -1
- data/lib/active_admin/translate/version.rb +1 -1
- metadata +4 -2
- data/app/assets/javascripts/active_admin/translate.js +0 -3
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ between the locales.
|
|
9
9
|
Add the gem to your `Gemfile`
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'activeadmin-translate
|
12
|
+
gem 'activeadmin-translate'
|
13
13
|
```
|
14
14
|
|
15
15
|
and install it with Bundler:
|
@@ -31,14 +31,7 @@ config.i18n.available_locales = [:en, :de, :fr, :it]
|
|
31
31
|
|
32
32
|
### Include ActiveAdmin Translate
|
33
33
|
|
34
|
-
You need to
|
35
|
-
`app/assets/javascripts/active_admin.js`:
|
36
|
-
|
37
|
-
```javascript
|
38
|
-
//= require active_admin/translate
|
39
|
-
```
|
40
|
-
|
41
|
-
Then you also need to import the SASS customizations in `app/assets/stylesheets/active_admin.css.scss`:
|
34
|
+
You need to import the SASS for styling the tabs to `app/assets/stylesheets/active_admin.css.scss`:
|
42
35
|
|
43
36
|
```css
|
44
37
|
@import "active_admin/translate";
|
@@ -72,7 +65,7 @@ form do |f|
|
|
72
65
|
end
|
73
66
|
```
|
74
67
|
|
75
|
-
### Translate your ActiveAdmin
|
68
|
+
### Translate your ActiveAdmin attributes table
|
76
69
|
|
77
70
|
To show the attributes for all locales, you use the `translate_attributes_table_for` view helper:
|
78
71
|
|
@@ -154,7 +147,7 @@ This project has taken some ideas and code from the following projects:
|
|
154
147
|
|
155
148
|
## License
|
156
149
|
|
157
|
-
Copyright (c) 2012
|
150
|
+
Copyright (c) 2012 Michael Kessler
|
158
151
|
|
159
152
|
MIT License
|
160
153
|
|
data/config/locales/en.yml
CHANGED
@@ -6,7 +6,7 @@ module ActiveAdmin
|
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
|
8
8
|
initializer 'ActiveAdmin Translate precompile' do |app|
|
9
|
-
app.config.assets.precompile += %w(active_admin/translate.css
|
9
|
+
app.config.assets.precompile += %w(active_admin/translate.css)
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
@@ -12,12 +12,20 @@ module ActiveAdmin
|
|
12
12
|
#
|
13
13
|
def translate_inputs(name = :translations, &block)
|
14
14
|
form_buffers.last << template.content_tag(:div, :class => "activeadmin-translate #{ translate_id }") do
|
15
|
-
locale_tabs << locale_fields(name, block)
|
15
|
+
locale_tabs << locale_fields(name, block) << tab_script
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
protected
|
20
20
|
|
21
|
+
# Create the script to activate the tabs on insertion.
|
22
|
+
#
|
23
|
+
# @return [String] the script tag
|
24
|
+
#
|
25
|
+
def tab_script
|
26
|
+
template.content_tag(:script, "$('.activeadmin-translate').tabs();".html_safe)
|
27
|
+
end
|
28
|
+
|
21
29
|
# Create the local field sets to enter the inputs per locale.
|
22
30
|
#
|
23
31
|
# @param [Symbol] name the name of the translation association
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-translate
|
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:
|
@@ -66,14 +66,16 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- app/assets/javascripts/active_admin/translate.js
|
70
69
|
- app/assets/stylesheets/active_admin/translate.css.scss
|
71
70
|
- lib/active_admin/translate/engine.rb
|
72
71
|
- lib/active_admin/translate/form_builder.rb
|
73
72
|
- lib/active_admin/translate/version.rb
|
74
73
|
- lib/active_admin/views/translate_attributes_table.rb
|
75
74
|
- lib/activeadmin-translate.rb
|
75
|
+
- config/locales/de.yml
|
76
76
|
- config/locales/en.yml
|
77
|
+
- config/locales/fr.yml
|
78
|
+
- config/locales/it.yml
|
77
79
|
- LICENSE
|
78
80
|
- README.md
|
79
81
|
- CHANGELOG.md
|