@@ -30,26 +33,30 @@
- Translation |
- Locale |
+ |
+ Translation |
+ Locale |
<% unless lk.is_deleted? %>
- Completed |
+ Completed |
<% end %>
<%- available_locales.each do |locale| %>
<%- localization = localization_for(locale, lk) %>
+
+ <% if localization %>
+ <%= draw_icon 'clock-o', title: "Last updated at #{localization.updated_at.to_s(:db)}" %>
+ <%= link_to lit.previous_versions_localization_key_localization_path(lk, localization, format: :js), class: "js-show_prev_versions #{'hidden' unless versions?(localization)}", remote: true do %>
+ <%= draw_icon 'random', title: I18n.t('lit.common.previous_versions', default: 'Previous versions') %>
+ <% end %>
+ <% end %>
+ |
<%= render partial: 'localization_row', locals: {localization: Lit.init.cache["#{locale}.#{lk.localization_key}"]} %>
|
<%= EmojiFlag.new(locale) %>
<%= locale %>
- <% if localization %>
- <%= link_to lit.previous_versions_localization_key_localization_path(lk, localization, format: :js), class: "show_prev_versions #{'hidden' unless versions?(localization)}", remote: true do %>
- <%= draw_icon 'random', title: I18n.t('lit.common.previous_versions', default: 'Previous versions') %>
- <% end %>
- <% end %>
|
<% unless lk.is_deleted? %>
@@ -65,7 +72,7 @@
<% end %>
<% if Lit.store_request_info %>
|
-
+ |
Translation key recently displayed on following pages:
<% Lit.init.cache.get_request_info(lk.localization_key).split(' ').reverse.each do |l| %>
diff --git a/app/views/lit/localization_keys/batch_touch.js.erb b/app/views/lit/localization_keys/batch_touch.js.erb
new file mode 100644
index 00000000..22e3648e
--- /dev/null
+++ b/app/views/lit/localization_keys/batch_touch.js.erb
@@ -0,0 +1 @@
+alert('All of search results have been marked as updated now, please retry synchronizing now');
diff --git a/app/views/lit/localizations/update.js.erb b/app/views/lit/localizations/update.js.erb
index 0a100a47..ddebae21 100644
--- a/app/views/lit/localizations/update.js.erb
+++ b/app/views/lit/localizations/update.js.erb
@@ -1,6 +1,6 @@
var $row = $('td.localization_row[data-id="<%= @localization.id %>"]');
$row.data('editing', 0);
$row.html("<%= ejs render(:partial=>"/lit/localization_keys/localization_row", formats: ['html'], :locals=>{:localization=>@localization.translated_value }) %>");
-$row.siblings().find('.show_prev_versions').removeClass('hidden');
+$row.siblings().find('.js-show_prev_versions').removeClass('hidden');
$('a.change_completed_<%= @localization.id %> input[type=checkbox]').prop("checked", true);
diff --git a/config/routes.rb b/config/routes.rb
index ac6b5d7c..d0e88571 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -25,6 +25,7 @@
get :find_localization
get :not_translated
get :visited_again
+ post :batch_touch
end
resources :localizations, only: [:edit, :update, :show] do
member do
diff --git a/test/functional/lit/localization_keys_controller_test.rb b/test/functional/lit/localization_keys_controller_test.rb
index 126ce92c..031e5f52 100644
--- a/test/functional/lit/localization_keys_controller_test.rb
+++ b/test/functional/lit/localization_keys_controller_test.rb
@@ -71,6 +71,21 @@ class LocalizationKeysControllerTest < ActionController::TestCase
assert_not @localization_key.reload.is_deleted
end
+ test 'touches search results in batch' do
+ v = lit_localization_keys(:string)
+ a = lit_localization_keys(:array)
+ v.update_column :updated_at, 1.day.ago
+ a.update_column :updated_at, 1.day.ago
+ post :batch_touch, params: { key: 'value' }, format: :js
+ assert_in_delta(v.reload.updated_at, 1.second.ago, 5)
+ assert_in_delta(a.reload.updated_at, 1.day.ago, 5)
+ end
+
+ test 'wont fail when there wont be any search results when touching in batch' do
+ post :batch_touch, params: { key: 'valuefoobar' }, format: :js
+ assert_response :success
+ end
+
private
def with_fresh_cache
| |