phraseapp-in-context-editor-ruby 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phraseapp-in-context-editor-ruby/api_wrapper.rb +3 -3
- data/lib/phraseapp-in-context-editor-ruby/delegate/i18n.rb +1 -1
- data/lib/phraseapp-in-context-editor-ruby/version.rb +1 -1
- data/lib/phraseapp-in-context-editor-ruby/view_helpers.rb +21 -18
- data/phraseapp-in-context-editor-ruby.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 604cd00f00973ae2d407cb71c7a30368f9bea5ad
|
4
|
+
data.tar.gz: 29d19946b640f989bede4f58f901de106f514235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828075464a99ba279d918bfb7402b47fd76d669cb425cfb031af26d1e267525eba43f24f56234c3dae3ccc65b8e0d5901c2d91cd148af78be141626ca8bb058b
|
7
|
+
data.tar.gz: 1d4af8782257326396c0847adc79161389b8e3f0bdd5872c7e6954af83de303a0e3e34eaf97d369d89ef4245778efdce282c17cfdd3c89da3866eb101a7b26f1
|
@@ -20,18 +20,18 @@ module PhraseApp
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def keys_with_prefix(prefix)
|
23
|
-
params = PhraseApp::RequestParams::
|
23
|
+
params = PhraseApp::RequestParams::KeysSearchParams.new(q:"#{prefix}*")
|
24
24
|
keys_list(params)
|
25
25
|
end
|
26
26
|
|
27
27
|
def keys_by_names(names)
|
28
28
|
names = names.join(',')
|
29
|
-
params = PhraseApp::RequestParams::
|
29
|
+
params = PhraseApp::RequestParams::KeysSearchParams.new(:q => "name:#{names}")
|
30
30
|
keys_list(params)
|
31
31
|
end
|
32
32
|
|
33
33
|
def keys_list(params)
|
34
|
-
PhraseApp::InContextEditor::ApiCollection.new(@api_client, "
|
34
|
+
PhraseApp::InContextEditor::ApiCollection.new(@api_client, "keys_search", project_id, params).collection
|
35
35
|
end
|
36
36
|
|
37
37
|
def blacklisted_keys
|
@@ -34,7 +34,7 @@ module PhraseApp
|
|
34
34
|
data.send(*args, &block)
|
35
35
|
else
|
36
36
|
self.class.log "You tried to execute the missing method ##{args.first} on key #{@key} which is not supported. Please make sure you treat your translations as strings only."
|
37
|
-
original_translation = I18n.translate_without_phraseapp(*@original_args)
|
37
|
+
original_translation = ::I18n.translate_without_phraseapp(*@original_args)
|
38
38
|
original_translation.send(*args, &block)
|
39
39
|
end
|
40
40
|
end
|
@@ -1,27 +1,30 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module PhraseApp
|
2
4
|
module InContextEditor
|
3
5
|
module ViewHelpers
|
4
|
-
def phraseapp_in_context_editor_js
|
6
|
+
def phraseapp_in_context_editor_js(opts={})
|
5
7
|
return "" unless PhraseApp::InContextEditor.enabled?
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
opts = opts.nil? ? {} : opts.inject({}) { |conf, (k,v)| conf[k.to_s] = v; conf} # stringify to reduce possible errors when passing symbols
|
10
|
+
configuration = {
|
11
|
+
'projectId' => PhraseApp::InContextEditor.project_id,
|
12
|
+
'prefix' => PhraseApp::InContextEditor.prefix,
|
13
|
+
'suffix' => PhraseApp::InContextEditor.suffix,
|
14
|
+
'apiBaseUrl' => "#{PhraseApp::InContextEditor.api_host}/api/v2",
|
15
|
+
}.merge(opts)
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
eos
|
24
|
-
js.respond_to?(:html_safe) ? js.html_safe : js
|
17
|
+
snippet = <<-eos
|
18
|
+
<script>
|
19
|
+
window.PHRASEAPP_CONFIG = #{configuration.to_json};
|
20
|
+
(function() {
|
21
|
+
var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true;
|
22
|
+
phraseapp.src = ['#{PhraseApp::InContextEditor.js_use_ssl ? 'https' : 'http'}://', '#{PhraseApp::InContextEditor.js_host}/assets/in-context-editor/2.0/app.js?', new Date().getTime()].join('');
|
23
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s);
|
24
|
+
})();
|
25
|
+
</script>
|
26
|
+
eos
|
27
|
+
snippet.respond_to?(:html_safe) ? snippet.html_safe : snippet
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
s.add_dependency('json', '~> 1.8')
|
24
24
|
s.add_dependency('i18n', '~> 0.7')
|
25
|
-
s.add_dependency('phraseapp-ruby', '~> 1.
|
25
|
+
s.add_dependency('phraseapp-ruby', '~> 1.2')
|
26
26
|
s.add_development_dependency('rspec', '~> 3.2')
|
27
27
|
s.add_development_dependency('webmock', '~> 1.21')
|
28
28
|
s.add_development_dependency('vcr', '~> 2.9')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phraseapp-in-context-editor-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dynport GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,9 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: 1.3.6
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project: phraseapp-in-context-editor-ruby
|
179
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.2.1
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: Translation management solution for web and mobile applications
|
183
183
|
test_files: []
|
184
|
-
has_rdoc:
|