Commit b4d84c07 authored by Alexis Reigel's avatar Alexis Reigel Committed by Alexis Reigel

remove favicon preview on appearance page

parent 36d000cb
import {createOverlayIcon} from '~/lib/utils/common_utils';
export default class FaviconAdmin {
constructor() {
const faviconContainer = $('.js-favicons');
const faviconUrl = faviconContainer.data('favicon');
const overlayUrls = faviconContainer.data('status-overlays') || [];
overlayUrls.forEach((statusOverlay) => {
createOverlayIcon(faviconUrl, statusOverlay).then((faviconWithOverlayUrl) => {
const image = $('<img />');
image.addClass('appearance-light-logo-preview');
image.attr('src', faviconWithOverlayUrl);
faviconContainer.append(image);
});
});
}
}
...@@ -62,12 +62,7 @@ ...@@ -62,12 +62,7 @@
= f.label :favicon, 'Favicon', class: 'control-label' = f.label :favicon, 'Favicon', class: 'control-label'
.col-sm-10 .col-sm-10
- if @appearance.favicon? - if @appearance.favicon?
= image_tag @appearance.favicon.favicon_main.url, class: 'appearance-light-logo-preview js-main-favicon' = image_tag @appearance.favicon.favicon_main.url, class: 'appearance-light-logo-preview'
- if @appearance.favicon?
= f.label :favicon, 'Status icons preview', class: 'control-label'
.col-sm-10
- if @appearance.favicon?
.js-favicons{ data: { favicon: @appearance.favicon.favicon_main.url, status_overlays: Gitlab::Favicon.available_status_overlays } }
- 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 btn-inverted btn-remove btn-sm remove-logo" = link_to 'Remove favicon', favicon_admin_appearances_path, data: { confirm: "Favicon will be removed. Are you sure?"}, method: :delete, class: "btn btn-inverted btn-remove btn-sm remove-logo"
......
...@@ -18,12 +18,6 @@ module Gitlab ...@@ -18,12 +18,6 @@ module Gitlab
ActionController::Base.helpers.image_path(path) ActionController::Base.helpers.image_path(path)
end end
def available_status_overlays
available_status_names.map do |status_name|
status_overlay(status_name)
end
end
def available_status_names def available_status_names
@available_status_names ||= begin @available_status_names ||= begin
Dir.glob(Rails.root.join('app', 'assets', 'images', 'ci_favicons', '*.png')) Dir.glob(Rails.root.join('app', 'assets', 'images', 'ci_favicons', '*.png'))
......
...@@ -76,15 +76,14 @@ feature 'Admin Appearance' do ...@@ -76,15 +76,14 @@ feature 'Admin Appearance' do
expect(page).not_to have_css(header_logo_selector) expect(page).not_to have_css(header_logo_selector)
end end
scenario 'Favicon', :js do scenario 'Favicon' do
sign_in(create(:admin)) sign_in(create(:admin))
visit admin_appearances_path visit admin_appearances_path
attach_file(:appearance_favicon, logo_fixture) attach_file(:appearance_favicon, logo_fixture)
click_button 'Save' click_button 'Save'
# 11 = 1 original + 10 overlay variations expect(page).to have_css('.appearance-light-logo-preview')
expect(page).to have_css('.appearance-light-logo-preview', count: 11)
click_link 'Remove favicon' click_link 'Remove favicon'
......
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