Commit e6feccff authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '328413-moving-admin-appearance-setting' into 'master'

Move "Appearances" menu item into "Settings" in admin area

See merge request gitlab-org/gitlab!62522
parents 29b8f8a4 c08debbc
# frozen_string_literal: true # frozen_string_literal: true
class Admin::AppearancesController < Admin::ApplicationController class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationController
before_action :set_appearance, except: :create before_action :set_appearance, except: :create
feature_category :navigation feature_category :navigation
...@@ -16,7 +16,7 @@ class Admin::AppearancesController < Admin::ApplicationController ...@@ -16,7 +16,7 @@ class Admin::AppearancesController < Admin::ApplicationController
@appearance = Appearance.new(appearance_params) @appearance = Appearance.new(appearance_params)
if @appearance.save if @appearance.save
redirect_to admin_appearances_path, notice: _('Appearance was successfully created.') redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully created.')
else else
render action: 'show' render action: 'show'
end end
...@@ -24,7 +24,7 @@ class Admin::AppearancesController < Admin::ApplicationController ...@@ -24,7 +24,7 @@ class Admin::AppearancesController < Admin::ApplicationController
def update def update
if @appearance.update(appearance_params) if @appearance.update(appearance_params)
redirect_to admin_appearances_path, notice: _('Appearance was successfully updated.') redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully updated.')
else else
render action: 'show' render action: 'show'
end end
...@@ -35,21 +35,21 @@ class Admin::AppearancesController < Admin::ApplicationController ...@@ -35,21 +35,21 @@ class Admin::AppearancesController < Admin::ApplicationController
@appearance.save @appearance.save
redirect_to admin_appearances_path, notice: _('Logo was successfully removed.') redirect_to admin_application_settings_appearances_path, notice: _('Logo was successfully removed.')
end end
def header_logos def header_logos
@appearance.remove_header_logo! @appearance.remove_header_logo!
@appearance.save @appearance.save
redirect_to admin_appearances_path, notice: _('Header logo was successfully removed.') redirect_to admin_application_settings_appearances_path, notice: _('Header logo was successfully removed.')
end end
def favicon def favicon
@appearance.remove_favicon! @appearance.remove_favicon!
@appearance.save @appearance.save
redirect_to admin_appearances_path, notice: _('Favicon was successfully removed.') redirect_to admin_application_settings_appearances_path, notice: _('Favicon was successfully removed.')
end end
private private
......
- parsed_with_gfm = (_("Content parsed with %{link}.") % { link: link_to('GitLab Flavored Markdown', help_page_path('user/markdown'), target: '_blank') }).html_safe - parsed_with_gfm = (_("Content parsed with %{link}.") % { link: link_to('GitLab Flavored Markdown', help_page_path('user/markdown'), target: '_blank') }).html_safe
= form_for @appearance, url: admin_appearances_path, html: { class: 'gl-mt-3' } do |f| = form_for @appearance, url: admin_application_settings_appearances_path, html: { class: 'gl-mt-3' } do |f|
= form_errors(@appearance) = form_errors(@appearance)
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
= image_tag @appearance.header_logo_path, class: 'appearance-light-logo-preview' = image_tag @appearance.header_logo_path, class: 'appearance-light-logo-preview'
- if @appearance.persisted? - if @appearance.persisted?
%br %br
= link_to _('Remove header logo'), header_logos_admin_appearances_path, data: { confirm: _("Header logo will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm" = link_to _('Remove header logo'), header_logos_admin_application_settings_appearances_path, data: { confirm: _("Header logo will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm"
%hr %hr
= f.hidden_field :header_logo_cache = f.hidden_field :header_logo_cache
= f.file_field :header_logo, class: "", accept: 'image/*' = f.file_field :header_logo, class: "", accept: 'image/*'
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
= image_tag @appearance.favicon_path, class: 'appearance-light-logo-preview' = image_tag @appearance.favicon_path, class: 'appearance-light-logo-preview'
- if @appearance.persisted? - if @appearance.persisted?
%br %br
= link_to _('Remove favicon'), favicon_admin_appearances_path, data: { confirm: _("Favicon will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm" = link_to _('Remove favicon'), favicon_admin_application_settings_appearances_path, data: { confirm: _("Favicon will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm"
%hr %hr
= f.hidden_field :favicon_cache = f.hidden_field :favicon_cache
= f.file_field :favicon, class: '', accept: 'image/*' = f.file_field :favicon, class: '', accept: 'image/*'
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
%br %br
= _("Images with incorrect dimensions are not resized automatically, and may result in unexpected behavior.") = _("Images with incorrect dimensions are not resized automatically, and may result in unexpected behavior.")
= render partial: 'admin/appearances/system_header_footer_form', locals: { form: f } = render partial: 'admin/application_settings/appearances/system_header_footer_form', locals: { form: f }
%hr %hr
.row .row
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
= image_tag @appearance.logo_path, class: 'appearance-logo-preview' = image_tag @appearance.logo_path, class: 'appearance-logo-preview'
- if @appearance.persisted? - if @appearance.persisted?
%br %br
= link_to _('Remove logo'), logo_admin_appearances_path, data: { confirm: _("Logo will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm remove-logo" = link_to _('Remove logo'), logo_admin_application_settings_appearances_path, data: { confirm: _("Logo will be removed. Are you sure?") }, method: :delete, class: "btn gl-button btn-danger btn-danger-secondary btn-sm remove-logo"
%hr %hr
= f.hidden_field :logo_cache = f.hidden_field :logo_cache
= f.file_field :logo, class: "", accept: 'image/*' = f.file_field :logo, class: "", accept: 'image/*'
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
.mt-4 .mt-4
- if @appearance.persisted? - if @appearance.persisted?
Preview last save: Preview last save:
= link_to _('Sign-in page'), preview_sign_in_admin_appearances_path, class: 'btn', target: '_blank', rel: 'noopener noreferrer' = link_to _('Sign-in page'), preview_sign_in_admin_application_settings_appearances_path, class: 'btn', target: '_blank', rel: 'noopener noreferrer'
= link_to _('New project page'), new_project_path, class: 'btn', target: '_blank', rel: 'noopener noreferrer' = link_to _('New project page'), new_project_path, class: 'btn', target: '_blank', rel: 'noopener noreferrer'
- if @appearance.updated_at - if @appearance.updated_at
......
...@@ -234,19 +234,7 @@ ...@@ -234,19 +234,7 @@
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
= _('Labels') = _('Labels')
= nav_link(controller: :appearances) do = nav_link(controller: [:application_settings, :integrations, :appearances]) do
= link_to admin_appearances_path do
.nav-icon-container
= sprite_icon('appearance')
%span.nav-item-name
= _('Appearance')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: :appearances, html_options: { class: "fly-out-top-item" } ) do
= link_to admin_appearances_path do
%strong.fly-out-top-item-name
= _('Appearance')
= nav_link(controller: [:application_settings, :integrations]) do
= link_to general_admin_application_settings_path, class: 'has-sub-items' do = link_to general_admin_application_settings_path, class: 'has-sub-items' do
.nav-icon-container .nav-icon-container
= sprite_icon('settings') = sprite_icon('settings')
...@@ -255,7 +243,7 @@ ...@@ -255,7 +243,7 @@
%ul.sidebar-sub-level-items{ data: { qa_selector: 'admin_sidebar_settings_submenu_content' } } %ul.sidebar-sub-level-items{ data: { qa_selector: 'admin_sidebar_settings_submenu_content' } }
-# This active_nav_link check is also used in `app/views/layouts/admin.html.haml` -# This active_nav_link check is also used in `app/views/layouts/admin.html.haml`
= nav_link(controller: [:application_settings, :integrations], html_options: { class: "fly-out-top-item" } ) do = nav_link(controller: [:application_settings, :integrations, :appearances], html_options: { class: "fly-out-top-item" } ) do
= link_to general_admin_application_settings_path do = link_to general_admin_application_settings_path do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
= _('Settings') = _('Settings')
...@@ -302,6 +290,10 @@ ...@@ -302,6 +290,10 @@
= link_to network_admin_application_settings_path, title: _('Network'), data: { qa_selector: 'admin_settings_network_item' } do = link_to network_admin_application_settings_path, title: _('Network'), data: { qa_selector: 'admin_settings_network_item' } do
%span %span
= _('Network') = _('Network')
= nav_link(controller: :appearances ) do
= link_to admin_application_settings_appearances_path do
%span
= _('Appearance')
= nav_link(path: 'application_settings#preferences') do = nav_link(path: 'application_settings#preferences') do
= link_to preferences_admin_application_settings_path, title: _('Preferences'), data: { qa_selector: 'admin_settings_preferences_link' } do = link_to preferences_admin_application_settings_path, title: _('Preferences'), data: { qa_selector: 'admin_settings_preferences_link' } do
%span %span
......
...@@ -124,15 +124,6 @@ namespace :admin do ...@@ -124,15 +124,6 @@ namespace :admin do
end end
end end
resource :appearances, only: [:show, :create, :update], path: 'appearance' do
member do
get :preview_sign_in
delete :logo
delete :header_logos
delete :favicon
end
end
resource :application_settings, only: :update do resource :application_settings, only: :update do
resources :services, only: [:index, :edit, :update] resources :services, only: [:index, :edit, :update]
resources :integrations, only: [:edit, :update] do resources :integrations, only: [:edit, :update] do
...@@ -153,6 +144,15 @@ namespace :admin do ...@@ -153,6 +144,15 @@ namespace :admin do
get :status_create_self_monitoring_project get :status_create_self_monitoring_project
delete :delete_self_monitoring_project delete :delete_self_monitoring_project
get :status_delete_self_monitoring_project get :status_delete_self_monitoring_project
resource :appearances, only: [:show, :create, :update], path: 'appearance', module: 'application_settings' do
member do
get :preview_sign_in
delete :logo
delete :header_logos
delete :favicon
end
end
end end
resources :plan_limits, only: :create resources :plan_limits, only: :create
......
...@@ -9,7 +9,7 @@ disqus_identifier: 'https://docs.gitlab.com/ee/customization/branded_login_page. ...@@ -9,7 +9,7 @@ disqus_identifier: 'https://docs.gitlab.com/ee/customization/branded_login_page.
# GitLab Appearance **(FREE SELF)** # GitLab Appearance **(FREE SELF)**
There are several options for customizing the appearance of a self-managed instance There are several options for customizing the appearance of a self-managed instance
of GitLab. These settings are accessed from the **Admin Area** in the **Appearance** of GitLab. These settings are accessed from the **Admin Area** in the **Settings > Appearance**
section. section.
## Navigation bar ## Navigation bar
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Admin::AppearancesController do RSpec.describe Admin::ApplicationSettings::AppearancesController do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:header_message) { 'Header message' } let(:header_message) { 'Header message' }
let(:footer_message) { 'Footer' } let(:footer_message) { 'Footer' }
......
...@@ -9,7 +9,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -9,7 +9,7 @@ RSpec.describe 'Admin Appearance' do
it 'create new appearance' do it 'create new appearance' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
fill_in 'appearance_title', with: 'MyCompany' fill_in 'appearance_title', with: 'MyCompany'
fill_in 'appearance_description', with: 'dev server' fill_in 'appearance_description', with: 'dev server'
...@@ -17,7 +17,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -17,7 +17,7 @@ RSpec.describe 'Admin Appearance' do
fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines' fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines'
click_button 'Update appearance settings' click_button 'Update appearance settings'
expect(current_path).to eq admin_appearances_path expect(current_path).to eq admin_application_settings_appearances_path
expect(page).to have_content 'Appearance' expect(page).to have_content 'Appearance'
expect(page).to have_field('appearance_title', with: 'MyCompany') expect(page).to have_field('appearance_title', with: 'MyCompany')
...@@ -31,7 +31,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -31,7 +31,7 @@ RSpec.describe 'Admin Appearance' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
click_link "Sign-in page" click_link "Sign-in page"
expect_custom_sign_in_appearance(appearance) expect_custom_sign_in_appearance(appearance)
...@@ -41,7 +41,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -41,7 +41,7 @@ RSpec.describe 'Admin Appearance' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
click_link "New project page" click_link "New project page"
expect_custom_new_project_appearance(appearance) expect_custom_new_project_appearance(appearance)
...@@ -55,7 +55,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -55,7 +55,7 @@ RSpec.describe 'Admin Appearance' do
context 'when system header and footer messages are empty' do context 'when system header and footer messages are empty' do
it 'shows custom system header and footer fields' do it 'shows custom system header and footer fields' do
visit admin_appearances_path visit admin_application_settings_appearances_path
expect(page).to have_field('appearance_header_message', with: '') expect(page).to have_field('appearance_header_message', with: '')
expect(page).to have_field('appearance_footer_message', with: '') expect(page).to have_field('appearance_footer_message', with: '')
...@@ -70,7 +70,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -70,7 +70,7 @@ RSpec.describe 'Admin Appearance' do
end end
it 'shows custom system header and footer fields' do it 'shows custom system header and footer fields' do
visit admin_appearances_path visit admin_application_settings_appearances_path
expect(page).to have_field('appearance_header_message', with: appearance.header_message) expect(page).to have_field('appearance_header_message', with: appearance.header_message)
expect(page).to have_field('appearance_footer_message', with: appearance.footer_message) expect(page).to have_field('appearance_footer_message', with: appearance.footer_message)
...@@ -99,7 +99,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -99,7 +99,7 @@ RSpec.describe 'Admin Appearance' do
before do before do
sign_in(create(:admin)) sign_in(create(:admin))
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines, please :smile:!' fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines, please :smile:!'
click_button 'Update appearance settings' click_button 'Update appearance settings'
end end
...@@ -115,7 +115,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -115,7 +115,7 @@ RSpec.describe 'Admin Appearance' do
it 'appearance logo' do it 'appearance logo' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
attach_file(:appearance_logo, logo_fixture) attach_file(:appearance_logo, logo_fixture)
click_button 'Update appearance settings' click_button 'Update appearance settings'
...@@ -128,7 +128,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -128,7 +128,7 @@ RSpec.describe 'Admin Appearance' do
it 'header logos' do it 'header logos' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
attach_file(:appearance_header_logo, logo_fixture) attach_file(:appearance_header_logo, logo_fixture)
click_button 'Update appearance settings' click_button 'Update appearance settings'
...@@ -141,7 +141,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -141,7 +141,7 @@ RSpec.describe 'Admin Appearance' do
it 'Favicon' do it 'Favicon' do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit admin_appearances_path visit admin_application_settings_appearances_path
attach_file(:appearance_favicon, logo_fixture) attach_file(:appearance_favicon, logo_fixture)
click_button 'Update appearance settings' click_button 'Update appearance settings'
......
...@@ -13,7 +13,7 @@ RSpec.describe 'Admin searches application settings', :js do ...@@ -13,7 +13,7 @@ RSpec.describe 'Admin searches application settings', :js do
context 'in appearances page' do context 'in appearances page' do
before do before do
visit(admin_appearances_path) visit(admin_application_settings_appearances_path)
end end
it_behaves_like 'cannot search settings' it_behaves_like 'cannot search settings'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment