translation_center 1.6.5 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/translation_center/application.css +3 -0
- data/app/controllers/translation_center/translations_controller.rb +12 -0
- data/app/models/translation_center/translation.rb +1 -0
- data/app/views/layouts/translation_center/application.html.haml +2 -0
- data/app/views/translation_center/center/_activity.html.haml +4 -4
- data/app/views/translation_center/translations/_search_results.html.haml +27 -0
- data/app/views/translation_center/translations/search.html.haml +2 -0
- data/app/views/translation_center/translations/search.js.haml +1 -0
- data/config/routes.rb +3 -0
- data/lib/translation_center/locale/en.yml +9 -1
- data/lib/translation_center/version.rb +1 -1
- data/test/dummy/config/locales/en.yml +1 -1
- data/test/dummy/log/development.log +27488 -0
- data/test/dummy/tmp/cache/assets/CDB/0B0/sprockets%2Fd44248d455dc32b5d0d0694193b9a3f3 +0 -0
- data/test/dummy/tmp/cache/assets/CFC/580/sprockets%2F0cc6da09d251ca33295323d3f084b39a +0 -0
- data/test/dummy/tmp/cache/assets/D64/F20/sprockets%2Fc4f6a5b423127cf5d0addcc3228c8807 +0 -0
- data/test/dummy/tmp/pids/{server.pid → server.pid~} +0 -0
- metadata +7 -4
@@ -3,6 +3,7 @@ require_dependency "translation_center/application_controller"
|
|
3
3
|
module TranslationCenter
|
4
4
|
class TranslationsController < ApplicationController
|
5
5
|
before_filter :can_admin?, only: [ :destroy, :accept, :unaccept ]
|
6
|
+
before_filter :set_page_number, only: [:search]
|
6
7
|
|
7
8
|
# POST /translations/1/vote
|
8
9
|
def vote
|
@@ -56,5 +57,16 @@ module TranslationCenter
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
60
|
+
def search
|
61
|
+
@result = Translation.where('value LIKE ?', "%#{params[:translation_value]}%")
|
62
|
+
@translations = @result.offset(Translation::NUMBER_PER_PAGE * (@page - 1)).limit(Translation::NUMBER_PER_PAGE)
|
63
|
+
@total_pages = (@result.count / (Translation::NUMBER_PER_PAGE * 1.0)).ceil
|
64
|
+
|
65
|
+
respond_to do |format|
|
66
|
+
format.html
|
67
|
+
format.js
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
59
71
|
end
|
60
72
|
end
|
@@ -56,6 +56,8 @@
|
|
56
56
|
%li.divider-vertical
|
57
57
|
%form.navbar-search
|
58
58
|
%input#search_keys.search-query{placeholder: t('translation_center.search_keys'), type: "text", autocomplete: :off}
|
59
|
+
%form.navbar-search{action: search_translations_path}
|
60
|
+
%input#translations.search-query{placeholder: t('translation_center.search_translations'), type: "text", autocomplete: :off, name: :translation_value, value: params[:translation_value]}
|
59
61
|
|
60
62
|
%ul.nav.pull-right
|
61
63
|
%li
|
@@ -34,15 +34,15 @@
|
|
34
34
|
= distance_of_time_in_words_to_now change.created_at
|
35
35
|
= t('.ago')
|
36
36
|
.pagination
|
37
|
-
= link_to t('.first'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=1"
|
37
|
+
= link_to t('pagination.first'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=1"
|
38
38
|
- if @page != 1
|
39
39
|
|
|
40
|
-
= link_to t('.prev'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@page - 1}"
|
40
|
+
= link_to t('pagination.prev'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@page - 1}"
|
41
41
|
|
|
42
|
-
= link_to t('.next'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@page + 1}"
|
42
|
+
= link_to t('pagination.next'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@page + 1}"
|
43
43
|
- if @page != @total_pages
|
44
44
|
|
|
45
|
-
= link_to t('.last'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@total_pages}"
|
45
|
+
= link_to t('pagination.last'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@total_pages}"
|
46
46
|
= @page
|
47
47
|
= t('.of')
|
48
48
|
= @total_pages
|
@@ -0,0 +1,27 @@
|
|
1
|
+
%h2= t('translation_center.center.search.title', value: params[:translation_value])
|
2
|
+
|
3
|
+
.pagination
|
4
|
+
|
5
|
+
- if @page != 1
|
6
|
+
= link_to t('pagination.first'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=1"
|
7
|
+
|
|
8
|
+
= link_to t('pagination.prev'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}&page=#{@page - 1}"
|
9
|
+
|
|
10
|
+
|
11
|
+
- if @total_pages != 1 && @page != @total_pages
|
12
|
+
|
13
|
+
= link_to t('pagination.next'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}&page=#{@page + 1}"
|
14
|
+
- if @page != @total_pages
|
15
|
+
|
|
16
|
+
= link_to t('pagination.last'), "#{request.protocol}#{request.host_with_port}#{request.fullpath.gsub('&page=' + @page.to_s, '')}?&page=#{@total_pages}"
|
17
|
+
= @page
|
18
|
+
= t('.of')
|
19
|
+
= @total_pages
|
20
|
+
|
21
|
+
|
22
|
+
%div
|
23
|
+
- translations.each do |translation|
|
24
|
+
%a.category{ href: translation_key_path(id: translation.key, lang_to: translation.lang), title: translation.key.name }
|
25
|
+
.category_name
|
26
|
+
= truncate(translation.key.name, length: 35)
|
27
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
$('#translations_search_result').html("#{escape_javascript(render 'search_results', translations: @translations)}")
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
en:
|
2
2
|
translation_center:
|
3
|
+
pagination:
|
4
|
+
next: Next
|
5
|
+
first: First
|
6
|
+
prev: Prev.
|
7
|
+
last: Last
|
3
8
|
actions:
|
4
9
|
are_you_sure: "Are you sure ?"
|
5
10
|
back_to_app: "Back To App"
|
@@ -36,8 +41,11 @@ en:
|
|
36
41
|
these_actions_will_affect_existing_data: "These actions will affect existing data"
|
37
42
|
translated: Translated
|
38
43
|
untranslated: Untranslated
|
44
|
+
search:
|
45
|
+
title: "Keys with translations that contain '%{value}'"
|
39
46
|
dashboard: Dashboard
|
40
|
-
search_keys: "
|
47
|
+
search_keys: "Keys"
|
48
|
+
search_translations: "Translations"
|
41
49
|
translate_to: "Translate To"
|
42
50
|
translation_center: "Translation Center"
|
43
51
|
translation_keys:
|