Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Static content also in content menu (bugfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursbraucs committed Jul 24, 2014
1 parent 0e6a523 commit 4c7fbb7
Show file tree
Hide file tree
Showing 5 changed files with 2,118 additions and 197 deletions.
4 changes: 4 additions & 0 deletions app/controllers/weeler/static_sections_controller.rb
Expand Up @@ -15,5 +15,9 @@ def update
Settings.i18n_updated_at = Time.now
redirect_to({action: :show, id: params[:id]}, {flash: {success: "Section updated."}})
end
protected
def set_current_menu_item
@current_menu_item = "content"
end
end
end
5 changes: 5 additions & 0 deletions lib/i18n/backend/weeler.rb
Expand Up @@ -103,6 +103,7 @@ def lookup_in_database locale, key, scope = [], options = {}

# For a key :'foo.bar.baz' return ['foo', 'foo.bar', 'foo.bar.baz']
def expand_keys(key)
# TODO: fixme. warning: shadowing outer local variable - key
key.to_s.split(FLATTEN_SEPARATOR).inject([]) do |keys, key|
keys << [keys.last, key].compact.join(FLATTEN_SEPARATOR)
end
Expand All @@ -112,7 +113,11 @@ def expand_keys(key)
def store_empty_translation locale, key, options
return_value = nil
interpolations = options.keys - I18n::RESERVED_KEYS

# TODO: fixme. warning: shadowing outer local variable - key
keys = options[:count] ? PLURAL_KEYS.map { |k| [key, k].join(FLATTEN_SEPARATOR) } : [key]


keys.each do |key|
translation = Weeler::Translation.find_or_initialize_by locale: locale.to_s, key: key
translation.interpolations = interpolations
Expand Down

0 comments on commit 4c7fbb7

Please sign in to comment.