Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #8 from eval/remember-last-selected-site

remember last selected site
  • Loading branch information...
commit 98b7e03d0fde6cb5b8640fc445477ba01d56aaf4 2 parents 7b52da1 + 7ea2043
@jfahrenkrug jfahrenkrug authored
View
2  app/views/admin/pages/_site_subnav.html.haml
@@ -19,5 +19,5 @@
%li
%a
%label{:for => :root} View site:
- = select_tag :root, options_from_collection_for_select(Site.all, :homepage_id, :name, params[:root].to_i), :id => 'multisite-select'
+ = select_tag :root, options_from_collection_for_select(Site.all, :homepage_id, :name, @homepage.id), :id => 'multisite-select'
= submit_tag 'Go', :id => "multisite-submit"
View
5 lib/multi_site/pages_controller_extensions.rb
@@ -13,9 +13,10 @@ def self.included(base)
end
def index_with_root
- if params[:root] # If a root page is specified
- @homepage = Page.find(params[:root])
+ root_id = params[:root] || session[:last_active_root]
+ if @homepage = Page.find_by_id(root_id)
@site = @homepage.root.site
+ session[:last_active_root] = @homepage.id
elsif @site = Site.first(:order => "position ASC") # If there is a site defined
if @site.homepage
@homepage = @site.homepage
Please sign in to comment.
Something went wrong with that request. Please try again.