Sha256: 9063c916224ce0eee39ca7a9c5df0a1f6ab95889a58b956b0a70008d217c6589
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
class AdminController < ApplicationController before_filter :authenticate_user!, :choose_site skip_before_filter :valid_site! layout :set_admin_layout def set_admin_layout current_user.admin_layout || Odania.admin.admin_templates.keys.first || 'odania_core/admin' end def choose_site site_id = params[:site].nil? ? nil : params[:site][:id] @admin_site = Odania::Site.where(id: site_id).first unless site_id.nil? @admin_site = Odania::Site.where(id: session[:site_id]).first if @admin_site.nil? and !session[:site_id].nil? @admin_site = Odania::Site.first if @admin_site.nil? session[:site_id] = @admin_site.id.to_s unless @admin_site.nil? set_odania_menu unless @admin_site.nil? end # Set the odania menu that is currently edited def set_odania_menu @odania_menu = @admin_site.menus.where(id: params[:menu_id]).first @odania_menu = @admin_site.menus.where(id: session[:menu_id]).first if @odania_menu.nil? @odania_menu = @admin_site.menus.first if @odania_menu.nil? @odania_menu = Odania::Menu.first if @odania_menu.nil? session[:menu_id] = @odania_menu.id unless @odania_menu.nil? end end
Version data entries
4 entries across 4 versions & 1 rubygems