tml-rails 5.2.9 → 5.2.10

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: 8ba3590d39bffb4d6aaf4d85b218bdbbe7354fb4
4
- data.tar.gz: f6cb9be4063a57616502a35e3429c4a3f2a4b5a1
3
+ metadata.gz: 10e00976717eba544565f915477a05253594f482
4
+ data.tar.gz: 998dc4e52809973ddfbc7e7966dcb5e5030cd4e7
5
5
  SHA512:
6
- metadata.gz: ba5ba1e6e3c02eee8965c4a5f0df28c369f92b3377f3dd17e9a3bde47da7066cb27b0e4e40180101f8958e8291d153705747ba4240a365ab1803f6cb93e3a3e7
7
- data.tar.gz: 9ffb7d76158d96960d71e81eda8e1dd4108323b06cce632ebcf642b27309c6f20f1d374be34e515baf42253298064b06d9c3f35957706000e58e0c102ba4b9e2
6
+ metadata.gz: 029012c3c9ae7e18d7643f37016bae17a3459840c1959475f27de0db5fc34a35e1c298729ed248f9146ab22e293cc1b942ce90d33838ba8d5f22623ad7043630
7
+ data.tar.gz: 3f94fffb02897b5065d6b9abdd1b176e0bc03a0fea4af75fcce68521bdf27d6b046a8cde5435c5e6e48b99d615dd0fcf678c94249fef603d2cb0395e1578a743
@@ -93,30 +93,50 @@ module TmlRails
93
93
  type ||= :default
94
94
  type = :dropdown if type == :select
95
95
 
96
- unless [:bootstrap, :default, :inline, :dropdown, :popup, :flags].include?(type.to_sym)
97
- return "Unsupported language selector #{type}"
98
- end
99
-
100
- render(:partial => "/tml_rails/tags/language_selector_#{type}", :locals => {:opts => opts})
96
+ opts = opts.collect{|key, value| "data-tml-#{key}='#{value}'"}.join(' ')
97
+ "<div data-tml-language-selector='#{type}' #{opts}></div>".html_safe
101
98
  end
102
99
 
103
- # Returns language strip UI
104
- def tml_language_strip_tag(opts = {})
105
- opts[:flag] = opts[:flag].nil? ? false : opts[:flag]
106
- opts[:name] = opts[:name].nil? ? :native : opts[:name]
107
- opts[:linked] = opts[:linked].nil? ? true : opts[:linked]
108
- opts[:javascript] = opts[:javascript].nil? ? false : opts[:javascript]
100
+ def tml_scripts_tag(opts = {})
101
+ agent_config = Tml.config.respond_to?(:agent) ? Tml.config.agent : {}
109
102
 
110
- render(:partial => '/tml_rails/tags/language_strip', :locals => {:opts => opts})
111
- end
103
+ agent_host = agent_config[:host] || 'https://tools.translationexchange.com/agent/stable/agent.min.js'
104
+ if agent_config[:cache]
105
+ t = Time.now
106
+ t = t - (t.to_i % agent_config[:cache].to_i).seconds
107
+ agent_host += "?ts=#{t.to_i}"
108
+ end
112
109
 
113
- # Translates flashes
114
- def tml_flashes_tag(opts = {})
115
- render(:partial => '/tml_rails/tags/flashes', :locals => {:opts => opts})
116
- end
110
+ agent_config[:locale] = tml_current_locale
111
+ agent_config[:source] = tml_current_source
112
+ agent_config[:css] = tml_application.css
113
+ agent_config[:sdk] = Tml.respond_to?(:full_version) ? Tml.full_version : Tml::VERSION
114
+ agent_config[:languages] = []
115
+
116
+ tml_application.languages.each do |lang|
117
+ agent_config[:languages] << {
118
+ locale: lang.locale,
119
+ english_name: lang.english_name,
120
+ native_name: lang.native_name,
121
+ flag_url: lang.flag_url
122
+ }
123
+ end
117
124
 
