tml-rails 4.3.12 → 4.4.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/tml_rails/tools_controller.rb +3 -11
- data/app/views/tml_rails/tags/_powered_by_trex.html.erb +1 -1
- data/app/views/tml_rails/tags/_scripts.html.erb +31 -33
- data/config/routes.rb +0 -2
- data/lib/tml/cache_adapters/rails.rb +1 -0
- data/lib/tml_rails/extensions/action_controller_extension.rb +7 -23
- data/lib/tml_rails/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c160510b6789f81b1b1851264330c2940c4a5d40
|
4
|
+
data.tar.gz: 4ca5ca0a5a41ff31480bb230dbfd90bc595ba402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b0b11adeeee73c5ffd57ba1bda1e01a90cd22303dd6066c82fdfc60a2b0df00d73b3f86dc9309365a27788101a40ec7584534347aeb30413fa7073e187f30fc
|
7
|
+
data.tar.gz: d92eaf0a10c479498fceba9432b05e7cc7eed772311c42de7648ee28192fad8f53d476d0e88225556d7cf7afffa21ef492d630dcab6cf2f08fb3b13575d18635
|
@@ -33,17 +33,9 @@ module TmlRails
|
|
33
33
|
class ToolsController < ApplicationController
|
34
34
|
|
35
35
|
def upgrade
|
36
|
-
Tml.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
def enable
|
41
|
-
tml_toggle_tools(true)
|
42
|
-
redirect_back
|
43
|
-
end
|
44
|
-
|
45
|
-
def disable
|
46
|
-
tml_toggle_tools(false)
|
36
|
+
if params[:access_token] == Tml.config.access_token
|
37
|
+
Tml.cache.upgrade_version
|
38
|
+
end
|
47
39
|
redirect_back
|
48
40
|
end
|
49
41
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div style="padding-top:40px; color: #ccc; text-align:center; width:100%">
|
2
|
-
<%= tr(
|
2
|
+
<%= tr('Powered by {company}', :company => link_to('TranslationExchange.com', 'http://translationexchange.com', :style=>"color:#ccc;")) %>
|
3
3
|
|
4
4
|
<style>
|
5
5
|
.trex_logo {
|
@@ -7,38 +7,36 @@
|
|
7
7
|
<%= tml_application.css %>
|
8
8
|
</style>
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
(
|
13
|
-
|
14
|
-
window.tml_already_initialized = true;
|
10
|
+
<script>
|
11
|
+
(function() {
|
12
|
+
if (window.tml_already_initialized) return;
|
13
|
+
window.tml_already_initialized = true;
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
<% end %>
|
15
|
+
var script = window.document.createElement('script');
|
16
|
+
script.setAttribute('id', 'tml-tools');
|
17
|
+
script.setAttribute('type', 'application/javascript');
|
18
|
+
script.setAttribute('src', '<%= tml_application.tools['javascript'] %>');
|
19
|
+
script.setAttribute('charset', 'UTF-8');
|
20
|
+
script.onload = function() {
|
21
|
+
Tml.Utils.insertCSS(window.document, "<%= tml_application.tools['stylesheet'] %>", false);
|
22
|
+
Tml.app_key = '<%= tml_application.key %>';
|
23
|
+
Tml.host = '<%= tml_application.tools['host'] %>';
|
24
|
+
Tml.locale = '<%= tml_current_language.locale %>';
|
25
|
+
Tml.sources = [];
|
26
|
+
<%
|
27
|
+
if tml_application.feature_enabled?(:shortcuts)
|
28
|
+
tml_application.shortcuts.each do |key, script|
|
29
|
+
%>
|
30
|
+
shortcut.add('<%=key.html_safe%>', function() {<%= script.html_safe %>});
|
31
|
+
<%
|
32
|
+
end
|
33
|
+
end
|
34
|
+
%>
|
35
|
+
if (typeof(tml_on_ready) === 'function') {
|
36
|
+
tml_on_ready();
|
37
|
+
}
|
38
|
+
};
|
39
|
+
window.document.getElementsByTagName('head')[0].appendChild(script);
|
40
|
+
})();
|
41
|
+
</script>
|
44
42
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -68,32 +68,13 @@ module TmlRails
|
|
68
68
|
self.class.name
|
69
69
|
end
|
70
70
|
|
71
|
-
# Overwrite this method in a controller to assign a custom component for all views
|
72
|
-
def tml_component
|
73
|
-
nil
|
74
|
-
end
|
75
|
-
|
76
|
-
def tml_toggle_tools(flag)
|
77
|
-
session[:tml_tools_disabled] = !flag
|
78
|
-
end
|
79
|
-
|
80
|
-
def tml_tools_enabled?
|
81
|
-
not session[:tml_tools_disabled]
|
82
|
-
end
|
83
|
-
|
84
71
|
def tml_init_client_sdk
|
85
72
|
return if Tml.config.disabled?
|
86
73
|
|
87
74
|
@tml_started_at = Time.now
|
88
75
|
|
89
|
-
if params[:tml]
|
90
|
-
tml_toggle_tools(params[:tml] == 'on')
|
91
|
-
end
|
92
|
-
|
93
76
|
tml_session_params = {
|
94
|
-
:
|
95
|
-
:source => tml_source,
|
96
|
-
:component => tml_component
|
77
|
+
:source => tml_source
|
97
78
|
}
|
98
79
|
|
99
80
|
if Tml.config.current_user_method
|
@@ -125,10 +106,12 @@ module TmlRails
|
|
125
106
|
cookies[Tml.session.cookie_name] = Tml::Utils.encode(Tml.session.cookie_params)
|
126
107
|
end
|
127
108
|
|
128
|
-
if
|
129
|
-
I18n.enforce_available_locales
|
109
|
+
if I18n.backend.class.name == 'I18n::Backend::Tml'
|
110
|
+
if defined? I18n.enforce_available_locales
|
111
|
+
I18n.enforce_available_locales = false
|
112
|
+
end
|
113
|
+
I18n.locale = Tml.session.current_language.locale
|
130
114
|
end
|
131
|
-
I18n.locale = Tml.session.current_language.locale
|
132
115
|
end
|
133
116
|
|
134
117
|
def tml_reset_client_sdk
|
@@ -136,6 +119,7 @@ module TmlRails
|
|
136
119
|
@tml_finished_at = Time.now
|
137
120
|
tml_application.submit_missing_keys
|
138
121
|
Tml.session.reset
|
122
|
+
Tml.cache.reset_version
|
139
123
|
Tml.logger.info("Request took #{@tml_finished_at - @tml_started_at} mls") if @tml_started_at
|
140
124
|
end
|
141
125
|
|
data/lib/tml_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
33
|
+
version: '4.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '4.
|
40
|
+
version: '4.4'
|
41
41
|
description: Client SDK for Translation Exchange.
|
42
42
|
email:
|
43
43
|
- michael@translationexchange.com
|