rails_admin_mongoid_localize_filed 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae6d80a63c5671fc4d20d682ffae9b0bc78f50ea
|
4
|
+
data.tar.gz: f9a937de1a520cba5781607a898804645e9e3b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b150a4725a198bedc8e9ba30a70fa0d27f34b49c29f30a9865ea51866bd54e839d6a37469e158db2dd0023eef7141e185d6fdbdb81c00ddd9c35fccae3250b0
|
7
|
+
data.tar.gz: 9a8c354530755379987c9bb54213d8eb0c479efdbd4c649ff5ff22c21358741835a3621a2a06ec7a3f0d57c17a726cf7c93dad1478d4bc16065c864a8d0351df
|
data/README.md
CHANGED
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
Adds to [RailsAdmin](https://github.com/sferik/rails_admin) support for [mongoid localized fields](http://mongoid.org/en/mongoid/docs/documents.html#localized_fields).
|
4
4
|
|
5
|
-
|
6
5
|
## Installation
|
7
6
|
|
8
7
|
In your `Gemfile`add the following dependencies:
|
9
8
|
|
10
|
-
gem
|
9
|
+
gem "rails_admin_mongoid_localize_filed", "~> 0.1.0"
|
11
10
|
|
12
11
|
Run:
|
13
12
|
|
@@ -16,6 +15,7 @@ Run:
|
|
16
15
|
## Usage
|
17
16
|
|
18
17
|
Just by telling the field to `localize`:
|
18
|
+
|
19
19
|
```ruby
|
20
20
|
class Category
|
21
21
|
include Mongoid::Document
|
@@ -25,9 +25,33 @@ class Category
|
|
25
25
|
end
|
26
26
|
```
|
27
27
|
|
28
|
+
If you didn't like ui tabs, you can remove them and use simple form template by using `tabbed` option:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
# config/initializer/rails_admin.rb
|
32
|
+
|
33
|
+
config.model 'Category' do
|
34
|
+
edit do
|
35
|
+
field :name do
|
36
|
+
tabbed false
|
37
|
+
end
|
38
|
+
field :description do
|
39
|
+
tabbed false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
28
45
|
## Screenshot
|
29
46
|
|
30
|
-
![Screenshot](https://
|
47
|
+
![Screenshot](https://raw.github.com/sudosu/screenshots/master/rails_admin_mongoid_localize_fields.png)
|
48
|
+
|
49
|
+
|
50
|
+
## Dependencies
|
31
51
|
|
52
|
+
* haml
|
53
|
+
* mongoid >= 3.0
|
54
|
+
* rails >= 3.0
|
55
|
+
* rails_admin >= 0.5
|
32
56
|
|
33
|
-
This project rocks and uses MIT-LICENSE.
|
57
|
+
This project rocks and uses MIT-LICENSE.
|
@@ -1,9 +1,10 @@
|
|
1
1
|
%ul.nav.nav-tabs
|
2
|
+
- uuid = "#{field.name}_for_new_#{field.abstract_model.table_name}_#{SecureRandom.hex(10)}"
|
2
3
|
- I18n.available_locales.each do |locale|
|
3
4
|
%li{ class: ( 'active' if locale == I18n.locale ) }
|
4
|
-
%a{ href: "##{
|
5
|
+
%a{ href: "##{locale}_#{uuid}", data: { toggle: "tab" } }= locale
|
5
6
|
.tab-content{ style: 'float:left' }
|
6
7
|
= form.fields_for field.translations_field do |localized_field|
|
7
8
|
- I18n.available_locales.each do |locale|
|
8
|
-
.fields.tab-pane{ style: 'padding:5px',id: "#{
|
9
|
-
= localized_field.send field_type, locale, html_attributes.reverse_merge({ :value => field.value.try(:[], locale.to_s) })
|
9
|
+
.fields.tab-pane{ style: 'padding:5px', id: "#{locale}_#{uuid}", class: ( 'active' if locale == I18n.locale ) }
|
10
|
+
= localized_field.send field_type, locale, html_attributes.reverse_merge({ :value => field.value.try(:[], locale.to_s) })
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_mongoid_localize_filed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Popadiuk
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '3.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '3.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mongoid
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|