tolk 1.5.1 → 1.5.2

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: cac7a92ba13f6cddb5ddb3970d66785cddbf148c
4
- data.tar.gz: 6bc7fc1e492b8594dd64fb82de0483b441f988a0
3
+ metadata.gz: 1c19b0b57cefe554cc66f643db8c50687d893f7b
4
+ data.tar.gz: ab0b34b9f6b9916bc4704c95c6ef287ff033deb1
5
5
  SHA512:
6
- metadata.gz: 7fab81bf15cf9a483046851bbe20ad88877736ea4a396264fa5f2b5cb7f68037cba687cac3c94191fb280f2676c5cf3731511c313700a70a86687db1d1014eee
7
- data.tar.gz: 0148444497e74ec2f305c249b1623bc6fb7e0b16101a2e1f42c80087b6a03d0a90401db88e426ab78bb8401669d70e0c7741bf2d0e39c3fcb29472a7029c668c
6
+ metadata.gz: 5e86f97bb6601c3b8decb7569b194b9708ee0690c0d68b66e844ed863d59de1b85276542aa1619c8c3d5edd9f7c711e8bc0e357f12de35a290f1f3886265c770
7
+ data.tar.gz: fe545ba06f6ff8d2d53c5462417bb6a38037a40c1bf6c00a4dd1be19181b065788be4d873d23489e90fe64307219d82d3ac9ffc9e2e331a30652c2381160b696
@@ -76,13 +76,9 @@ module Tolk
76
76
  params.require(:tolk_locale).permit(:name)
77
77
  end
78
78
 
79
- # TODO: whitelist incoming translation params
80
- # translation permitted params: :phrase_id, :locale_id, :text, :primary_updated, :previous_text, :locale, :phrase
81
- # test params: "translations"=>[{"id"=>"", "phrase_id"=>"8", "locale_id"=>"5", "text"=>"Dead men don't bite"}, {"id"=>"", "phrase_id"=>"7", "locale_id"=>"5", "text"=>""}]
82
79
  def translation_params
83
- params.require(:translations)
80
+ params.permit(translations: [:id, :phrase_id, :locale_id, :text])[:translations]
84
81
  end
85
82
 
86
-
87
83
  end
88
84
  end
@@ -38,7 +38,7 @@ module Tolk
38
38
  @_primary_locale = nil if reload
39
39
  @_primary_locale ||= begin
40
40
  raise "Primary locale is not set. Please set Locale.primary_locale_name in your application's config file" unless self.primary_locale_name
41
- find_or_create_by(name: self.primary_locale_name)
41
+ where(name: self.primary_locale_name).first_or_create
42
42
  end
43
43
  end
44
44
 
@@ -55,7 +55,7 @@ module Tolk
55
55
  end
56
56
 
57
57
  def dump_yaml(name, *args)
58
- find_by_name(name).dump(*args)
58
+ where(name: name).first.dump(*args)
59
59
  end
60
60
 
61
61
  def special_key_or_prefix?(prefix, key)
@@ -75,7 +75,7 @@ module Tolk
75
75
  end
76
76
 
77
77
  def has_updated_translations?
78
- translations.count(:conditions => {:'tolk_translations.primary_updated' => true}) > 0
78
+ translations.where('tolk_translations.primary_updated' => true).count > 0
79
79
  end
80
80
 
81
81
  def phrases_with_translation(page = nil)
@@ -162,7 +162,7 @@ module Tolk
162
162
  end
163
163
 
164
164
  def get(key)
165
- if phrase = Tolk::Phrase.find_by_key(key)
165
+ if phrase = Tolk::Phrase.where(key: key).first
166
166
  t = self.translations.where(:phrase_id => phrase.id).first
167
167
  t.text if t
168
168
  end
@@ -179,7 +179,7 @@ module Tolk
179
179
  if old_name.blank? || new_name.blank?
180
180
  "You need to provide both names, aborting."
181
181
  else
182
- if locale = find_by_name(old_name)
182
+ if locale = where(name: old_name).first
183
183
  locale.name = new_name
