From b4d84c07bcf143aeab7abccb8d0cdb849f605af5 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Mon, 5 Feb 2018 15:41:37 +0100 Subject: [PATCH] remove favicon preview on appearance page --- app/assets/javascripts/favicon_admin.js | 19 ------------------- app/views/admin/appearances/_form.html.haml | 7 +------ lib/gitlab/favicon.rb | 6 ------ spec/features/admin/admin_appearance_spec.rb | 5 ++--- 4 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 app/assets/javascripts/favicon_admin.js diff --git a/app/assets/javascripts/favicon_admin.js b/app/assets/javascripts/favicon_admin.js deleted file mode 100644 index 97e87054ce0..00000000000 --- a/app/assets/javascripts/favicon_admin.js +++ /dev/null @@ -1,19 +0,0 @@ -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 = $(''); - image.addClass('appearance-light-logo-preview'); - image.attr('src', faviconWithOverlayUrl); - - faviconContainer.append(image); - }); - }); - } -} diff --git a/app/views/admin/appearances/_form.html.haml b/app/views/admin/appearances/_form.html.haml index 308a779cb88..81979f7b331 100644 --- a/app/views/admin/appearances/_form.html.haml +++ b/app/views/admin/appearances/_form.html.haml @@ -62,12 +62,7 @@ = f.label :favicon, 'Favicon', class: 'control-label' .col-sm-10 - if @appearance.favicon? - = image_tag @appearance.favicon.favicon_main.url, class: 'appearance-light-logo-preview js-main-favicon' - - 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 } } + = image_tag @appearance.favicon.favicon_main.url, class: 'appearance-light-logo-preview' - if @appearance.persisted? %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" diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb index d0178d0fdf9..e3e4a18e241 100644 --- a/lib/gitlab/favicon.rb +++ b/lib/gitlab/favicon.rb @@ -18,12 +18,6 @@ module Gitlab ActionController::Base.helpers.image_path(path) end - def available_status_overlays - available_status_names.map do |status_name| - status_overlay(status_name) - end - end - def available_status_names @available_status_names ||= begin Dir.glob(Rails.root.join('app', 'assets', 'images', 'ci_favicons', '*.png')) diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index 0ac4f111c52..bd879635d2f 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -76,15 +76,14 @@ feature 'Admin Appearance' do expect(page).not_to have_css(header_logo_selector) end - scenario 'Favicon', :js do + scenario 'Favicon' do sign_in(create(:admin)) visit admin_appearances_path attach_file(:appearance_favicon, logo_fixture) click_button 'Save' - # 11 = 1 original + 10 overlay variations - expect(page).to have_css('.appearance-light-logo-preview', count: 11) + expect(page).to have_css('.appearance-light-logo-preview') click_link 'Remove favicon'