rosetta 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rosetta/base_controller.rb +6 -0
- data/app/controllers/rosetta/database_repository/phrases_controller.rb +36 -0
- data/app/views/rosetta/_translate_menu.html.erb +21 -2
- data/app/views/rosetta/database/_actions.html.erb +12 -0
- data/config/routes.rb +4 -1
- data/lib/rosetta.rb +1 -0
- data/lib/rosetta/repositories/database.rb +19 -0
- data/lib/rosetta/version.rb +1 -1
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00126b0010fc67571301c60501085cfc4f5b7b24a5018898aa69ed5838aa8dab
|
4
|
+
data.tar.gz: 94e139c15399152cc9873be0dc49468a6ed857cd21f877e8888327c44eeb0ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b621efdc6079463080d11c2af4d55a35c78f0817642f3fd64f2a99fb349b4e209347fa6c84462df0491b7926ad84d31836addb3b5e2b8a301cb381986acd2ac0
|
7
|
+
data.tar.gz: a9407323c95d75ce0bf6514d67edc938f1f586041a7195eb79f1b50d75047573978763073bf19fd0374e82e9ecf4aec07b5618e8a666c1861b7173ec881c925c
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rosetta
|
4
|
+
module DatabaseRepository
|
5
|
+
class PhrasesController < BaseController
|
6
|
+
|
7
|
+
def update
|
8
|
+
load_or_create_phrase
|
9
|
+
build_phrase
|
10
|
+
|
11
|
+
if @phrase.save
|
12
|
+
I18n.backend.reload!
|
13
|
+
else
|
14
|
+
flash[:rosetta_alert] = 'Your new translation not saved.'
|
15
|
+
end
|
16
|
+
|
17
|
+
redirect_to params[:current_path]
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_or_create_phrase
|
21
|
+
key = params[:id]
|
22
|
+
locale = I18n.locale
|
23
|
+
|
24
|
+
@phrase = Translation.find_by(key: key, locale: locale) ||
|
25
|
+
Translation.new(key: key, locale: locale)
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_phrase
|
29
|
+
@phrase.attributes = params&.permit(
|
30
|
+
:value
|
31
|
+
) || {}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -179,6 +179,11 @@
|
|
179
179
|
transform: translate(-50%, -50%);
|
180
180
|
}
|
181
181
|
|
182
|
+
.database__field{
|
183
|
+
min-width: 100%;
|
184
|
+
max-height: 150px important!;
|
185
|
+
}
|
186
|
+
|
182
187
|
</style>
|
183
188
|
|
184
189
|
<div id="phrasesMenu" class="phrases-menu <%= Rosetta.repository.id %>">
|
@@ -213,6 +218,8 @@
|
|
213
218
|
<script type="text/javascript">
|
214
219
|
/* Toggle the Translate menu */
|
215
220
|
$( document ).ready(function() {
|
221
|
+
var outPhrasesMenu = true;
|
222
|
+
|
216
223
|
var searchSelectedText = function(){
|
217
224
|
var text = window.getSelection().toString();
|
218
225
|
if (text != ''){
|
@@ -221,7 +228,7 @@
|
|
221
228
|
$('.phrases-menu__block').addClass('hide');
|
222
229
|
$matches.removeClass('hide');
|
223
230
|
$('.phrases-menu__search').html('<u>Search</u>: ' + text);
|
224
|
-
|
231
|
+
|
225
232
|
if($matches.length > 0){
|
226
233
|
$('.phrases-menu').addClass('match-phrase');
|
227
234
|
}else{
|
@@ -236,8 +243,20 @@
|
|
236
243
|
}
|
237
244
|
}
|
238
245
|
$('*').mouseup(function() {
|
239
|
-
|
246
|
+
if(outPhrasesMenu){
|
247
|
+
searchSelectedText();
|
248
|
+
}
|
240
249
|
});
|
250
|
+
|
251
|
+
$('#phrasesMenu').on('mouseenter', function(e){
|
252
|
+
console.log('#phrasesMenu', 'mouseenter');
|
253
|
+
outPhrasesMenu = false;
|
254
|
+
})
|
255
|
+
|
256
|
+
$('#phrasesMenu').on('mouseleave', function(e){
|
257
|
+
console.log('#phrasesMenu', 'mouseleave');
|
258
|
+
outPhrasesMenu = true;
|
259
|
+
})
|
241
260
|
});
|
242
261
|
function toggleNav() {
|
243
262
|
document.getElementById("phrasesMenu").classList.toggle("open");
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="phrases-menu__block">
|
2
|
+
<div class="phrases-menu__key">
|
3
|
+
<%= phrase.code %>
|
4
|
+
</div>
|
5
|
+
<div class="phrases-menu__phrase">
|
6
|
+
<%= form_tag(rosetta.database_repository_phrase_path(id: phrase.code), method: :put, id: phrase.code) do %>
|
7
|
+
<%= hidden_field_tag(:current_path, url_for) %>
|
8
|
+
<%= text_area_tag(:value, phrase.text, id: "#{phrase.code}_value", class: 'database__field') %>
|
9
|
+
<%= submit_tag("Update", id: "#{phrase.code}_submit") %>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
</div>
|
data/config/routes.rb
CHANGED
data/lib/rosetta.rb
CHANGED
data/lib/rosetta/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rosetta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MarsBased
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: database_cleaner
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
description: Rosetta makes it easy for copy writers to edit the translations of your
|
154
168
|
app.
|
155
169
|
email:
|
@@ -164,7 +178,10 @@ files:
|
|
164
178
|
- app/assets/config/rosetta_manifest.js
|
165
179
|
- app/assets/images/rosetta/close.svg
|
166
180
|
- app/assets/images/rosetta/language_icon.svg
|
181
|
+
- app/controllers/rosetta/base_controller.rb
|
182
|
+
- app/controllers/rosetta/database_repository/phrases_controller.rb
|
167
183
|
- app/views/rosetta/_translate_menu.html.erb
|
184
|
+
- app/views/rosetta/database/_actions.html.erb
|
168
185
|
- app/views/rosetta/local/_actions.html.erb
|
169
186
|
- app/views/rosetta/onesky/_actions.html.erb
|
170
187
|
- config/routes.rb
|
@@ -176,12 +193,13 @@ files:
|
|
176
193
|
- lib/rosetta/engine.rb
|
177
194
|
- lib/rosetta/i18n_with_stored_phrases.rb
|
178
195
|
- lib/rosetta/phrase.rb
|
196
|
+
- lib/rosetta/repositories/database.rb
|
179
197
|
- lib/rosetta/repositories/local.rb
|
180
198
|
- lib/rosetta/repositories/onesky.rb
|
181
199
|
- lib/rosetta/repositories/onesky/languages_ids.yml
|
182
200
|
- lib/rosetta/repository.rb
|
183
201
|
- lib/rosetta/version.rb
|
184
|
-
homepage: https://github.com/MarsBased/rosetta
|
202
|
+
homepage: https://github.com/MarsBased/rosetta-gem
|
185
203
|
licenses:
|
186
204
|
- MIT
|
187
205
|
metadata: {}
|
@@ -200,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
218
|
- !ruby/object:Gem::Version
|
201
219
|
version: '0'
|
202
220
|
requirements: []
|
203
|
-
|
204
|
-
rubygems_version: 2.7.7
|
221
|
+
rubygems_version: 3.0.1
|
205
222
|
signing_key:
|
206
223
|
specification_version: 4
|
207
224
|
summary: Rosetta makes it easy for copy writers to edit the translations of your app.
|