translation_center 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,4 +39,19 @@ $(document).ready(function(){
39
39
 
40
40
  $('.dropdown-toggle').dropdown()
41
41
 
42
+ // search for key with that name and jump to it when clicked
43
+ $('#search_keys').typeahead({
44
+ // note that "value" is the default setting for the property option
45
+ source: function (query, process) {
46
+ return $.get(Routes['translation_center_search_translation_keys_path'] + '.json', { query: query }, function (data) {
47
+ return process(data);
48
+ });
49
+ },
50
+ updater: function(item) {
51
+ document.location = Routes['translation_center_search_translation_keys_path'] + '?search_key_name=' + item
52
+ }
53
+
54
+ });
55
+
56
+
42
57
  });
@@ -3,6 +3,7 @@ Routes = {
3
3
  translation_center_set_lang_to_path: translation_center_root + 'set_language_to/',
4
4
  translation_center_set_lang_from_path: translation_center_root + 'set_language_from/',
5
5
  translation_center_search_activity_path: translation_center_root + 'search_activity',
6
+ translation_center_search_translation_keys_path: translation_center_root + '/translation_keys/search',
6
7
  translation_center_translation_key_path: function(id) { translation_center_root + 'translation_keys/' + id },
7
8
  translation_center_category_more_keys_path: function(id) { return translation_center_root + 'categories/' + id + '/more_keys' },
8
9
  translation_center_translation_accept_path: function(id) { return translation_center_root + 'translations/' + id + '/accept' },
@@ -23,10 +23,14 @@
23
23
  .navbar span {
24
24
  margin-left: 5px;
25
25
  }
26
- .navbar .brand,.navbar span, .navbar .nav > li > a {
26
+ .navbar .brand,.navbar span, .navbar .nav > li > a, .navbar a, .navbar .nav_text {
27
27
  color: white !important;
28
28
  }
29
29
 
30
+ .navbar li.dropdown ul.dropdown-menu a.language_to {
31
+ color: black !important;
32
+ }
33
+
30
34
  .navbar-inner {
31
35
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #009ED2), color-stop(100%, #008CBA)) !important;
32
36
  }
@@ -2,7 +2,7 @@ require_dependency "translation_center/application_controller"
2
2
 
3
3
  module TranslationCenter
4
4
  class TranslationKeysController < ApplicationController
5
- before_filter :get_translation_key
5
+ before_filter :get_translation_key, except: [ :search ]
6
6
  before_filter :can_admin?, only: [ :destroy, :update ]
7
7
 
8
8
  # POST /translation_keys/1/update_translation.js
@@ -73,13 +73,29 @@ module TranslationCenter
73
73
  # DELETE /translation_keys/1
74
74
  # DELETE /translation_keys/1.json
75
75
  def destroy
76
- @translation_key = TranslationKey.find(params[:id])
76
+ @category = @translation_key.category
77
77
  @translation_key_id = @translation_key.id
78
78
  @key_status = @translation_key.status(session[:lang_to])
79
79
  @translation_key.destroy
80
80
 
81
81
  respond_to do |format|
82
82
  format.js
83
+ format.html {redirect_to @category, notice: I18n.t('translation_center.translation_keys.destroyed_successfully')}
84
+ end
85
+ end
86
+
87
+ # GET /translation_keys/search.json
88
+ def search
89
+ # if full name provided then get the key and redirect to it, otherwise return similar in json
90
+ if params[:search_key_name].present?
91
+ @translation_key = TranslationKey.find_by_name(params[:search_key_name])
92
+ else
93
+ @key_names = TranslationKey.where('name LIKE ?', "%#{params[:query]}%")
94
+ end
95
+
96
+ respond_to do |format|
97
+ format.html { redirect_to @translation_key}
98
+ format.json { render json: @key_names.map(&:name) }
83
99
  end
84
100
  end
85
101
 
@@ -51,12 +51,27 @@
51
51
  = language_name(locale)
52
52
  - if translation_admin?
53
53
  .pull-left.nav_text
54
- = link_to t('translation_center.dashboard'), dashboard_path
54
+ %span
55
+ = link_to t('translation_center.dashboard'), dashboard_path
56
+ %li.divider-vertical
57
+ %form.navbar-search
58
+ %input#search_keys.search-query{placeholder: t('translation_center.search_keys'), type: "text", autocomplete: :off}
55
59
 
56
60
  %ul.nav.pull-right
57
61
  %li
58
62
  = link_to t('translation_center.back_to_app'), main_app.root_path, target: Rails.application.class.parent_name
63
+ - if flash[:alert]
64
+ .alert.alert-error
65
+ %button{ type: 'button', class: 'close', 'data-dismiss' => 'alert' }
66
+ ×
67
+ = flash[:alert]
59
68
 
69
+ - if flash[:notice]
70
+ .alert.alert-success
71
+ %button{ type: 'button', class: 'close', 'data-dismiss' => 'alert' }
72
+ ×
73
+ = flash[:notice]
74
+
60
75
  .container
61
76
  .row
62
77
  .span12
@@ -1,4 +1,8 @@
1
- = link_to t('.back_to_category'), @translation_key.category
1
+ = link_to "#{t('.back_to_category')} #{@translation_key.category.name.titleize}", @translation_key.category, class: 'btn btn-primary'
2
+
2
3
  %h1
3
4
  = @translation_key.name
5
+ - if translation_admin?
6
+ = link_to t('.destroy'), @translation_key, method: :delete, data: { confirm: t('actions.are_you_sure', :default => 'Are you sure?') }, class: 'btn btn-danger'
7
+
4
8
  = render 'translation_center/translation_keys/show', translation_key: @translation_key, index: 0
data/config/routes.rb CHANGED
@@ -10,6 +10,9 @@ TranslationCenter::Engine.routes.draw do
10
10
  resources :translation_keys do
11
11
  post :update_translation
12
12
  get :translations
13
+ collection do
14
+ get :search
15
+ end
13
16
  end
14
17
 
15
18
  resources :categories do
@@ -31,7 +31,8 @@ module TranslationCenter
31
31
 
32
32
  # wraps a span if inspector option is set to all
33
33
  def wrap_span(translation, translation_key)
34
- if TranslationCenter::CONFIG['inspector'] == 'all'
34
+ # put the inspector class if inspector is all and the key doesn't belongs to translation_center
35
+ if TranslationCenter::CONFIG['inspector'] == 'all' && translation_key.name.split('.').first != 'translation_center'
35
36
  "<span class='tc-inspector-key' data-type='#{translation_key.status(I18n.locale)}' data-id='#{translation_key.id}'> #{translation} </span>".html_safe
36
37
  else
37
38
  translation
@@ -96,9 +97,10 @@ module I18n
96
97
  translation_key = keys
97
98
  # remove locale
98
99
  translation_key.shift
99
- translation_key = TranslationCenter::TranslationKey.find_by_name(translation_key.join('.'))
100
100
 
101
- if TranslationCenter::CONFIG['inspector'] == 'off'
101
+ translation_key = TranslationCenter::TranslationKey.find_by_name(translation_key.join('.'))
102
+ # don't put the inspector class if inspector is off or the key belongs to translation_center
103
+ if TranslationCenter::CONFIG['inspector'] == 'off' || translation_key.name.split('.').first == 'translation_center'
102
104
  %(<span class="translation_missing" title="translation missing: #{keys.join('.')}">#{key}</span>)
103
105
  else
104
106
  %(<span class="translation_missing tc-inspector-key" data-type="#{translation_key.status(I18n.locale)}" data-id="#{translation_key.id}" title="translation missing: #{keys.join('.')}">#{key}</span>)
@@ -1,3 +1,3 @@
1
1
  module TranslationCenter
2
- VERSION = "1.0.4"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -9,6 +9,16 @@ ar:
9
9
  errors:
10
10
  messages:
11
11
  taken: محجوز
12
+ attributes:
13
+ email: "البريد الالكترونى"
14
+ password: "كلمة السر"
15
+ title: عنوان
16
+ layouts:
17
+ translation_center:
18
+ application:
19
+ back_to_app: "العودة إلى الموق"
20
+ to: إلى
21
+ translate_to: "ترجم إلى"
12
22
  posts:
13
23
  index:
14
24
  Content: المحتوى
@@ -1,2 +1,12 @@
1
1
  ---
2
- de: {}
2
+ de:
3
+ layouts:
4
+ translation_center:
5
+ application:
6
+ Translation_Center: "Translation Center 1"
7
+ from: von
8
+ posts:
9
+ index:
10
+ Content: Content2
11
+ Title: Title
12
+ testing_new_keys: "new keys"
@@ -3,20 +3,12 @@ en:
3
3
  actions:
4
4
  are_you_sure: "Are you sure ?"
5
5
  activerecord:
6
- attributes:
7
- post:
8
- content: Content
9
- title: Title
10
- translation_center/translation_key:
11
- name: Name
12
- user:
13
- email: Email
14
- password: Password
15
- remember_me: "Remember Me"
6
+ attributes: Attributes
16
7
  errors:
17
8
  messages:
18
9
  record_invalid: "Validation failed: %{errors}"
19
10
  taken: "has already been taken"
11
+ models: Models
20
12
  attributes:
21
13
  content: Content
22
14
  email: Email
@@ -128,6 +120,7 @@ en:
128
120
  invalid: "Invalid email or password."
129
121
  invalid_token: "Invalid authentication token."
130
122
  locked: "Your account is locked."
123
+ not_found_in_database: "Invalid email or password."
131
124
  timeout: "Your session expired, please sign in again to continue."
132
125
  unauthenticated: "You need to sign in or sign up before continuing."
133
126
  unconfirmed: "You have to confirm your account before continuing."
@@ -169,6 +162,7 @@ en:
169
162
  already_confirmed: "was already confirmed, please try signing in"
170
163
  blank: "can't be blank"
171
164
  confirmation: "doesn't match confirmation"
165
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
172
166
  empty: "can't be empty"
173
167
  equal_to: "must be equal to %{count}"
174
168
  even: "must be even"
@@ -196,6 +190,11 @@ en:
196
190
  create: "Create %{model}"
197
191
  submit: "Save %{model}"
198
192
  update: "Update %{model}"
193
+ label:
194
+ user:
195
+ email: Email
196
+ password: Password
197
+ remember_me: "Remember Me"
199
198
  select:
200
199
  prompt: "Please select"
201
200
  submit:
@@ -211,6 +210,7 @@ en:
211
210
  to: To
212
211
  translate_to: "Translate To"
213
212
  meta_search:
213
+ created_at_gteq: "Created At Gteq"
214
214
  or: or
215
215
  predicates:
216
216
  contains: "%{attribute} contains"
@@ -282,13 +282,13 @@ en:
282
282
  delimiter: ""
283
283
  post:
284
284
  content: Content
285
- title: Title
286
285
  posts:
287
286
  index:
288
287
  Content: Content
289
- Listing_posts: "Listing Posts"
290
288
  Title: Title
291
289
  testing_new_keys: "Testing New Keys"
290
+ search:
291
+ created_at_gteq: "Created At Gteq"
292
292
  support:
293
293
  array:
294
294
  last_word_connector: ", and "
@@ -318,13 +318,51 @@ en:
318
318
  pending: Pending
319
319
  translated: Translated
320
320
  untranslated: Untranslated
321
+ center:
322
+ activity:
323
+ ago: Ago
324
+ changes: Changes
325
+ key: Key
326
+ locale: Locale
327
+ no_matches: "No Matches"
328
+ time: Time
329
+ user: User
330
+ dashboard:
331
+ activity: Activity
332
+ ago: Ago
333
+ all: All
334
+ changes: Changes
335
+ choose_filter: "Choose Filter"
336
+ dashboard: Dashboard
337
+ date: Date
338
+ filter: Filter
339
+ filter_by: "Filter By"
340
+ key: Key
341
+ language: Language
342
+ locale: Locale
343
+ pending: Pending
344
+ progress: Progress
345
+ reset: Reset
346
+ search: Search
347
+ search_by: "Search By"
348
+ select_locale: "Select Locale"
349
+ time: Time
350
+ to: To
351
+ translated: Translated
352
+ untranslated: Untranslated
353
+ user: User
354
+ dashboard: Dashboard
355
+ search_keys: "Search Keys"
321
356
  translate_to: "Translate To"
322
357
  translation_center: "Translation Center"
323
358
  translation_keys:
359
+ destroyed_successfully: "Translation key was destroyed successfully"
324
360
  show:
325
361
  Add/Edit_Translation: "Add/Edit Translation"
326
362
  Add_Translation: "Add Translation"
327
363
  Translations: Translations
364
+ back_to_category: "Back To"
365
+ destroy: Destroy
328
366
  no_translations_available: "No Translations Available"
329
367
  show_keys:
330
368
  translated: Translated
@@ -364,6 +402,7 @@ en:
364
402
  password: Password
365
403
  remember_me: "Remember Me"
366
404
  signed_in: "Signed In"
405
+ unauthenticated: Unauthenticated
367
406
  will_paginate:
368
407
  next_label: "Next &#8594;"
369
408
  page_entries_info:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translation_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: