Skip to content
Snippets Groups Projects
Commit 26ad2509 authored by Douwe Maan's avatar Douwe Maan
Browse files

Add a page title to every page.

parent f2cf6d75
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 120 deletions
class Profiles::ApplicationController < ApplicationController
before_action :set_title
private
def set_title
@title = "Profile"
@title_url = profile_path
@sidebar = "profile"
end
end
class Profiles::AvatarsController < ApplicationController
layout "profile"
class Profiles::AvatarsController < Profiles::ApplicationController
def destroy
@user = current_user
@user.remove_avatar!
Loading
Loading
class Profiles::EmailsController < ApplicationController
layout "profile"
class Profiles::EmailsController < Profiles::ApplicationController
def index
@primary = current_user.email
@public_email = current_user.public_email
Loading
Loading
class Profiles::KeysController < ApplicationController
layout "profile"
class Profiles::KeysController < Profiles::ApplicationController
skip_before_action :authenticate_user!, only: [:get_keys]
 
def index
Loading
Loading
class Profiles::NotificationsController < ApplicationController
layout 'profile'
class Profiles::NotificationsController < Profiles::ApplicationController
def show
@user = current_user
@notification = current_user.notification
Loading
Loading
class Profiles::PasswordsController < ApplicationController
layout :determine_layout
skip_before_action :check_password_expiration, only: [:new, :create]
 
before_action :set_user
Loading
Loading
@@ -67,14 +65,10 @@ class Profiles::PasswordsController < ApplicationController
end
 
def set_title
@title = "New password"
end
def determine_layout
if [:new, :create].include?(action_name.to_sym)
'navless'
@title = "New password"
else
'profile'
super
end
end
 
Loading
Loading
class ProfilesController < ApplicationController
class ProfilesController < Profiles::ApplicationController
include ActionView::Helpers::SanitizeHelper
 
before_action :user
before_action :authorize_change_username!, only: :update_username
skip_before_action :require_email, only: [:show, :update]
 
layout 'profile'
def show
end
 
Loading
Loading
class Projects::ApplicationController < ApplicationController
before_action :project
before_action :repository
layout :determine_layout
layout 'project'
 
def authenticate_user!
# Restrict access to Projects area only
Loading
Loading
@@ -17,14 +17,6 @@ class Projects::ApplicationController < ApplicationController
super
end
 
def determine_layout
if current_user
'projects'
else
'public_projects'
end
end
def require_branch_head
unless @repository.branch_names.include?(@ref)
redirect_to(
Loading
Loading
class Projects::AvatarsController < Projects::ApplicationController
layout 'project'
before_action :project
 
def show
Loading
Loading
Loading
Loading
@@ -18,7 +18,6 @@ class Projects::ForksController < Projects::ApplicationController
notice: 'Project was successfully forked.'
)
else
@title = 'Fork project'
render :error
end
end
Loading
Loading
class Projects::UploadsController < Projects::ApplicationController
layout 'project'
skip_before_action :authenticate_user!, :reject_blocked!, :project,
:repository, if: -> { action_name == 'show' && image? }
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
class SearchController < ApplicationController
include SearchHelper
 
before_action :set_title
def show
return if params[:search].nil? || params[:search].blank?
 
Loading
Loading
@@ -55,4 +57,11 @@ class SearchController < ApplicationController
 
render json: search_autocomplete_opts(term).to_json
end
private
def set_title
@title = "Search"
@title_url = search_path
end
end
Loading
Loading
@@ -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])
Loading
Loading
@@ -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
class UsersController < ApplicationController
skip_before_action :authenticate_user!
before_action :set_user
layout :determine_layout
 
def show
@contributed_projects = contributed_projects.joined(@user).
Loading
Loading
@@ -51,14 +50,6 @@ class UsersController < ApplicationController
render 'calendar_activities', layout: false
end
 
def determine_layout
if current_user
'navless'
else
'public_users'
end
end
private
 
def set_user
Loading
Loading
Loading
Loading
@@ -332,4 +332,12 @@ module ApplicationHelper
end
"#{entity_title}#{count}"
end
def page_title(*titles)
@page_title ||= []
@page_title.push(*titles.compact) if titles.any?
@page_title.join(" | ")
end
end
Loading
Loading
@@ -19,24 +19,6 @@ module GroupsHelper
end
end
 
def group_head_title
title = @group.name
title = if current_action?(:issues)
"Issues - " + title
elsif current_action?(:merge_requests)
"Merge requests - " + title
elsif current_action?(:members)
"Members - " + title
elsif current_action?(:edit)
"Settings - " + title
else
title
end
title
end
def group_settings_page?
if current_controller?('groups')
current_action?('edit') || current_action?('projects')
Loading
Loading
Loading
Loading
@@ -192,46 +192,6 @@ module ProjectsHelper
'unknown'
end
 
def project_head_title
title = @project.name_with_namespace
title = if current_controller?(:tree)
"#{@project.path}\/#{@path} at #{@ref} - " + title
elsif current_controller?(:issues)
if current_action?(:show)
"Issue ##{@issue.iid} - #{@issue.title} - " + title
else
"Issues - " + title
end
elsif current_controller?(:blob)
if current_action?(:new) || current_action?(:create)
"New file at #{@ref}"
elsif current_action?(:show)
"#{@blob.path} at #{@ref}"
elsif @blob
"Edit file #{@blob.path} at #{@ref}"
end
elsif current_controller?(:commits)
"Commits at #{@ref} - " + title
elsif current_controller?(:merge_requests)
if current_action?(:show)
"Merge request ##{@merge_request.iid} - " + title
else
"Merge requests - " + title
end
elsif current_controller?(:wikis)
"Wiki - " + title
elsif current_controller?(:network)
"Network graph - " + title
elsif current_controller?(:graphs)
"Graphs - " + title
else
title
end
title
end
def default_url_to_repo(project = nil)
project = project || @project
current_user ? project.url_to_repo : project.http_url_to_repo
Loading
Loading
- page_title "Settings"
%h3.page-title Application settings
%hr
= render 'form'
- page_title "Edit", @application.name, "Applications"
%h3.page-title Edit application
- @url = admin_application_path(@application)
= render 'form', application: @application
\ No newline at end of file
= render 'form', application: @application
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment