Skip to content

Commit

Permalink
Let the admin upload the logo for the header
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp-work committed Apr 18, 2024
1 parent ee573fe commit 5fe8de9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
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

0 comments on commit 5fe8de9

Please sign in to comment.