FIX: use normal logo in published pages if small not available.
It was returning an error if small logo is not available. If both logos are not available then it will be hidden now.
This commit is contained in:
parent
dce518477c
commit
6b818fb855
|
@ -31,7 +31,7 @@ class PublishedPagesController < ApplicationController
|
|||
|
||||
@topic = pp.topic
|
||||
@canonical_url = @topic.url
|
||||
@logo = SiteSetting.logo_small
|
||||
@logo = SiteSetting.logo_small || SiteSetting.logo
|
||||
@site_url = Discourse.base_url
|
||||
@border_color = "#" + ColorScheme.base_colors["tertiary"]
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
<div class="published-page-header">
|
||||
<div class="published-page-header-wrapper">
|
||||
<a href="<%= @site_url %>">
|
||||
<img class="published-page-logo" src="<%=@logo.url%>"/>
|
||||
</a>
|
||||
<%- if @logo.present? %>
|
||||
<a href="<%= @site_url %>">
|
||||
<img class="published-page-logo" src="<%=@logo.url%>"/>
|
||||
</a>
|
||||
<%- end -%>
|
||||
<h1 class="published-page-title"><%= @topic.title %></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,4 +25,4 @@
|
|||
<%= @topic.first_post.cooked.html_safe %>
|
||||
</div>
|
||||
<%- end -%>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -98,6 +98,16 @@ RSpec.describe PublishedPagesController do
|
|||
expect(response.status).to eq(200)
|
||||
end
|
||||
|
||||
it "works even if image logos are not available" do
|
||||
SiteSetting.logo_small = nil
|
||||
get published_page.path
|
||||
expect(response.body).to include("<img class=\"published-page-logo\" src=\"#{SiteSetting.logo.url}\"/>")
|
||||
|
||||
SiteSetting.logo = nil
|
||||
get published_page.path
|
||||
expect(response.body).not_to include("published-page-logo")
|
||||
end
|
||||
|
||||
it "defines correct css classes on body" do
|
||||
get published_page.path
|
||||
expect(response.body).to include("<body class=\"published-page #{published_page.slug} topic-#{published_page.topic_id} recipes uncategorized\">")
|
||||
|
|
Loading…
Reference in New Issue