tml-rails 4.3.12 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b99954162afccc06283b59f526bf8ebb2eb735e
4
- data.tar.gz: eba2b34a477f65e4af4a79417f61546b42c1124e
3
+ metadata.gz: c160510b6789f81b1b1851264330c2940c4a5d40
4
+ data.tar.gz: 4ca5ca0a5a41ff31480bb230dbfd90bc595ba402
5
5
  SHA512:
6
- metadata.gz: 2a47c866518fda743e215354f77e9124c08925c16ada7d1c632b3d1d7973955a93815dd46ca0b899be572c369d8433f7ed778cca8a8c500e07a0e95536792392
7
- data.tar.gz: 441257c0e155cff8c6246e5ff48ec4e04bcc18f03cd4276e0e98c61a789661c8cbbe5d377848c9707493548c09be040f1fc127e4d1fc300390e0d6de3d389bf2
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.cache.upgrade_version
37
- redirect_back
38
- end
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("Powered by {trex}", :trex => link_to("TranslationExchange.com", "http://translationexchange.com", :style=>"color:#ccc;")) %>
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
- <% if tml_session.tools_enabled? %>
11
- <script>
12
- (function() {
13
- if (window.tml_already_initialized) return;
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
- var script = window.document.createElement('script');
17
- script.setAttribute('id', 'tml-tools');
18
- script.setAttribute('type', 'application/javascript');
19
- script.setAttribute('src', '<%= tml_application.tools['javascript'] %>');
20
- script.setAttribute('charset', 'UTF-8');
21
- script.onload = function() {
22
- Tml.Utils.insertCSS(window.document, "<%= tml_application.tools['stylesheet'] %>", false);
23
- Tml.app_key = '<%= tml_application.key %>';
24
- Tml.host = '<%= tml_application.tools['host'] %>';
25
- Tml.locale = '<%= tml_current_language.locale %>';
26
- Tml.sources = [];
27
- <%
28
- if tml_application.feature_enabled?(:shortcuts)
29
- tml_application.shortcuts.each do |key, script|
30
- %>
31
- shortcut.add('<%=key.html_safe%>', function() {<%= script.html_safe %>});
32
- <%
33
- end
34
- end
35
- %>
36
- if (typeof(tml_on_ready) === 'function') {
37
- tml_on_ready();
38
- }
39
- };
40
- window.document.getElementsByTagName('head')[0].appendChild(script);
41
- })();
42
- </script>
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
@@ -31,6 +31,4 @@
31
31
 
32
32
  Rails.application.routes.draw do
33
33
  get '/tml/upgrade' => 'tml_rails/tools#upgrade'
34
- get '/tml/on' => 'tml_rails/tools#enable'
35
- get '/tml/off' => 'tml_rails/tools#disable'
36
34
  end
@@ -94,4 +94,5 @@ class Tml::CacheAdapters::Rails < Tml::Cache
94
94
  rescue Exception => ex
95
95
  warn("Failed to clear cache: #{ex.message}")
96
96
  end
97
+
97
98
  end
@@ -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
- :tools_enabled => tml_tools_enabled?,
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 defined? I18n.enforce_available_locales
129
- I18n.enforce_available_locales = false
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
 
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module TmlRails
33
- VERSION = '4.3.12'
33
+ VERSION = '4.4.1'
34
34
  end
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.3.12
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-03-26 00:00:00.000000000 Z
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.3'
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.3'
40
+ version: '4.4'
41
41
  description: Client SDK for Translation Exchange.
42
42
  email:
43
43
  - michael@translationexchange.com