Files
fetsite/app/controllers/application_controller.rb
Andreas Stephanides b86d3aca23 Themen und themes_for_rails neues design
Neues design mit theme=2003 ansehen
2014-01-08 20:23:58 +01:00

28 lines
634 B
Ruby
Executable File

class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_i18n_locale_from_params
protected
theme :get_theme
def set_i18n_locale_from_params
if params[:locale]
if I18n.available_locales.include?(params[:locale].to_sym)
I18n.locale=params[:locale].to_sym
else
flash.now[:notice]= "#{params[:locale]} translation not available"
logger.error flash.now[:notice]
end
end
end
def get_theme
set_theme(params[:theme])
if valid_theme?
theme_name
else
nil
end
end
def default_url_options
{locale: I18n.locale, theme:theme_name}
end
end