FIX: Don't show blank space when there's no banner image (#28366)
This commit fixes a bug in the redesigned about page where if there's no banner image configured for the page, the top of the page where the banner goes is occupied with large white space. Additionally, this commit also fixes a related bug in the admin config area for the /about page where it's not possible to remove the uploaded banner image.
This commit is contained in:
parent
5c5cf491b2
commit
3704a917a9
|
@ -59,7 +59,7 @@ export default class AdminConfigAreasAboutGeneralSettings extends Component {
|
|||
|
||||
@action
|
||||
setImage(upload, { set }) {
|
||||
set("aboutBannerImage", upload.url);
|
||||
set("aboutBannerImage", upload?.url);
|
||||
}
|
||||
|
||||
<template>
|
||||
|
|
|
@ -141,7 +141,9 @@ export default class AboutPage extends Component {
|
|||
|
||||
<template>
|
||||
<section class="about__header">
|
||||
<img class="about__banner" src={{@model.banner_image}} />
|
||||
{{#if @model.banner_image}}
|
||||
<img class="about__banner" src={{@model.banner_image}} />
|
||||
{{/if}}
|
||||
<h3>{{@model.title}}</h3>
|
||||
<p class="short-description">{{@model.description}}</p>
|
||||
<PluginOutlet
|
||||
|
|
|
@ -64,6 +64,13 @@ describe "About page", type: :system do
|
|||
expect(about_page).to have_moderators_count(1, "1")
|
||||
end
|
||||
|
||||
it "doesn't render banner image when it's not set" do
|
||||
SiteSetting.about_banner_image = nil
|
||||
|
||||
about_page.visit
|
||||
expect(about_page).to have_no_banner_image
|
||||
end
|
||||
|
||||
describe "displayed site age" do
|
||||
it "says less than 1 month if the site is less than 1 month old" do
|
||||
Discourse.stubs(:site_creation_date).returns(1.week.ago)
|
||||
|
|
|
@ -95,6 +95,20 @@ describe "Admin About Config Area Page", type: :system do
|
|||
)
|
||||
expect(SiteSetting.about_banner_image.sha1).to eq(Upload.generate_digest(image_file))
|
||||
end
|
||||
|
||||
describe "the banner image field" do
|
||||
it "can remove the uploaded image" do
|
||||
SiteSetting.about_banner_image = image_upload
|
||||
|
||||
config_area.visit
|
||||
|
||||
config_area.general_settings_section.banner_image_uploader.remove_image
|
||||
|
||||
config_area.general_settings_section.submit
|
||||
expect(config_area.general_settings_section).to have_saved_successfully
|
||||
expect(SiteSetting.about_banner_image).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "the contact information card" do
|
||||
|
|
|
@ -18,6 +18,10 @@ module PageObjects
|
|||
# called immediately after selecting an image.
|
||||
@element.has_css?(".btn-danger", wait: 10)
|
||||
end
|
||||
|
||||
def remove_image
|
||||
@element.find(".btn-danger").click
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,10 @@ module PageObjects
|
|||
has_css?("img.about__banner[src=\"#{GlobalPath.full_cdn_url(upload.url)}\"]")
|
||||
end
|
||||
|
||||
def has_no_banner_image?
|
||||
has_no_css?("img.about__banner")
|
||||
end
|
||||
|
||||
def has_members_count?(count, formatted_number)
|
||||
element = find(".about__stats-item.members span")
|
||||
element.has_text?(I18n.t("js.about.member_count", count:, formatted_number:))
|
||||
|
|
Loading…
Reference in New Issue