118
- def tml_scripts_tag(opts = {})
119
- render(:partial => '/tml_rails/tags/scripts', :locals => {:opts => opts})
125
+ html = []
126
+ html << '<script>'
127
+ html << '(function() {'
128
+ html << "var script = window.document.createElement('script');"
129
+ html << "script.setAttribute('id', 'tml-agent');"
130
+ html << "script.setAttribute('type', 'application/javascript');"
131
+ html << "script.setAttribute('src', '#{agent_host}');"
132
+ html << "script.setAttribute('charset', 'UTF-8');"
133
+ html << 'script.onload = function() {'
134
+ html << " Trex.init('#{tml_application.key}', #{agent_config.to_json.html_safe});"
135
+ html << '};'
136
+ html << "window.document.getElementsByTagName('head')[0].appendChild(script);"
137
+ html << '})();'
138
+ html << '</script>'
139
+ html.join.html_safe
120
140
  end
121
141
 
122
142
  def tml_select_month(date, options = {}, html_options = {})
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module TmlRails
33
- VERSION = '5.2.9'
33
+ VERSION = '5.2.10'
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: 5.2.9
4
+ version: 5.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -49,18 +49,6 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - app/controllers/tml_rails/tools_controller.rb
52
- - app/views/tml_rails/tags/_language_selector_bootstrap.html.erb
53
- - app/views/tml_rails/tags/_language_selector_default.html.erb
54
- - app/views/tml_rails/tags/_language_selector_dropdown.html.erb
55
- - app/views/tml_rails/tags/_language_selector_flags.html.erb
56
- - app/views/tml_rails/tags/_language_selector_inline.html.erb
57
- - app/views/tml_rails/tags/_language_selector_js.html.erb
58
- - app/views/tml_rails/tags/_language_selector_popup.html.erb
59
- - app/views/tml_rails/tags/_language_strip.html.erb
60
- - app/views/tml_rails/tags/_powered_by_trex.html.erb
61
- - app/views/tml_rails/tags/_scripts.html.erb
62
- - app/views/tml_rails/tags/_scripts_agent.html.erb
63
- - app/views/tml_rails/tags/_scripts_tools.html.erb
64
52
  - config/routes.rb
65
53
  - lib/i18n/backend/tml.rb
66
54
  - lib/tasks/templates/tml.rb
