From 26ad250989d82b496b131811f8a0ddd7e662b650 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 30 Apr 2015 19:06:18 +0200 Subject: Add a page title to every page. --- app/controllers/snippets_controller.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'app/controllers/snippets_controller.rb') diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index a5259466cb8..c960724b47a 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -13,8 +13,6 @@ class SnippetsController < ApplicationController respond_to :html - layout :determine_layout - def index if params[:username].present? @user = User.find_by(username: params[:username]) @@ -99,15 +97,12 @@ class SnippetsController < ApplicationController end def set_title - @title = 'Snippets' - @title_url = snippets_path + @title = 'Snippets' + @title_url = snippets_path + @sidebar = "snippets" end def snippet_params params.require(:personal_snippet).permit(:title, :content, :file_name, :private, :visibility_level) end - - def determine_layout - current_user ? 'snippets' : 'public_users' - end end -- cgit v1.2.1 From 92fd3ccee05acdfd5e498734ed287458a8dd21a3 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 1 May 2015 10:39:11 +0200 Subject: Add helpers for header title and sidebar, and move setting those from controllers to layouts. --- app/controllers/snippets_controller.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'app/controllers/snippets_controller.rb') diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index c960724b47a..cf672c5c093 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -7,10 +7,9 @@ class SnippetsController < ApplicationController # Allow destroy snippet before_action :authorize_admin_snippet!, only: [:destroy] - before_action :set_title - skip_before_action :authenticate_user!, only: [:index, :user_index, :show, :raw] + layout 'snippets' respond_to :html def index @@ -96,12 +95,6 @@ class SnippetsController < ApplicationController return render_404 unless can?(current_user, :admin_personal_snippet, @snippet) end - def set_title - @title = 'Snippets' - @title_url = snippets_path - @sidebar = "snippets" - end - def snippet_params params.require(:personal_snippet).permit(:title, :content, :file_name, :private, :visibility_level) end -- cgit v1.2.1