lolita-translation 0.2.18 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "lolita", "3.1.18"
3
+ gem "lolita", ">=3.2.0.rc.3"
4
4
  group :development do
5
5
  gem "shoulda", ">= 0"
6
6
  gem "bundler", "~> 1.0.0"
@@ -9,7 +9,7 @@ group :development do
9
9
  end
10
10
 
11
11
  group :test do
12
- gem "rails", "~>3.0.0"
12
+ gem "rails", "~>3.1.0"
13
13
  gem "rspec","~>2.6.0"
14
14
  gem "rspec-rails", "~>2.6.0"
15
15
  gem "webmock", "~> 1.7.6"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.18
1
+ 0.3.0
File without changes
@@ -80,11 +80,7 @@ module Lolita
80
80
  # <tt>all_translations</tt> method that returns all possible translations in
81
81
  # ordered hash (useful when creating forms with nested attributes).
82
82
  def translations *attrs
83
- @translations_config ||= Lolita::Translation::Configuration.new(self,*attrs)
84
- if block_given?
85
- yield @translations_config
86
- end
87
- @translations_config
83
+ @config ||= Lolita::Translation::Configuration.new(self,*attrs)
88
84
  end
89
85
  end
90
86
 
@@ -108,8 +104,8 @@ module Lolita
108
104
  config = self
109
105
  @klass.class_eval do
110
106
 
111
- class_attribute :has_translations_options
112
- self.has_translations_options = config.options
107
+ class_attribute :has_translation_options
108
+ self.has_translation_options = config.options
113
109
 
114
110
  class_attribute :columns_has_translations
115
111
  self.columns_has_translations = (columns rescue []).collect{|col| col if config.attrs.include?(col.name.to_sym)}.compact
@@ -23,8 +23,8 @@ module Lolita
23
23
  # override validate to vaidate only translate fields from master Class
24
24
  def validate
25
25
  item = self.class.name.sub('Translation','').constantize.new(self.attributes.clone.delete_if{|k,_| !self.class.translate_attrs.include?(k.to_sym)})
26
- item_adapter = Lolita::DBI::Base.create(item.class)
27
- self_adapter = Lolita::DBI::Base.create(self.class)
26
+ item_adapter = Lolita::DBI::Adapter.add(item.class)
27
+ self_adapter = Lolita::DBI::Adapter.add(self)
28
28
  was_table_name = item_adapter.collection_name
29
29
  item_adapter.collection_name = self_adapter.collection_name
30
30
  item.valid? rescue
@@ -71,7 +71,7 @@ module Lolita
71
71
  end
72
72
  # set's real table name
73
73
  translation_adapter = Lolita::DBI::Base.create(self)
74
- translation_adapter.collection_name = config.options[:table_name] || translation_model.adapter.collection_name.to_s + "_translations"
74
+ translation_adapter.collection_name = config.options[:table_name] || translation_model.adapter.collection_name.to_s.singularize + "_translation"
75
75
 
76
76
  cattr_accessor :translate_attrs, :master_id
77
77
 
@@ -16,7 +16,6 @@ module Lolita
16
16
  end
17
17
 
18
18
  class << self
19
- # Determine whether tab is translatable. When there is one or more fields in tab, that are defined with #translates.
20
19
  def translatable?(tab)
