Commit 384445ec authored by Douwe Maan's avatar Douwe Maan

Don't override issue page description in project layout.

parent 6d3b5ea2
...@@ -27,11 +27,9 @@ module PageLayoutHelper ...@@ -27,11 +27,9 @@ module PageLayoutHelper
# #
# Returns an HTML-safe String. # Returns an HTML-safe String.
def page_description(description = nil) def page_description(description = nil)
@page_description ||= brand_title
if description.present? if description.present?
@page_description = description.squish @page_description = description.squish
else elsif @page_description.present?
sanitize(@page_description, tags: []).truncate_words(30) sanitize(@page_description, tags: []).truncate_words(30)
end end
end end
...@@ -41,11 +39,8 @@ module PageLayoutHelper ...@@ -41,11 +39,8 @@ module PageLayoutHelper
subject = @project || @user || @group subject = @project || @user || @group
if subject.present? image = subject.avatar_url if subject.present?
subject.avatar_url || default image || default
else
default
end
end end
# Define or get attributes to be used as Twitter card metadata # Define or get attributes to be used as Twitter card metadata
......
- page_description brand_title unless page_description
- site_name = "GitLab" - site_name = "GitLab"
%head{prefix: "og: http://ogp.me/ns#"} %head{prefix: "og: http://ogp.me/ns#"}
%meta{charset: "utf-8"} %meta{charset: "utf-8"}
......
- page_title @group.name - page_title @group.name
- page_description @group.description - page_description @group.description unless page_description
- header_title group_title(@group) unless header_title - header_title group_title(@group) unless header_title
- sidebar "group" unless sidebar - sidebar "group" unless sidebar
......
- page_title @project.name_with_namespace - page_title @project.name_with_namespace
- page_description @project.description - page_description @project.description unless page_description
- header_title project_title(@project) unless header_title - header_title project_title(@project) unless header_title
- sidebar "project" unless sidebar - sidebar "project" unless sidebar
......
...@@ -2,10 +2,8 @@ require 'rails_helper' ...@@ -2,10 +2,8 @@ require 'rails_helper'
describe PageLayoutHelper do describe PageLayoutHelper do
describe 'page_description' do describe 'page_description' do
it 'defaults to value returned by brand_title helper' do it 'defaults to nil' do
allow(helper).to receive(:brand_title).and_return('Foo') expect(helper.page_description).to eq nil
expect(helper.page_description).to eq 'Foo'
end end
it 'returns the last-pushed description' do it 'returns the last-pushed description' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment