couch_i18n 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +0 -1
  3. data/app/assets/javascripts/couch_i18n/application.js.coffee +8 -0
  4. data/app/assets/stylesheets/couch_i18n/application.sass +4 -0
  5. data/app/assets/stylesheets/couch_i18n/components/_buttons.sass +11 -0
  6. data/app/assets/stylesheets/couch_i18n/components/_forms.sass +45 -0
  7. data/app/assets/stylesheets/couch_i18n/components/_offset_navigation.sass +19 -0
  8. data/app/assets/stylesheets/couch_i18n/foundation_and_overrides.scss +1447 -0
  9. data/app/assets/stylesheets/couch_i18n/{structure.css.scss → structure.scss} +0 -24
  10. data/app/controllers/couch_i18n/application_controller.rb +5 -1
  11. data/app/controllers/couch_i18n/translations_controller.rb +24 -19
  12. data/app/models/couch_i18n/translation.rb +81 -35
  13. data/app/views/couch_i18n/application/_error_messages.html.slim +6 -0
  14. data/app/views/couch_i18n/translations/_form.html.slim +15 -0
  15. data/app/views/couch_i18n/translations/edit.html.slim +2 -0
  16. data/app/views/couch_i18n/translations/index.html.slim +91 -0
  17. data/app/views/couch_i18n/translations/new.html.slim +2 -0
  18. data/app/views/kaminari/couch_i18n/_first_page.html.erb +3 -0
  19. data/app/views/kaminari/couch_i18n/_first_page.html.slim +2 -0
  20. data/app/views/kaminari/couch_i18n/_gap.html.erb +3 -0
  21. data/app/views/kaminari/couch_i18n/_gap.html.slim +2 -0
  22. data/app/views/kaminari/couch_i18n/_last_page.html.erb +3 -0
  23. data/app/views/kaminari/couch_i18n/_last_page.html.slim +2 -0
  24. data/app/views/kaminari/couch_i18n/_next_page.html.erb +3 -0
  25. data/app/views/kaminari/couch_i18n/_next_page.html.slim +2 -0
  26. data/app/views/kaminari/couch_i18n/_page.html.erb +3 -0
  27. data/app/views/kaminari/couch_i18n/_page.html.slim +2 -0
  28. data/app/views/kaminari/couch_i18n/_paginator.html.erb +17 -0
  29. data/app/views/kaminari/couch_i18n/_paginator.html.slim +12 -0
  30. data/app/views/kaminari/couch_i18n/_prev_page.html.erb +3 -0
  31. data/app/views/kaminari/couch_i18n/_prev_page.html.slim +2 -0
  32. data/app/views/layouts/couch_i18n/application.html.slim +28 -0
  33. data/config/initializers/assets.rb +1 -0
  34. data/config/locales/couch_i18n.en.yml +8 -2
  35. data/config/routes.rb +2 -1
  36. data/lib/couch_i18n/active_model_errors.rb +2 -2
  37. data/lib/couch_i18n/backend.rb +1 -5
  38. data/lib/couch_i18n/engine.rb +2 -0
  39. data/lib/couch_i18n/store.rb +24 -12
  40. data/lib/couch_i18n/version.rb +3 -0
  41. data/lib/couch_i18n.rb +30 -9
  42. metadata +51 -43
  43. data/app/assets/javascripts/couch_i18n/application.js +0 -10
  44. data/app/assets/stylesheets/couch_i18n/application.css +0 -7
  45. data/app/assets/stylesheets/couch_i18n/bootstrap_and_override.css.sass +0 -6
  46. data/app/views/couch_i18n/application/_error_messages.html.haml +0 -6
  47. data/app/views/couch_i18n/translations/_form.html.haml +0 -17
  48. data/app/views/couch_i18n/translations/edit.html.haml +0 -4
  49. data/app/views/couch_i18n/translations/index.html.haml +0 -84
  50. data/app/views/couch_i18n/translations/new.html.haml +0 -4
  51. data/app/views/couch_i18n/translations/new.html.haml~ +0 -4
  52. data/app/views/layouts/couch_i18n/application.html.haml +0 -27
  53. /data/app/assets/stylesheets/couch_i18n/{alerts.css.scss → alerts.scss} +0 -0
  54. /data/app/views/couch_i18n/application/{_alerts.html.haml → _alerts.html.slim} +0 -0
@@ -12,7 +12,7 @@ module ActiveModel
12
12
  value = (attribute != :base ? @base.send(:read_attribute_for_validation, attribute) : nil)
13
13
 
14
14
  # Create key. Remove class in model name and add errors.messages
15
- key = (@base.class.model_name.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.messages', type]).join('.')
15
+ key = (@base.class.model_name.to_s.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.messages', type]).join('.')
16
16
 
17
17
  options = {
18
18
  :model => @base.class.model_name.human,
@@ -33,7 +33,7 @@ module ActiveModel
33
33
  attr_name = @base.class.human_attribute_name(attribute, :default => attr_name)
34
34
 
35
35
  # Create key. Remove class in model name and add errors.messages
36
- key = (@base.class.model_name.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.conjunction.attribute_message']).join('.')
36
+ key = (@base.class.model_name.to_s.underscore.sub(/\w+$/, '').scan(/\w+/) + ['errors.conjunction.attribute_message']).join('.')
37
37
  I18n.t(key, {
38
38
  :default => "%{attribute} %{message}",
39
39
  :attribute => attr_name,
@@ -74,11 +74,7 @@ module CouchI18n
74
74
  end
75
75
 
76
76
  def available_locales
77
- locales = @store.keys.map { |k| k =~ /\./; $` }
78
- locales.uniq!
79
- locales.compact!
80
- locales.map! { |k| k.to_sym }
81
- locales
77
+ @available_locales ||= CouchI18n::Translation.get_translation_keys_by_level(0)
82
78
  end
83
79
 
84
80
  protected
@@ -5,6 +5,8 @@ module CouchI18n
5
5
  initializer 'couch_i18n.cmtool', after: 'cmtool.build_menu' do
6
6
  if defined? Cmtool
7
7
  require 'cmtool'
8
+ require 'couch_i18n/translation'
9
+
8
10
  Cmtool::Menu.register do
9
11
  append_to :site do
10
12
  resource_link CouchI18n::Translation, label: :couch_i18n
@@ -1,5 +1,8 @@
1
1
  module CouchI18n
2
2
  class Store
3
+ KNOWN_DEFAULTS = {
4
+ 'support.array' => %({"words_connector":", ","two_words_connector":" and ","last_word_connector":", and "})
5
+ }
3
6
 
4
7
  def available_locales
5
8
  CouchI18n::Translation.get_keys_by_level(0)
@@ -8,42 +11,51 @@ module CouchI18n
8
11
  # Now the store features
9
12
  def []=(key, value, options = {})
10
13
  key = key.to_s.gsub('/', '.')
11
- existing = CouchI18n::Translation.find_by_key(key) rescue nil
12
- translation = existing || CouchI18n::Translation.new(:key => key)
13
- translation.value = value
14
- translation.save
14
+ existing = CouchI18n::Translation.find_by_translation_key(key) rescue nil
15
+ translation = existing || CouchI18n::Translation.new(translation_key: key)
16
+ translation.translation_value = value
17
+ translation.save and Rails.cache.write("couch_i18n-#{key}", value)
18
+ value
15
19
  end
16
20
 
17
21
  # alias for read
18
22
  def [](key, options = {})
19
23
  key = key.to_s.gsub('/', '.')
24
+ key_without_locale = key.sub(/\w+\./, '')
25
+ old_database_name = get_couchrest_name
20
26
  Rails.cache.fetch("couch_i18n-#{key}") do
21
- old_database_name = get_couchrest_name
22
27
  begin
23
28
  set_couchrest_name CouchPotato::Config.database_name # Set database to original configured name
24
- translation = CouchI18n::Translation.find_by_key(key.to_s)
25
- translation ||= CouchI18n::Translation.create(:key => key, :value => options[:default].presence || key.to_s.split('.').last, :translated => false)
29
+ translation = CouchI18n::Translation.find_by_translation_key(key.to_s)
30
+ translation ||= CouchI18n::Translation.create(translation_key: key, translation_value: options[:default].presence || KNOWN_DEFAULTS[key_without_locale].presence || key[/\w+$/].humanize, translated: false)
31
+ #rescue SimplyStored::RecordNotFound
32
+ # binding.pry
26
33
  ensure
27
34
  set_couchrest_name old_database_name
28
35
  end
29
- translation.value
36
+ translation.try(:translation_value)
30
37
  end
31
38
  end
32
39
 
33
- def set_couchrest_name(name)
40
+ def set_couchrest_name(full_database_namename)
41
+ # we assume the database server is the same, just change the name
42
+ name = full_database_namename[/\w+$/]
34
43
  d = CouchPotato.database.couchrest_database
35
44
  d.instance_variable_set('@name', name)
36
- d.instance_variable_set('@uri', "/#{name.gsub('/', '%2F')}")
45
+ #d.instance_variable_set('@uri', "/#{name.gsub('/', '%2F')}")
46
+ d.instance_variable_set('@path', "/#{CGI.escape(name)}")
37
47
  d.instance_variable_set('@bulk_save_cache', [])
38
- d.instance_variable_set('@root', d.host + d.uri)
48
+ #d.instance_variable_set('@root', d.host + d.uri)
49
+ #CouchPotato.class_variable_set('@@__couchrest_database', CouchRest.database(CouchPotato.full_url_to_database(name, CouchPotato::Config.database_host)))
39
50
  end
40
51
 
41
52
  def get_couchrest_name
42
53
  CouchPotato.database.couchrest_database.name
43
54
  end
44
55
 
56
+ #DISABLE THIS FUNCTIONALITY, IT KILLS PERFORMANCE
45
57
  def keys
46
- CouchI18n::Translation.all.map(&:key)
58
+ [] #@kyes ||= CouchI18n::Translation.all.map(&:translation_key)
47
59
  end
48
60
  end
49
61
  end
@@ -0,0 +1,3 @@
1
+ module CouchI18n
2
+ VERSION = "0.3.1"
3
+ end
data/lib/couch_i18n.rb CHANGED
@@ -1,8 +1,22 @@
1
+ require 'couch_i18n/version'
1
2
  require "couch_i18n/engine"
2
3
  require 'couch_i18n/store'
3
4
  require 'couch_i18n/backend'
4
5
  require 'couch_i18n/active_model_errors'
6
+
7
+ # Ugly fix for the updated json gem changes
8
+ #module JSON
9
+ # class << self
10
+ # alias :old_parse :parse
11
+ # def parse(json, args = {})
12
+ # args[:create_additions] = true
13
+ # old_parse(json, args)
14
+ # end
15
+ # end
16
+ #end
17
+
5
18
  module CouchI18n
19
+ @@__missing_key_handler = nil
6
20
  # This method imports yaml translations to the couchdb version. When run again new ones will
7
21
  # be added. Translations already stored in the couchdb database are not overwritten if true or ovveride_existing: true is given
8
22
  def self.import_from_yaml(options = {})
@@ -18,13 +32,13 @@ module CouchI18n
18
32
  flattened_hash = traverse_flatten_keys(yml_backend.send(:translations))
19
33
  available_translations = CouchI18n::Translation.all
20
34
  flattened_hash.each do |key, value|
21
- available_translation = available_translations.find{|t| t.key == key}
35
+ available_translation = available_translations.find{|t| t.translation_key == key}
22
36
  if available_translation && options[:override_existing]
23
- available_translation.value = value
37
+ available_translation.translation_value = value
24
38
  available_translation.translated = true
25
39
  available_translation.save
26
40
  else
27
- available_translation = CouchI18n::Translation.create :key => key, :value => value
41
+ available_translation = CouchI18n::Translation.create translation_key: key, translation_value: value
28
42
  end
29
43
  end
30
44
  end
@@ -49,7 +63,7 @@ module CouchI18n
49
63
  # by default all the translations are indented. So a command:
50
64
  # CouchI18n.indent_keys.to_yaml will return one big yaml string of the translations
51
65
  def self.indent_keys(selection = CouchI18n::Translation.all)
52
- traverse_indent_keys(selection.map{|kv| [kv.key.split('.'), kv.value]})
66
+ traverse_indent_keys(selection.map{|kv| [kv.translation_key.split('.'), kv.translation_value]})
53
67
  end
54
68
 
55
69
  # Traversing helper for indent_keys
@@ -66,11 +80,18 @@ module CouchI18n
66
80
  h
67
81
  end
68
82
 
69
- # Add all translations to the cache to avoid one by one loading and caching
70
- def self.cache_all
71
- CouchI18n::Translation.all.each do |t|
72
- Rails.cache.write("couch_i18n-#{t.key}", t.value)
73
- end
83
+ def self.handle_missing_key(key)
84
+ missing_key_handler.call(key) if missing_key_handler
85
+ end
86
+
87
+ def self.missing_key_handler
88
+ @@__missing_key_handler
89
+ end
90
+
91
+ def self.missing_key(&blk)
92
+ raise "Assign a block to handle a missing key" unless blk.present?
93
+ raise "The missing key proc should handle the key as argument CouchI18n.missing_key{ |key| .... }" unless blk.arity == 1
94
+ @@__missing_key_handler = blk
74
95
  end
75
96
  end
76
97
 
metadata CHANGED
@@ -1,46 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Benjamin ter Kuile
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2012-12-29 00:00:00.000000000 Z
10
+ date: 2025-08-27 00:00:00.000000000 Z
13
11
  dependencies:
14
12
  - !ruby/object:Gem::Dependency
15
13
  name: activemodel
16
14
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
15
  requirements:
19
- - - ! '>='
16
+ - - ">="
20
17
  - !ruby/object:Gem::Version
21
18
  version: '0'
22
19
  type: :runtime
23
20
  prerelease: false
24
21
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
22
  requirements:
27
- - - ! '>='
23
+ - - ">="
28
24
  - !ruby/object:Gem::Version
29
25
  version: '0'
30
26
  - !ruby/object:Gem::Dependency
31
27
  name: simply_stored
32
28
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
29
  requirements:
35
- - - ! '>='
30
+ - - ">="
36
31
  - !ruby/object:Gem::Version
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
35
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
36
  requirements:
43
- - - ! '>='
37
+ - - ">="
44
38
  - !ruby/object:Gem::Version
45
39
  version: '0'
46
40
  description: couch_i18n is an in database storage for I18n translations, tested for
@@ -50,61 +44,75 @@ executables: []
50
44
  extensions: []
51
45
  extra_rdoc_files: []
52
46
  files:
53
- - lib/couch_i18n/active_model_errors.rb
54
- - lib/couch_i18n/backend.rb
55
- - lib/couch_i18n/engine.rb
56
- - lib/couch_i18n/store.rb
57
- - lib/couch_i18n.rb
58
- - lib/tasks/couch_i18n_tasks.rake
47
+ - MIT-LICENSE
48
+ - README.rdoc
49
+ - Rakefile
59
50
  - app/assets/images/couch_i18n/alert.png
60
51
  - app/assets/images/couch_i18n/notice.png
61
- - app/assets/javascripts/couch_i18n/application.js
52
+ - app/assets/javascripts/couch_i18n/application.js.coffee
62
53
  - app/assets/javascripts/couch_i18n/structure.js
63
- - app/assets/stylesheets/couch_i18n/alerts.css.scss
64
- - app/assets/stylesheets/couch_i18n/application.css
65
- - app/assets/stylesheets/couch_i18n/bootstrap_and_override.css.sass
66
- - app/assets/stylesheets/couch_i18n/structure.css.scss
54
+ - app/assets/stylesheets/couch_i18n/alerts.scss
55
+ - app/assets/stylesheets/couch_i18n/application.sass
56
+ - app/assets/stylesheets/couch_i18n/components/_buttons.sass
57
+ - app/assets/stylesheets/couch_i18n/components/_forms.sass
58
+ - app/assets/stylesheets/couch_i18n/components/_offset_navigation.sass
59
+ - app/assets/stylesheets/couch_i18n/foundation_and_overrides.scss
60
+ - app/assets/stylesheets/couch_i18n/structure.scss
67
61
  - app/controllers/couch_i18n/application_controller.rb
68
62
  - app/controllers/couch_i18n/translations_controller.rb
69
63
  - app/helpers/couch_i18n/application_helper.rb
70
64
  - app/models/couch_i18n/translation.rb
71
65
  - app/models/couch_i18n/translation.rb~
72
- - app/views/couch_i18n/application/_alerts.html.haml
73
- - app/views/couch_i18n/application/_error_messages.html.haml
74
- - app/views/couch_i18n/translations/_form.html.haml
75
- - app/views/couch_i18n/translations/edit.html.haml
76
- - app/views/couch_i18n/translations/index.html.haml
77
- - app/views/couch_i18n/translations/new.html.haml
78
- - app/views/couch_i18n/translations/new.html.haml~
79
- - app/views/layouts/couch_i18n/application.html.haml
66
+ - app/views/couch_i18n/application/_alerts.html.slim
67
+ - app/views/couch_i18n/application/_error_messages.html.slim
68
+ - app/views/couch_i18n/translations/_form.html.slim
69
+ - app/views/couch_i18n/translations/edit.html.slim
70
+ - app/views/couch_i18n/translations/index.html.slim
71
+ - app/views/couch_i18n/translations/new.html.slim
72
+ - app/views/kaminari/couch_i18n/_first_page.html.erb
73
+ - app/views/kaminari/couch_i18n/_first_page.html.slim
74
+ - app/views/kaminari/couch_i18n/_gap.html.erb
75
+ - app/views/kaminari/couch_i18n/_gap.html.slim
76
+ - app/views/kaminari/couch_i18n/_last_page.html.erb
77
+ - app/views/kaminari/couch_i18n/_last_page.html.slim
78
+ - app/views/kaminari/couch_i18n/_next_page.html.erb
79
+ - app/views/kaminari/couch_i18n/_next_page.html.slim
80
+ - app/views/kaminari/couch_i18n/_page.html.erb
81
+ - app/views/kaminari/couch_i18n/_page.html.slim
82
+ - app/views/kaminari/couch_i18n/_paginator.html.erb
83
+ - app/views/kaminari/couch_i18n/_paginator.html.slim
84
+ - app/views/kaminari/couch_i18n/_prev_page.html.erb
85
+ - app/views/kaminari/couch_i18n/_prev_page.html.slim
86
+ - app/views/layouts/couch_i18n/application.html.slim
87
+ - config/initializers/assets.rb
80
88
  - config/locales/couch_i18n.en.yml
81
89
  - config/routes.rb
82
- - MIT-LICENSE
83
- - Rakefile
84
- - README.rdoc
90
+ - lib/couch_i18n.rb
91
+ - lib/couch_i18n/active_model_errors.rb
92
+ - lib/couch_i18n/backend.rb
93
+ - lib/couch_i18n/engine.rb
94
+ - lib/couch_i18n/store.rb
95
+ - lib/couch_i18n/version.rb
96
+ - lib/tasks/couch_i18n_tasks.rake
85
97
  homepage: http://github.com/bterkuile/couch_i18n
86
98
  licenses: []
87
- post_install_message:
99
+ metadata: {}
88
100
  rdoc_options: []
89
101
  require_paths:
90
102
  - lib
91
103
  required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
104
  requirements:
94
- - - ! '>='
105
+ - - ">="
95
106
  - !ruby/object:Gem::Version
96
107
  version: '0'
97
108
  required_rubygems_version: !ruby/object:Gem::Requirement
98
- none: false
99
109
  requirements:
100
- - - ! '>='
110
+ - - ">="
101
111
  - !ruby/object:Gem::Version
102
112
  version: '0'
103
113
  requirements: []
104
- rubyforge_project: couch_i18n
105
- rubygems_version: 1.8.24
106
- signing_key:
107
- specification_version: 3
114
+ rubygems_version: 3.6.2
115
+ specification_version: 4
108
116
  summary: couch_i18n is an in database storage for I18n translations, tested for rails,
109
117
  with online management views
110
118
  test_files: []
@@ -1,10 +0,0 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
- //= require jquery
8
- //= require jquery_ujs
9
- //= require bootstrap
10
- //= require_directory .
@@ -1,7 +0,0 @@
1
- /*
2
- * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
- * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
- * the top of the compiled file, but it's generally better to create a new file per style scope.
5
- *= require_self
6
- *= require_directory .
7
- */
@@ -1,6 +0,0 @@
1
- @import "bootstrap"
2
-
3
- body
4
- padding-top: 60px
5
-
6
- @import "bootstrap-responsive"
@@ -1,6 +0,0 @@
1
- -if target.errors.any?
2
- #errorExplanation
3
- %h2= t('couch_i18n.errors.title', :count => target.errors.count)
4
- %ul
5
- - target.errors.full_messages.each do |msg|
6
- %li= msg
@@ -1,17 +0,0 @@
1
- = form_for @translation, html: {class: 'form-horizontal'} do |f|
2
- = hidden_field_tag 'offset', params[:offset]
3
- = render 'error_messages', :target => @translation
4
- .control-group
5
- = f.label :key, class: 'control-label'
6
- .controls
7
- = f.text_field :key, :size => 70, class: 'input-xxlarge'
8
- .control-group
9
- = f.label :value, class: 'control-label'
10
- .controls
11
- = f.text_field :value, :size => 70, class: 'input-xxlarge'
12
- .control-group
13
- = label_tag :is_json, t('couch_i18n.general.is_json'), class: 'control-label'
14
- .controls
15
- = check_box_tag :is_json, 1, f.object.value.to_s =~ /^\{|^\[/
16
- .form-actions
17
- = f.submit local_assigns[:submit] || update_button_text
@@ -1,4 +0,0 @@
1
- - title t("couch_i18n.action.edit.title")
2
- = render 'form'
3
- - content_for :page_links do
4
- = link_to link_to_index_content(:translations), couch_i18n.translations_path(:offset => params[:offset] || @translation.key.to_s.sub(/\.[\w\s-]+$/, '')), class: 'btn'
@@ -1,84 +0,0 @@
1
- - if params[:offset].present?
2
- - title params[:offset]
3
- - else
4
- - title t("couch_i18n.action.index.title")
5
- .top-buttons
6
- %a.btn.btn-warning{data: {toggle: "modal"}, href: "#import-form"}= t('couch_i18n.import.label')
7
- %a.btn.btn-success{data: {toggle: "modal"}, href: "#export-form"}= t('couch_i18n.export.label')
8
- .pull-right
9
- = link_to t('couch_i18n.action.destroy.offset_link'), couch_i18n.destroy_offset_translations_path(:offset => params[:offset]), :method => :delete, :confirm => (defined?(:are_you_sure) ? are_you_sure : t('couch_i18n.general.are_you_sure')), class: [:btn, 'btn-danger']
10
-
11
- #import-form.modal.hide
12
- = form_tag({:action => :import}, :multipart => true) do
13
- .modal-header
14
- %button.close{:type => "button", :data => {:dismiss => "modal"}, 'aria-hidden' => "true" } x
15
- %h3= t('couch_i18n.import.label')
16
- .modal-body
17
- %p= t('couch_i18n.import.description')
18
- = file_field_tag :importfile
19
- .modal-footer
20
- %a.btn{data: {dismiss: :modal}, href: '#'}= t('couch_i18n.general.close')
21
- = submit_tag I18n.t('couch_i18n.import.button')
22
- #export-form.modal.hide
23
- = form_tag :action => :export do
24
- = hidden_field_tag :offset, params[:offset]
25
- .modal-header
26
- %button.close{:type => "button", :data => {:dismiss => "modal"}, 'aria-hidden' => "true" } x
27
- - if params[:offset].present?
28
- %h3= t('couch_i18n.export.from_offset', offset: params[:offset])
29
- - else
30
- %h3= t('couch_i18n.export.label')
31
- .modal-body
32
- = select_tag :exportformat, options_for_select(%w[yml csv json], params[:exportformat])
33
- = check_box_tag :untranslated
34
- = label_tag :untranslated, t('couch_i18n.export.untranslated'), class: 'untranslated-label'
35
- .modal-footer
36
- %a.btn{data: {dismiss: :modal}, href: '#'}= t('couch_i18n.general.close')
37
- = submit_tag I18n.t('couch_i18n.export.execute')
38
- .offset-navigation-block.block
39
- .btn-toolbar
40
- - for offset in @available_higher_offsets
41
- .btn-group
42
- = link_to offset[:name], {:offset => offset[:offset], untranslated: params[:untranslated]}, class: :btn
43
- .offset-navigation-form
44
- = form_tag({}, :method => :get )do
45
- - if params[:offset].present?
46
- = link_to I18n.t('couch_i18n.general.go_to_zero_offset'), :offset => nil
47
- = text_field_tag :offset, params[:offset], :size => 60
48
- = "(#{@translations.total_count})"
49
- %input{:type => :submit, :name => :commit, :value => I18n.t('couch_i18n.general.go_to_offset')}
50
- %input{:type => :submit, :name => :partfinder, :value => I18n.t('couch_i18n.general.find_part')}
51
- %input{:type => :submit, :name => :valuefinder, :value => I18n.t('couch_i18n.general.find_value')}
52
- = check_box_tag :untranslated, 1, untranslated?, id: :untranslated_listing
53
- = label_tag :untranslated_listing, I18n.t('couch_i18n.general.untranslated_label'), class: 'untranslated-label'
54
- .btn-toolbar
55
- - for offset in @available_deeper_offsets
56
- .btn-group
57
- = link_to(offset[:name], {:offset => offset[:offset], untranslated: params[:untranslated]}, class: :btn)
58
- - if @translations.any?
59
- = paginate @translations, :right => 3, :left => 3
60
- %table.table.table-striped
61
- %thead
62
- %tr
63
- %th= CouchI18n::Translation.human_attribute_name(:key)
64
- %th= CouchI18n::Translation.human_attribute_name(:value)
65
- %th= CouchI18n::Translation.human_attribute_name(:translated)
66
- %th.action.edit
67
- %th.action.destroy
68
- %tbody
69
- - @translations.each do |translation|
70
- %tr{:class => cycle('odd', 'even')}
71
- %td
72
- - if partfinder? || valuefinder?
73
- = link_to translation.key.sub(/^\./, ''), couch_i18n.edit_translation_path(translation, offset: params[:offset])
74
- - else
75
- = link_to translation.key[(params[:offset].try(:size) || 0)..-1].sub(/^\./, ''), couch_i18n.edit_translation_path(translation, offset: params[:offset])
76
- %td= link_to translation.value, couch_i18n.edit_translation_path(translation, offset: params[:offset])
77
- %td.boolean= boolean_show(translation.translated)
78
- %td.action.edit= link_to link_to_edit_content(translation), couch_i18n.edit_translation_path(translation, offset: params[:offset]), class: 'btn btn-warning'
79
- %td.action.destroy= link_to link_to_destroy_content(translation),couch_i18n.translation_path(translation, offset: params[:offset]), :confirm => are_you_sure, :method => :delete, class: [:btn, 'btn-danger']
80
- - else
81
- %h3= t("couch_i18n.general.none_found")
82
-
83
- - content_for :page_links do
84
- = link_to link_to_new_content(:translation), couch_i18n.new_translation_path(:offset => params[:offset]), class: 'btn btn-primary'
@@ -1,4 +0,0 @@
1
- - title t("couch_i18n.action.new.title")
2
- = render 'form', submit: create_button_text
3
- - content_for :page_links do
4
- = link_to link_to_index_content(:couch_i18n_translations), couch_i18n.translations_path(:offset => params[:offset]), class: 'btn'
@@ -1,4 +0,0 @@
1
- - title t("couch_i18n.action.new.title")
2
- = render 'form', submit: create_button_text
3
- - content_for :page_links do
4
- = link_to link_to_index_content(:couch_i18n_translations), couch_i18n.translations_path(:offset => params[:offset])
@@ -1,27 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %title= defined?(site_title) ? site_title : I18n.t('couch_i18n.general.site_title')
5
- /[if lt IE 9]
6
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
7
- = csrf_meta_tags
8
- = stylesheet_link_tag 'couch_i18n/application'
9
- = javascript_include_tag 'couch_i18n/application'
10
- %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
11
- = yield :head
12
- %body
13
- - if defined?(Cmtool)
14
- = render 'cmtool/application/menu'
15
- - else
16
- .navbar.navbar-fixed-top
17
- .navbar-inner
18
- .container
19
- %a.btn.btn-navbar{data: {toggle: "collapse", target: ".nav-collapse"}}
20
- %span.icon-bar
21
- %span.icon-bar
22
- %span.icon-bar
23
- %a.brand{href: couch_i18n.root_path}= yield :title
24
- .container
25
- = render 'alerts'
26
- = yield
27
- .form-actions=yield :page_links