class UserController < ApplicationController
- layout 'site', :except => [:api_details, :login]
- layout 'slim', :only => :login
+ layout :choose_layout
before_filter :authorize, :only => [:api_details, :api_gpx_files]
before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
rescue ActiveRecord::RecordNotFound
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name] unless @this_user
end
+
+ ##
+ # Choose the layout to use. See
+ # https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts
+ def choose_layout
+ if [ 'api_details' ].include? action_name
+ nil
+ elsif [ 'login', 'new', 'terms'].include? action_name
+ 'slim'
+ else
+ 'site'
+ end
+ end
end