diff options
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 883e5865a21..da6b0c3c91a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -9,14 +9,14 @@ class ProjectsController < ApplicationController before_action :set_title, only: [:new, :create] before_action :event_filter, only: :show - layout 'navless', only: [:new, :create, :fork] + layout :determine_layout def new @project = Project.new end def edit - render 'edit', layout: 'project_settings' + render 'edit' end def create @@ -46,7 +46,7 @@ class ProjectsController < ApplicationController end format.js else - format.html { render 'edit', layout: 'project_settings' } + format.html { render 'edit' } format.js end end @@ -72,13 +72,13 @@ class ProjectsController < ApplicationController format.html do if @project.repository_exists? if @project.empty_repo? - render 'projects/empty', layout: user_layout + render 'projects/empty' else @last_push = current_user.recent_push(@project.id) if current_user - render :show, layout: user_layout + render :show end else - render 'projects/no_repo', layout: user_layout + render 'projects/no_repo' end end @@ -164,8 +164,14 @@ class ProjectsController < ApplicationController @title = 'New Project' end - def user_layout - current_user ? 'projects' : 'public_projects' + def determine_layout + if [:new, :create].include?(action_name.to_sym) + 'application' + elsif [:edit, :update].include?(action_name.to_sym) + 'project_settings' + else + 'project' + end end def load_events |