@@ -1,83 +0,0 @@
1
- <%
2
- opts[:element] ||= 'div'
3
- opts[:class] ||= 'dropdown'
4
- %>
5
-
6
- <style>
7
- .trex-dropdown {
8
- text-align:<%= tml_current_language.align("left") %>;
9
- }
10
- .trex-dropdown .trex-dropdown-menu {
11
- min-width:200px;
12
- }
13
- .trex-native-name {
14
- padding: 0px 5px;
15
- color: #ccc;
16
- font-size: 10px;
17
- }
18
- .trex-dropdown .trex-dropdown-footer {
19
- font-size:10px;
20
- color:#ccc;
21
- text-align: center;
22
- background: #f5f5f5;
23
- padding:5px;
24
- margin-top: -10px;
25
- margin-bottom: -5px;
26
- border-bottom-left-radius: 5px;
27
- border-bottom-right-radius: 5px;
28
- }
29
- </style>
30
-
31
-
32
- <% if opts[:element] %>
33
- <<%= opts[:element] %> class="trex-language-selector trex-dropdown <%= opts[:class] %>" style="<%= opts[:style] %>">
34
- <% end %>
35
-
36
- <a href="#" role="button" class="<%= opts[:class] || 'dropdown' %>-toggle" data-toggle="dropdown" dir="<%= tml_current_language.dir %>">
37
- <%= tml_language_name_tag(tml_current_language, opts) %>
38
- </a>
39
-
40
- <ul class="dropdown-menu trex-dropdown-menu">
41
-
42
- <% tml_application.languages.each do |lang| %>
43
-
44
- <li dir="<%= tml_current_language.dir %>">
45
- <% if Tml.config.locale[:subdomain] %>
46
- <%=link_to(tml_subdomain_locale_url(lang.locale)) do %>
47
- <%= tml_language_name_tag(lang, opts) %>
48
- <% end %>
49
- <% else %>
50
- <%=link_to({:locale => lang.locale}) do %>
51
- <%= tml_language_name_tag(lang, opts) %>
52
- <% end %>
53
- <% end %>
54
- </li>
55
-
56
- <% end %>
57
-
58
- <% if opts[:toggle] %>
59
- <li role='presentation' class='divider'></li>
60
- <li role='presentation'>
61
- <a href='javascript:void(0);' onclick='Tml.Utils.toggleInlineTranslations()'>
62
- <% if Tml.session.inline_mode? %>
63
- <%= tr(opts[:toggle_label_close] || 'Disable Translation Mode') %>
64
- <% else %>
65
- <%= tr(opts[:toggle_label] || 'Help Us Translate') %>
66
- <% end %>
67
- </a>
68
- </li>
69
- <% end %>
70
-
71
- <li role='presentation' class='divider'></li>
72
-
73
- <div class="trex-dropdown-footer">
74
- <a href="http://translationexchange.com" style="color: #888;">
75
- <%= tr('Powered By {brand}', brand: 'Translation Exchange') %>
76
- </a>
77
- </div>
78
- </ul>
79
-
80
- <% if opts[:element] %>
81
- </<%= opts[:element] %>>
82
- <% end %>
83
-
@@ -1,17 +0,0 @@
1
- <%= link_to('#',
2
- :onclick => opts[:method] || 'Tml.UI.LanguageSelector.show(); return false;',
3
- :style => (opts[:style] || 'padding-right:5px;text-decoration:none'),
4
- :class => opts[:class]
5
- ) do %>
6
- <% unless opts[:hide_flag] %>
7
- <%= image_tag(tml_current_language.flag_url, :style => "align:middle") %>
8
- &nbsp;
9
- <% end %>
10
- <% if opts[:language] == :native %>
11
- <%= tml_current_language.native_name %>
12
- <% elsif opts[:language] == :english %>
13
- <%= tml_current_language.english_name %>
14
- <% else %>
15
- <%= tml_current_language.english_name %>
16
- <% end %>
17
- <% end %>
@@ -1,24 +0,0 @@
1
- <%= render(:partial => '/tml_rails/tags/language_selector_js') %>
2
-
3
- <% if opts[:element] %>
4
- <<%= opts[:element] %> class="trex-language-selector <%= opts[:class] %>" style="<%= opts[:style] %>">
5
- <% end %>
6
-
7
- <select id="tml_language_selector" onchange="tml_change_locale(this.options[this.selectedIndex].value)" style="<%=opts[:style]%>" class="<%=opts[:class]%>">
8
- <% tml_application.languages.each do |lang| %>
9
- <option dir='ltr' value="<%=lang.locale%>" <%="selected" if lang.locale == tml_current_locale %>>
10
- <% if opts[:language].to_sym == :native %>
11
- <%= lang.native_name %>
12
- <% elsif opts[:language].to_sym == :english %>
13
- <%= lang.english_name %>
14
- <% else %>
15
- <%= lang.english_name %>
16
- <% end %>
17
- </option>
18
- <% end %>
19
- </select>
20
-
21
- <% if opts[:element] %>
22
- </<%= opts[:element] %>>
23
- <% end %>
24
-
@@ -1,19 +0,0 @@
1
- <% if opts[:element] %>
2
- <<%= opts[:element] %> class="trex-language-selector <%= opts[:class] %>" style="<%= opts[:style] %>">
3
- <% end %>
4
-
5
- <div style="<%=opts[:style]%>" class="trex-language-selector <%=opts[:class]%>">
6
-
7
- <% tml_application.languages.each_with_index do |lang, index| %>
8
-
9
- <%= link_to(params.merge(:locale => lang.locale), :style => (opts[:style] || 'padding-right:5px;text-decoration:none'), :class => opts[:class]) do %>
10
- <%= image_tag(lang.flag_url) %>
11
- <% end %>
12
-
13
- <% end %>
14
-
15
- </div>
16
-
17
- <% if opts[:element] %>
18
- </<%= opts[:element] %>>
19
- <% end %>
@@ -1,15 +0,0 @@
1
- <div style="<%=opts[:style]%>" class="<%=opts[:class]%>">
2
- <% tml_application.languages.each_with_index do |lang, index| %>
3
- <% next if opts[:limit] and index >= opts[:limit] %>
4
-
5
-
6
- <%= link_to(params.merge(:locale => lang.locale), :style => (opts[:style] || 'padding-right:5px;text-decoration:none'), :class => opts[:class]) do %>
7
- <% if opts[:flags_only] or opts[:flags] %>
8
- <%= image_tag(lang.flag_url) %>
9
- <% else %>
10
- <%= tml_language_name_tag(lang, opts) %>
11
- <% end %>
12
- <% end %>
13
-
14
- <% end %>
15
- </div>
@@ -1,32 +0,0 @@
1
- <script>
2
- function tml_change_locale(locale) {
3
- var query_parts = window.location.href.split('#');
4
- var anchor = query_parts.length > 1 ? query_parts[1] : null;
5
- query_parts = query_parts[0].split('?');
6
- var query = query_parts.length > 1 ? query_parts[1] : null;
7
-
8
- var params = {};
9
- if (query) {
10
- var vars = query.split('&');
11
- for (var i = 0; i < vars.length; i++) {
12
- var pair = vars[i].split('=');
13
- params[pair[0]] = pair[1];
14
- }
15
- }
16
- params['locale'] = locale;
17
-
18
- query = [];
19
- var keys = Object.keys(params);
20
- for (i = 0; i < keys.length; i++) {
21
- query.push(keys[i] + "=" + params[keys[i]]);
22
- }
23
-
24
- var destination = query_parts[0];
25
- if (query.length > 0)
26
- destination = destination + '?' + query.join("&");
27
- if (anchor)
28
- destination = destination + '#' + anchor;
29
-
30
- window.location = destination;
31
- }
32
- </script>
@@ -1,158 +0,0 @@
1
- <%
2
- opts[:element] ||= 'div'
3
- opts[:class] ||= 'dropdown'
4
- %>
5
-
6
- <style>
7
- .trex-language-selector {position: relative;display: inline-block;vertical-align: middle;}
8
- .trex-language-toggle,
9
- .trex-language-toggle:hover,
10
- .trex-language-toggle:focus {cursor:pointer;text-decoration:none;outline:none;}
11
- .trex-dropup .trex-dropdown-menu {top: auto;bottom: 100%;margin-bottom: 1px;-webkit-transform: scale(0.8) translateY(10%);transform: scale(0.8) translateY(10%);}
12
- .trex-dropleft .trex-dropdown-menu {left: auto; right: 0;}
13
- .trex-dropdown-menu {
14
- -webkit-transform: scale(0.8) translateY(10%);transform: scale(0.8) translateY(10%);transition: 0.13s cubic-bezier(0.3, 0, 0, 1.3);opacity: 0;pointer-events: none;
15
- display: block;font-family:Arial, sans-serif;position: absolute;
16
- top: 100%;left: 0;z-index: 1000;float: left;list-style: none;background-color: #FFF;height:0px;width:0px;padding:0;overflow:hidden;
17
- }
18
- .trex-language-selector[dir=rtl] .trex-dropdown-menu {left: auto; right: 0;}
19
- .trex-language-selector.trex-dropleft[dir=rtl] .trex-dropdown-menu {left:0; right:auto;}
20
- .trex-language-selector.trex-open .trex-dropdown-menu {
21
- opacity: 1;height:auto;width:auto;overflow:hidden;min-width: 250px;margin: 2px 0 0;font-size: 13px;
22
- background-clip: padding-box;border: 1px solid rgba(0, 0, 0, 0.15);box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
23
- border-radius: 4px;color: #6D7C88;text-align: left;padding: 5px 0;
24
- display:block;pointer-events: auto;-webkit-transform: none;transform: none;
25
- }
26
- .trex-dropdown-menu > li {
27
- text-align:<%= tml_current_language.align('left') %>;
28
- }
29
- .trex-dropdown-menu > li > a {
30
- display: block;padding: 3px 10px;margin:0 5px;clear: both;font-weight: normal;line-height: 1.42857143;color: #333;border-radius:3px;white-space: nowrap;cursor:pointer;
31
- }
32
- .trex-dropdown-menu > li > a .trex-flag {margin-right:3px;width:23px;}
33
- .trex-dropdown-menu > li.trex-language-item > a:hover,
34
- .trex-dropdown-menu > li.trex-language-item > a:focus {text-decoration:none;background: #F0F2F4;}
35
- .trex-dropdown-menu > li.trex-language-item > a .trex-native-name {font-size: 11px;color: #A9AFB8;margin-left: 3px;}
36
- .trex-dropdown-menu > li.trex-selected a:after {content: '✓';right: 5px;font-weight: bold;font-size: 16px;margin: 0px 5px 0px 0px;color: #13CF80;position: absolute;}
37
- .trex-dropdown-menu[dir=rtl] > li.trex-selected a:after {left: 5px;right:auto;margin: 0px 0 0px 5px;}
38
- .trex-dropdown-menu .trex-credit a {border-top: solid 1px #DDD;font-size: 13px;padding: 7px 0 0;margin: 5px 15px 5px;color: #9FA7AE;font-weight: 400;}
39
- </style>
40
-
41
-
42
- <<%= opts[:element] %> class="trex-language-selector" dir="<%= tml_current_language.dir %>">
43
- <a class="trex-language-toggle" data-toggle="language-selector" tabindex="0" dir="<%= tml_current_language.dir %>">
44
- <%= tml_language_name_tag(tml_current_language, opts) %>
45
- </a>
46
- <ul class="trex-dropdown-menu" dir="<%= tml_current_language.dir %>">
47
- <% tml_application.languages.each do |lang| %>
48
-
49
- <li class="trex-language-item <%='trex-selected' if tml_current_language.locale == lang.locale %>" dir="<%= tml_current_language.dir %>">
50
- <%=link_to({:locale => lang.locale}) do %>
51
- <%= tml_language_name_tag(lang, opts.merge(:language => :both)) %>
52
- <% end %>
53
- </li>
54
-
55
- <% end %>
56
-
57
- <% if opts[:toggle] %>
58
- <li class='trex-credit' dir="<%= tml_current_language.dir %>">
59
- <a href='javascript:void(0);' onclick='Tml.Utils.toggleInlineTranslations()'>
60
- <% if Tml.session.inline_mode? %>
61
- <%= tr(opts[:toggle_label_close] || 'Disable Translation Mode') %>
62
- <% else %>
63
- <%= tr(opts[:toggle_label] || 'Help Us Translate') %>
64
- <% end %>
65
- </a>
66
- </li>
67
- <% end %>
68
-
69
- <li class="trex-credit" dir="<%= tml_current_language.dir %>">
70
- <a href="http://translationexchange.com">
71
- <%= tr('Powered By {brand}', brand: 'Translation Exchange') %>
72
- </a>
73
- </li>
74
- </ul>
75
- </<%= opts[:element] %>>
76
-
77
-
78
- <script>
79
- (function() {
80
- 'use strict';
81
-
82
- // utilities
83
- function addEvent(evnt, elem, func) {
84
- if (elem.addEventListener) elem.addEventListener(evnt,func,false);
85
- else if (elem.attachEvent) elem.attachEvent("on"+evnt, func);
86
- else elem[evnt] = func;
87
- }
88
-
89
- function hasClass(elem, cls) {
90
- return elem.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
91
- }
92
-
93
- function addClass(elem, cls) {
94
- if (!hasClass(elem, cls)) elem.className += " " + cls;
95
- }
96
-
97
- function removeClass(elem, cls) {
98
- if (hasClass(elem, cls)) {
99
- var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
100
- elem.className = elem.className.replace(reg, ' ');
101
- }
102
- }
103
-
104
- function toggleClass(elem, cls) {
105
- if (!hasClass(elem, cls)) addClass(elem, cls);
106
- else removeClass(elem, cls);
107
- }
108
-
109
- var LanguageSelector = function(element) {
110
- this.element = element;
111
- this.element.setAttribute('tabindex', '0');
112
- addEvent('click', this.element, this.open.bind(this))
113
- addEvent('blur', this.element, this.close.bind(this))
114
- };
115
-
116
- LanguageSelector.VERSION = "0.1.0";
117
- LanguageSelector.prototype = {
118
- adjustMenu: function(parent){
119
- removeClass(parent, "trex-dropup");
120
- removeClass(parent, "trex-dropleft");
121
- var
122
- menu = parent.querySelectorAll('.trex-dropdown-menu')[0],
123
- bounds = menu.getBoundingClientRect(),
124
- vHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
125
- vWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
126
- buffer = 10;
127
-
128
- if(bounds.top + menu.offsetHeight + buffer > vHeight) addClass(parent, "trex-dropup");
129
- if(bounds.left + menu.offsetWidth + buffer > vWidth) addClass(parent, "trex-dropleft");
130
- },
131
- open: function(e){
132
-
133
- e = e || window.event;
134
- e.stopPropagation();
135
- e.preventDefault();
136
- var target = e.currentTarget || e.srcElement;
137
- if(hasClass(target.parentElement,'trex-open')) {
138
- return this.close(e);
139
- }
140
- addClass(target.parentElement,'trex-open');
141
- this.adjustMenu(target.parentElement);
142
- return false;
143
- },
144
- close: function(e) {
145
- e = e || window.event;
146
- var target = e.currentTarget || e.srcElement;
147
- setTimeout(function(){
148
- removeClass(target.parentElement, 'trex-open');
149
- }, 500); //hmmm
150
- }
151
- };
152
- var selectorList = document.querySelectorAll('[data-toggle=language-selector]');
153
- for (var i = 0, el, l = selectorList.length; i < l; i++) {
154
- el = selectorList[i];
155
- el.languageSelector = new LanguageSelector(el);
156
- }
157
- })();
158
- </script>
@@ -1,20 +0,0 @@
1
- <% if Tml.config.enabled? %>
2
- <% featured_languages = tml_application.featured_languages %>
3
- <% if featured_languages.any? %>
4
- <style>
5
- .tml_language_strip {text-align:center; color:#777;}
6
- .tml_language_strip a {text-decoration:none; color:#777; outline:none; border:0px; font-size:10px;}
7
- .tml_language_strip a img {border:0px;}
8
- .tml_language_strip a:hover {text-decoration:underline}
9
- </style>
10
- <div class="tml_language_strip" style="font-size:12px;">
11
- <% featured_languages.each do |lang| %>
12
- <%= tml_language_name_tag(lang, opts) %> &nbsp;
13
- <% end %>
14
-
15
- <% if featured_languages.size > 0 %>
16
- <%=link_to_function("&raquo;".html_safe, "Tml.UI.LanguageSelector.show()") %>
17
- <% end %>
18
- </div>
19
- <% end %>
20
- <% end %>
@@ -1,18 +0,0 @@
1
- <div style="padding-top:40px; color: #ccc; text-align:center; width:100%">
2
- <%= tr('Powered by {company}', :company => link_to('TranslationExchange.com', 'http://translationexchange.com', :style=>"color:#ccc;")) %>
3
-
4
- <style>
5
- .trex_logo {
6
- margin-top:10px;
7
- padding: 40px;
8
- background-repeat: no-repeat;
9
- background-image:url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAABQCAYAAABCiMhGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCQTg4MTEyOEU0NkIxMUUzODhCMEJEOUNDRDQ0QkU0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCQTg4MTEyOUU0NkIxMUUzODhCMEJEOUNDRDQ0QkU0MiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkJBODgxMTI2RTQ2QjExRTM4OEIwQkQ5Q0NENDRCRTQyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkJBODgxMTI3RTQ2QjExRTM4OEIwQkQ5Q0NENDRCRTQyIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+mszKSAAAAqFJREFUeNrsnE1IFVEYhr+53QiKEIkgpCBwJSH9SITkqkVELXJZ0iYIqRaBCZWgoWKikRBI1KVNmyg3gVKQ0CZE+9kHQYukaGP2I6iEP1ffc+dc7iwK5s5Mx3PPvC88zGxm5s4zc85853JmvNardwTxwC1wGuyWdGQGvARduaH23wUJkJHFcgoclnTmKzgIIT8yWOlNsQiVPeB+8c74hmWNMNXqzqimh0JqlIxVeigkr2Tk6aGQtQwdlEIZlEEZlEEZEZONuf0YmASLYNNGPRI1e8FFsHUjZNwAg5Zd3GHwHuw02Uw+WShCZRr0m+4zPljc9D+alpG1WMYW0zJsfgplxMGTYp1BGZRBGZRBGZRBGZRBGZRBGZRBGQxlUAZlUAZlUAZlUAZlUAZlUAZlUIbDMmyeYr3KO6OUJdMyGiyWcdS0DPV+ykMLRRwD16JuHGc60gV9Fd6KP/Vxs/hTEDvBbIT9nQLNEdp8XkpTH0/GMRl3bladJpi7EWQcB89dfLSW24EdAeOsM0T2gQkWXX4bf6P7mlTL2KFFbE97Ob4NvAO70j42UcdTbyHU2jo28Qwe7zXYb2nl6mXE3DzwF6DJ5kGrkjFv4EBP4laHBjKjZDz7zwfJgTOWi3iVG2qfVTKui//ZhMTaXmD9Hmi1XMSf4m9UMubAIfAY/Epg58t62QcuWyxhQfx37A7grvgcHKipgdU5UPWX538LuBlh8Deu+4oVS2X8BN8h4p+j1jlNMOW+5lQ8+QmpsIQpusr5vsYV8EUqNElWoKojHpYKTlIyusFtqfAkIWMA9IgDiStD/cXXIY4kjowHoE0cSlQZj8AlcSxRZDwF58XBhJGxFlgfBWfF0YSR4QXK62ZxOGFk1OtR7QlxPGFkjIBGSUHWBRgAlJNpO4bVinwAAAAASUVORK5CYII=);
10
- }
11
- </style>
12
-
13
- <div style="text-align: center">
14
- <%=link_to('http://translationexchange.com') do %>
15
- <img class="trex_logo" src="" alt="" />
16
- <% end %>
17
- </div>
18
- </div>
@@ -1,9 +0,0 @@
1
- <% if Tml.config.enabled? %>
2
- <% if Tml.config.respond_to?(:agent) and Tml.config.agent %>
3
- <% if Tml.config.agent[:type].to_s == 'tools' %>
4
- <%= render(:partial => '/tml_rails/tags/scripts_tools') %>
5
- <% else %>
6
- <%= render(:partial => '/tml_rails/tags/scripts_agent') %>
7
- <% end %>
8
- <% end %>
9
- <% end %>
@@ -1,34 +0,0 @@
1
- <script>
2
- <%
3
- agent_host = Tml.config.agent[:host] || 'https://tools.translationexchange.com/agent/stable/agent.min.js'
4
- if Tml.config.agent[:cache]
5
- t = Time.now
6
- t = t - (t.to_i % Tml.config.agent[:cache].to_i).seconds
7
- agent_host += "?ts=#{t.to_i}"
8
- end
9
-
10
- agent_config = Tml.config.agent
11
- agent_config[:css] = tml_application.css
12
- agent_config[:sdk] = Tml.respond_to?(:full_version) ? Tml.full_version : Tml::VERSION
13
- agent_config[:languages] = []
14
- tml_application.languages.each do |lang|
15
- agent_config[:languages] << {
16
- locale: lang.locale,
17
- english_name: lang.english_name,
18
- native_name: lang.native_name,
19
- flag_url: lang.flag_url
20
- }
21
- end
22
- %>
23
- (function() {
24
- var script = window.document.createElement('script');
25
- script.setAttribute('id', 'tml-agent');
26
- script.setAttribute('type', 'application/javascript');
27
- script.setAttribute('src', '<%= agent_host %>');
28
- script.setAttribute('charset', 'UTF-8');
29
- script.onload = function() {
30
- Trex.init("<%=tml_application.key%>", <%=agent_config.to_json.html_safe%>);
31
- };
32
- window.document.getElementsByTagName('head')[0].appendChild(script);
33
- })();
34
- </script>
@@ -1,40 +0,0 @@
1
- <style type="text/css">
2
- .tml_fltr {<%=tml_style_attribute_tag('float', 'right')%> !important;}
3
- .tml_fltl {<%=tml_style_attribute_tag('float', 'left')%> !important;}
4
- .tml_txtr {<%=tml_style_attribute_tag('text-align', 'right')%> !important;}
5
- .tml_txtl {<%=tml_style_attribute_tag('text-align', 'left')%> !important;}
6
- <%= tml_application.css %>
7
- </style>
8
-
9
- <script>
10
- (function() {
11
- if (window.tml_already_initialized) return;
12
- window.tml_already_initialized = true;
13
-
14
- var script = window.document.createElement('script');
15
- script.setAttribute('id', 'tml-tools');
16
- script.setAttribute('type', 'application/javascript');
17
- script.setAttribute('src', '<%= tml_application.tools['javascript'] %>');
18
- script.setAttribute('charset', 'UTF-8');
19
- script.onload = function() {
20
- Tml.Utils.insertCSS(window.document, "<%= tml_application.tools['stylesheet'] %>", false);
21
- Tml.app_key = '<%= tml_application.key %>';
22
- Tml.host = '<%= tml_application.tools['host'] %>';
23
- Tml.locale = '<%= tml_current_language.locale %>';
24
- Tml.current_source = '<%= tml_current_source %>';
25
- <%
26
- if tml_application.feature_enabled?(:shortcuts)
27
- tml_application.shortcuts.each do |key, script|
28
- %>
29
- shortcut.add('<%=key.html_safe%>', function() {<%= script.html_safe %>});
30
- <%
31
- end
32
- end
33
- %>
34
- if (typeof(tml_on_ready) === 'function') {
35
- tml_on_ready();
36
- }
37
- };
38
- window.document.getElementsByTagName('head')[0].appendChild(script);
39
- })();
40
- </script>