21
20
  fields = tab.fields.reject{|field|
22
21
  field.dbi!=tab.dbi
@@ -25,7 +24,6 @@ module Lolita
25
24
  tab.dbi.klass.respond_to?(:translations) && (fields.map(&:name) & tab.dbi.klass.translation_attrs).any?
26
25
  end
27
26
 
28
- # Create nested form configuration for views.
29
27
  def create_translations_nested_form(resource,tab)
30
28
  resource.build_nested_translations
31
29
  nested_form = Lolita::Configuration::NestedForm.new(tab,:translations)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lolita-translation"
8
- s.version = "0.2.18"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ITHouse", "Gatis Tomsons", "Arturs Meisters"]
12
- s.date = "2011-12-13"
12
+ s.date = "2011-11-11"
13
13
  s.description = "Translates models in Lolita"
14
14
  s.email = "support@ithouse.lv"
15
15
  s.extra_rdoc_files = [
@@ -25,6 +25,9 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "app/assets/.gitkeep",
28
+ "app/assets/javascripts/.gitkeep",
29
+ "app/assets/javascripts/lolita/translation/application.js",
30
+ "app/assets/stylesheets/lolita/translation/application.css",
28
31
  "app/views/components/lolita/translation/_assets.html.erb",
29
32
  "app/views/components/lolita/translation/_language_wrap.html.erb",
30
33
  "app/views/components/lolita/translation/_switch.html.erb",
@@ -40,16 +43,13 @@ Gem::Specification.new do |s|
40
43
  "lib/lolita-translation/string.rb",
41
44
  "lib/tasks/has_translations_tasks.rake",
42
45
  "lolita-translation.gemspec",
43
- "public/javascripts/.gitkeep",
44
- "public/javascripts/lolita/translation/application.js",
45
- "public/stylesheets/lolita/translation/application.css",
46
46
  "spec/has_translations_spec.rb",
47
47
  "spec/spec_helper.rb"
48
48
  ]
49
49
  s.homepage = "http://github.com/ithouse/lolita-translations"
50
50
  s.licenses = ["MIT"]
51
51
  s.require_paths = ["lib"]
52
- s.rubygems_version = "1.8.11"
52
+ s.rubygems_version = "1.8.10"
53
53
  s.summary = "Lolita models translation plugin"
54
54
  s.test_files = [
55
55
  "spec/has_translations_spec.rb",
@@ -60,20 +60,20 @@ Gem::Specification.new do |s|
60
60
  s.specification_version = 3
61
61
 
62
62
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
- s.add_runtime_dependency(%q<lolita>, ["= 3.1.18"])
63
+ s.add_runtime_dependency(%q<lolita>, [">= 3.2.0.rc.3"])
64
64
  s.add_development_dependency(%q<shoulda>, [">= 0"])
65
65
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
66
66
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
67
67
  s.add_development_dependency(%q<rcov>, [">= 0"])
68
68
  else
69
- s.add_dependency(%q<lolita>, ["= 3.1.18"])
69
+ s.add_dependency(%q<lolita>, [">= 3.2.0.rc.3"])
70
70
  s.add_dependency(%q<shoulda>, [">= 0"])
71
71
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
72
72
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
73
73
  s.add_dependency(%q<rcov>, [">= 0"])
74
74
  end
75
75
  else
76
- s.add_dependency(%q<lolita>, ["= 3.1.18"])
76
+ s.add_dependency(%q<lolita>, [">= 3.2.0.rc.3"])
77
77
  s.add_dependency(%q<shoulda>, [">= 0"])
78
78
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
79
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
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.2.18
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,22 +11,22 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-12-13 00:00:00.000000000Z
14
+ date: 2011-11-11 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: lolita
18
- requirement: &16064780 !ruby/object:Gem::Requirement
18
+ requirement: &84276570 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
- - - =
21
+ - - ! '>='
22
22
  - !ruby/object:Gem::Version
23
- version: 3.1.18
23
+ version: 3.2.0.rc.3
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *16064780
26
+ version_requirements: *84276570
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shoulda
29
- requirement: &16063400 !ruby/object:Gem::Requirement
29
+ requirement: &84276210 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *16063400
37
+ version_requirements: *84276210
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: bundler
40
- requirement: &16062360 !ruby/object:Gem::Requirement
40
+ requirement: &84275880 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 1.0.0
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *16062360
48
+ version_requirements: *84275880
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: jeweler
51
- requirement: &16061500 !ruby/object:Gem::Requirement
51
+ requirement: &84275520 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ~>
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 1.5.2
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *16061500
59
+ version_requirements: *84275520
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rcov
62
- requirement: &16060600 !ruby/object:Gem::Requirement
62
+ requirement: &84275140 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *16060600
70
+ version_requirements: *84275140
71
71
  description: Translates models in Lolita
72
72
  email: support@ithouse.lv
73
73
  executables: []
@@ -84,6 +84,9 @@ files:
84
84
  - Rakefile
85
85
  - VERSION
86
86
  - app/assets/.gitkeep
87
+ - app/assets/javascripts/.gitkeep
88
+ - app/assets/javascripts/lolita/translation/application.js
89
+ - app/assets/stylesheets/lolita/translation/application.css
87
90
  - app/views/components/lolita/translation/_assets.html.erb
88
91
  - app/views/components/lolita/translation/_language_wrap.html.erb
89
92
  - app/views/components/lolita/translation/_switch.html.erb
@@ -99,9 +102,6 @@ files:
99
102
  - lib/lolita-translation/string.rb
100
103
  - lib/tasks/has_translations_tasks.rake
101
104
  - lolita-translation.gemspec
102
- - public/javascripts/.gitkeep
103
- - public/javascripts/lolita/translation/application.js
104
- - public/stylesheets/lolita/translation/application.css
105
105
  - spec/has_translations_spec.rb
106
106
  - spec/spec_helper.rb
107
107
  homepage: http://github.com/ithouse/lolita-translations
@@ -117,6 +117,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
117
  - - ! '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
+ segments:
121
+ - 0
122
+ hash: -628896687
120
123
  required_rubygems_version: !ruby/object:Gem::Requirement
121
124
  none: false
122
125
  requirements:
@@ -125,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
128
  version: '0'
126
129
  requirements: []
127
130
  rubyforge_project:
128
- rubygems_version: 1.8.11
131
+ rubygems_version: 1.8.10
129
132
  signing_key:
130
133
  specification_version: 3
131
134
  summary: Lolita models translation plugin