lolita-translation 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/VERSION +1 -1
- data/lib/lolita-translation.rb +6 -1
- data/lolita-translation.gemspec +1 -1
- data/public/javascripts/lolita/translation.js +1 -1
- data/public/stylesheets/lolita/translation.css +3 -2
- metadata +14 -14
data/README.md
CHANGED
@@ -11,6 +11,9 @@
|
|
11
11
|
1. Call `translations :title, :body` in your model and pass column names to translate.
|
12
12
|
2. Add `Article.sync_translation_table!` to your `db/seeds.rb` and run it.
|
13
13
|
|
14
|
+
#### What it does?
|
15
|
+
In Lolita, each tab, that contains at least on field, that needs to be translated, is changed to translatable tab.
|
16
|
+
|
14
17
|
### Examples
|
15
18
|
|
16
19
|
Translations table holds only translations, but not the original data from default_locale, so:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/lolita-translation.rb
CHANGED
@@ -7,8 +7,11 @@ module Lolita
|
|
7
7
|
module Translation
|
8
8
|
class << self
|
9
9
|
def translatable?(tab)
|
10
|
+
fields = tab.fields.reject{|field|
|
11
|
+
field.dbi!=tab.dbi
|
12
|
+
}
|
10
13
|
tab.dbi.klass.respond_to?(:translation_attrs) &&
|
11
|
-
tab.dbi.klass.respond_to?(:translations) && (
|
14
|
+
tab.dbi.klass.respond_to?(:translations) && (fields.map(&:name) & tab.dbi.klass.translation_attrs).any?
|
12
15
|
end
|
13
16
|
|
14
17
|
def create_translations_nested_form(resource,tab)
|
@@ -28,6 +31,8 @@ module Lolita
|
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
34
|
+
Lolita.add_module Lolita::Translation
|
35
|
+
|
31
36
|
Lolita::Hooks.component(:"/lolita/configuration/tab/form").before do
|
32
37
|
tab = self.component_locals[:tab]
|
33
38
|
if Lolita::Translation.translatable?(tab)
|
data/lolita-translation.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lolita-translation}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{ITHouse}, %q{Gatis Tomsons}, %q{Arturs Meisters}]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolita-translation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ date: 2011-08-30 00:00:00.000000000Z
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &76006710 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 3.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *76006710
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: lolita
|
29
|
-
requirement: &
|
29
|
+
requirement: &75990190 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 3.1.15
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *75990190
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: shoulda
|
40
|
-
requirement: &
|
40
|
+
requirement: &75989730 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *75989730
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: bundler
|
51
|
-
requirement: &
|
51
|
+
requirement: &75989180 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 1.0.0
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *75989180
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: jeweler
|
62
|
-
requirement: &
|
62
|
+
requirement: &75988680 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 1.5.2
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *75988680
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rcov
|
73
|
-
requirement: &
|
73
|
+
requirement: &75988280 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,7 +78,7 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *75988280
|
82
82
|
description: Translates models in Lolita
|
83
83
|
email: support@ithouse.lv
|
84
84
|
executables: []
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
segments:
|
130
130
|
- 0
|
131
|
-
hash:
|
131
|
+
hash: -513970733
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|