184
184
  locale.save
185
185
  "Locale ' #{old_name}' was renamed '#{new_name}'"
@@ -19,7 +19,7 @@
19
19
  </tr>
20
20
  <% @phrases.each do |phrase| %>
21
21
 
22
- <% if translation = phrase.translations.find_by_locale_id(@locale.id) || Tolk::Translation.new(:locale => @locale, :phrase => phrase) %>
22
+ <% if translation = phrase.translations.where(locale_id: @locale.id).first || Tolk::Translation.new(:locale => @locale, :phrase => phrase) %>
23
23
  <tr>
24
24
  <td class="translation">
25
25
  <%= hidden_field_tag :"translations[][id]", translation.id, :id => "#{translation.object_id}_id" %>
@@ -40,7 +40,7 @@
40
40
  <%= format_i18n_value(phrase.translations.primary.text) -%>
41
41
  <% end -%>
42
42
  <%= boolean_warning if phrase.translations.primary.boolean? -%>
43
-
43
+
44
44
  <span class="key" title="<%= phrase.key %>"><%= params[:k].present? ?
45
45
  highlight(h(truncate(phrase.key, :length => 100)), params[:k]) :
46
46
  h(truncate(phrase.key, :length => 100)) %></span>
data/lib/tolk/engine.rb CHANGED
@@ -7,10 +7,8 @@ module Tolk
7
7
 
8
8
  isolate_namespace Tolk
9
9
 
10
- if Rails.version >= '3.1'
11
- initializer :assets do |app|
12
- app.config.assets.precompile += ['tolk/libraries.js']
13
- end
10
+ initializer :assets do |app|
11
+ app.config.assets.precompile += ['tolk/libraries.js']
14
12
  end
15
13
  end
16
14
  end
data/lib/tolk/import.rb CHANGED
@@ -20,7 +20,7 @@ module Tolk
20
20
  end
21
21
 
22
22
  def import_locale(locale_name)
23
- locale = Tolk::Locale.find_or_create_by_name(locale_name)
23
+ locale = Tolk::Locale.where(name: locale_name).first_or_create
24
24
  data = locale.read_locale_file
25
25
  return unless data
26
26
 
data/lib/tolk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -12,8 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-05-28 00:00:00.000000000 Z
15
+ date: 2014-09-16 00:00:00.000000000 Z
16
16
  dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rails
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: 4.0.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: 4.0.0
17
31
  - !ruby/object:Gem::Dependency
18
32
  name: will_paginate
19
33
  requirement: !ruby/object:Gem::Requirement
@@ -34,14 +48,98 @@ dependencies:
34
48
  requirements:
35
49
  - - ">="
36
50
  - !ruby/object:Gem::Version
37
- version: '0.8'
51
+ version: 0.8.6
38
52
  type: :runtime
39
53
  prerelease: false
40
54
  version_requirements: !ruby/object:Gem::Requirement
41
55
  requirements:
42
56
  - - ">="
43
57
  - !ruby/object:Gem::Version
44
- version: '0.8'
58
+ version: 0.8.6
59
+ - !ruby/object:Gem::Dependency
60
+ name: capybara
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '='
64
+ - !ruby/object:Gem::Version
65
+ version: 2.2.1
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '='
71
+ - !ruby/object:Gem::Version
72
+ version: 2.2.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: factory_girl_rails
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ - !ruby/object:Gem::Dependency
88
+ name: sqlite3
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ - !ruby/object:Gem::Dependency
102
+ name: mocha
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: launchy
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ - !ruby/object:Gem::Dependency
130
+ name: selenium-webdriver
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
45
143
  description: Tolk is a web interface for doing i18n translations packaged as an engine
46
144
  for Rails applications.
47
145
  email: david@loudthinking.com
@@ -99,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
197
  requirements:
100
198
  - - ">="
101
199
  - !ruby/object:Gem::Version
102
- version: '0'
200
+ version: 1.9.3
103
201
  required_rubygems_version: !ruby/object:Gem::Requirement
104
202
  requirements:
105
203
  - - ">="