Add ability to set logo via ENV var (#2123)

This commit is contained in:
Ben Halpern 2019-03-20 11:14:23 -04:00 committed by GitHub
parent 1a06096b6a
commit c92c77396c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -11,6 +11,9 @@ enable_defaults! { ENV['RACK_ENV'] != 'production' }
variable :APP_DOMAIN, :String, default: "localhost:3000"
variable :APP_PROTOCOL, :String, default: "http://"
# Logo
variable :LOGO_SVG, :String, default: ""
# Default staff account's id
variable :DEVTO_USER_ID, :Integer, default: 1

View file

@ -198,4 +198,13 @@ module ApplicationHelper
"/t/#{params[:tag]}"
end
def logo_svg
logo = if ApplicationConfig["LOGO_SVG"].present?
ApplicationConfig["LOGO_SVG"].html_safe
else
inline_svg("devplain.svg", class: "logo", size: "20% * 20%")
end
logo
end
end

View file

@ -3,7 +3,7 @@
<div class="top-bar" id="top-bar">
<nav>
<a href="#articles-list" class="skip-content-link">Skip to content</a>
<a href="/" class="logo-link" id="logo-link" aria-label="DEV Home"><%= inline_svg("devplain.svg", class: "logo", size: "20% * 20%") %></a>
<a href="/" class="logo-link" id="logo-link" aria-label="DEV Home"><%= logo_svg %></a>
<div id="nav-search-form-root">
<div class="nav-search-form">
<form acceptCharset="UTF-8" method="get">