afalkear_translation_center 1.8.2 → 1.8.3

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: 7b2b57d3659082d26b3d8b7b2cb456f830567afd
4
- data.tar.gz: 9cd6c585174bcba3060f51995dc3a3b634d5292b
3
+ metadata.gz: 49081f667fcd3558641771c46c9d6b360548685a
4
+ data.tar.gz: e6981c56cff99f17b53427fc5bcbccf2a41ec5ec
5
5
  SHA512:
6
- metadata.gz: 6d0c12356d36d1805eac589883a577358d74214edb1478e834eae63f76e4068d0225acc78ff389b79ec823ac77c93ac3bf3039579f782c406723e5ca9b56684b
7
- data.tar.gz: d019ced5eab1923e31e6664d402272cc07feba7e98436bc5275dfcac0b27658a6ebaf4db5d5c3b1c1fe47f983dc1a6eb20bc121a77389b5286454847ba8f1707
6
+ metadata.gz: 5ab340cfbc26ce9efb25b5dcf968fd53f35aeb4f602354db3de420ccbf2ccdf6d76daadc705774af5a529eab19f5383243fca8b48abacfe5f9581982e469c9a5
7
+ data.tar.gz: a9d05f0f39d506fb85fbf2ff717bf523c43b96959d6028e991998b34412827105d2597681a4b492904478e21ef9f528a73f6778a3381ff2559fc77fb8836ec74
@@ -18,7 +18,7 @@ module TranslationCenter
18
18
  # defaults
19
19
  def translation_langs_filters
20
20
  session[:current_filter] ||= 'untranslated'
21
- session[:lang_from] ||= :en
21
+ session[:lang_from] = :pt
22
22
  session[:lang_to] = app_params[:lang_to] || session[:lang_to] || :en
23
23
  I18n.locale = session[:lang_from] || I18n.default_locale
24
24
  end
@@ -20,8 +20,13 @@ module TranslationCenter
20
20
  # GET /categories/1.json
21
21
  def show
22
22
  @category = Category.find(category_params[:id])
23
+ @page_name = params[:page_name]
23
24
  session[:current_filter] = category_params[:filter] || session[:current_filter]
24
- @keys = @category.send("#{session[:current_filter]}_keys", session[:lang_to]).offset(@page - 1).limit(TranslationKey::PER_PAGE)
25
+ if params[:page].blank?
26
+ @keys = @category.send("#{session[:current_filter]}_keys", session[:lang_to]).offset(@page - 1).limit(TranslationKey::PER_PAGE)
27
+ else
28
+ @keys = @category.keys.where("name LIKE ? ", "%#{@page_name}%")
29
+ end
25
30
  @untranslated_keys_count = @category.untranslated_keys(session[:lang_to]).count
26
31
  @translated_keys_count = @category.translated_keys(session[:lang_to]).count
27
32
  @pending_keys_count = @category.pending_keys(session[:lang_to]).count
@@ -32,6 +37,11 @@ module TranslationCenter
32
37
  end
33
38
  end
34
39
 
40
+ def pages
41
+ @category = Category.find(category_params[:id])
42
+ @keys = @category.keys.where("name LIKE ? ", "%#{page_name}%")
43
+ end
44
+
35
45
  # GET /categories/1/more_keys.js
36
46
  def more_keys
37
47
  @category = Category.find(category_params[:category_id])
@@ -42,5 +42,17 @@ module TranslationCenter
42
42
  self.name.titleize
43
43
  end
44
44
 
45
+ def get_pages
46
+ response = []
47
+ self.keys.each do |k|
48
+ response << k.name.split('.')[1] unless (k.name.split('.').length < 1)
49
+ end
50
+ response.uniq!
51
+ end
52
+
53
+ def get_translations_for_page(page_name)
54
+ self.keys.where("name LIKE ? ", "%#{page_name}%")
55
+ end
56
+
45
57
  end
46
58
  end
@@ -2,6 +2,7 @@
2
2
  %input#current_filter{ type: 'hidden', value: current_filter }
3
3
  %h1
4
4
  = @category.name.camelize
5
+
5
6
  %ul.nav.nav-pills
6
7
 
7
8
  %li{class: "#{current_filter_is?('untranslated') ? 'active' : ''}"}
@@ -27,6 +28,14 @@
27
28
  %li
28
29
  #loading
29
30
  = image_tag 'translation_center/loading.gif'
31
+ %ul.nav.nav-pills
32
+ - pages = @category.get_pages
33
+ - pages.each do |page|
34
+ %li
35
+ %a{href: category_path(id: @category.id, page_name: page)}
36
+ = "#{page} [#{@category.get_translations_for_page(page).count}]"
37
+
30
38
  .span9#category
31
39
  = render 'translation_center/translation_keys/translation_keys', translation_keys: @keys, category: @category
40
+
32
41
 
@@ -1,3 +1,3 @@
1
1
  module TranslationCenter
2
- VERSION = "1.8.2"
2
+ VERSION = "1.8.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afalkear_translation_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - afalkear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails