Permalink
Browse files

Revert "cleanup/comment out parts of index"

This reverts commit 274c96b.
  • Loading branch information...
1 parent 77bc53b commit f405443146c56e9fc1c94c8d54665df3a2574aeb Jacqui Maher committed Feb 29, 2012
Showing with 9 additions and 10 deletions.
  1. +9 −10 app/controllers/translator/translations_controller.rb
@@ -24,16 +24,15 @@ def choose_locale
end
def index
-# section = params[:key].present? && params[:key] + '.'
-# params[:group] = "application" unless params["group"]
- @sections = Translator.sections
- @keys = Translator.cached_keys
- # TODO: implement search
- # if params[:search]
- # @keys = @keys.select {|k|
- # Translator.locales.any? {|locale| I18n.translate("#{k}", :locale => locale).to_s.downcase.include?(params[:search].downcase)}
- # }
- # end
+ section = params[:key].present? && params[:key] + '.'
+ params[:group] = "application" unless params["group"]
+ @sections = Translator.keys_for_strings(:group => params[:group]).map {|k| k = k.scan(/^[a-z0-9\-_]*\./)[0]; k ? k.gsub('.', '') : false}.select{|k| k}.uniq.sort
+ @keys = Translator.keys_for_strings(:group => params[:group], :filter => section)
+ if params[:search]
+ @keys = @keys.select {|k|
+ Translator.locales.any? {|locale| I18n.translate("#{k}", :locale => locale).to_s.downcase.include?(params[:search].downcase)}
+ }
+ end
@keys = paginate(@keys)
render :layout => Translator.layout_name
end

0 comments on commit f405443

Please sign in to comment.