Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting logo in the admin config #16006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/configuration_controller.rb
Expand Up @@ -18,7 +18,7 @@ def update

def configuration_params
params.require(:configuration).permit(:name, :title, :description, :tos_url, :code_of_conduct, :contact_name, :contact_url,
:unlisted_projects_filter, :unlisted_projects_filter_description)
:unlisted_projects_filter, :unlisted_projects_filter_description, :logo)
end

def set_configuration
Expand Down
1 change: 1 addition & 0 deletions src/api/app/models/configuration.rb
@@ -1,5 +1,6 @@
# The OBS instance configuration
class Configuration < ApplicationRecord
has_one_attached :logo
after_save :delayed_write_to_backend

include CanRenderModel
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/layouts/webui/_top_navigation.html.haml
@@ -1,7 +1,7 @@
%nav.navbar.navbar-dark.navbar-themed-colors.fixed-top
.container-fluid.d-flex.flex-nowrap.justify-content-between.w-100
= link_to(root_path, class: 'navbar-brand', alt: 'Logo') do
= image_tag('obs-logo_small.svg')
= image_tag(::Configuration.logo.attached? ? ::Configuration.logo : 'obs-logo_small.svg')
.d-flex.nav
= render partial: 'layouts/webui/top_navigation_search'
- if User.session
Expand Down
5 changes: 5 additions & 0 deletions src/api/app/views/webui/configuration/index.html.haml
Expand Up @@ -18,6 +18,11 @@
Description
%abbr.text-danger{ title: 'required' } *
~ f.text_area :description, rows: 7, required: true, class: 'form-control'
.mb-3
= f.label(:logo) do
Logo
%small.form-text The image displayed on the left side of the top navigation bar.
~ f.file_field :logo, class: 'form-control'
.mb-3
= f.label(:tos_url) do
Terms Of Service URL
Expand Down