Commit fc27154e authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'mw-replace-fa-chevron-down-in-template-selectors' into 'master'

Replace fa-chevron-down in template selector dropdown

See merge request gitlab-org/gitlab!48015
parents 041c6278 2b0de66e
...@@ -12,7 +12,10 @@ export default class FileTemplateSelector { ...@@ -12,7 +12,10 @@ export default class FileTemplateSelector {
this.$dropdown = $(cfg.dropdown); this.$dropdown = $(cfg.dropdown);
this.$wrapper = $(cfg.wrapper); this.$wrapper = $(cfg.wrapper);
this.$loadingIcon = this.$wrapper.find('.fa-chevron-down'); this.$dropdownIcon = this.$wrapper.find('.dropdown-menu-toggle-icon');
this.$loadingIcon = $(
'<div class="gl-spinner gl-spinner-orange gl-spinner-sm gl-absolute gl-top-3 gl-right-3 gl-display-none"></div>',
).insertAfter(this.$dropdownIcon);
this.$dropdownToggleText = this.$wrapper.find('.dropdown-toggle-text'); this.$dropdownToggleText = this.$wrapper.find('.dropdown-toggle-text');
this.initDropdown(); this.initDropdown();
...@@ -45,15 +48,13 @@ export default class FileTemplateSelector { ...@@ -45,15 +48,13 @@ export default class FileTemplateSelector {
} }
renderLoading() { renderLoading() {
this.$loadingIcon this.$loadingIcon.removeClass('gl-display-none');
.addClass('gl-spinner gl-spinner-orange gl-spinner-sm') this.$dropdownIcon.addClass('gl-display-none');
.removeClass('fa-chevron-down');
} }
renderLoaded() { renderLoaded() {
this.$loadingIcon this.$loadingIcon.addClass('gl-display-none');
.addClass('fa-chevron-down') this.$dropdownIcon.removeClass('gl-display-none');
.removeClass('gl-spinner gl-spinner-orange gl-spinner-sm');
} }
reportSelection(options) { reportSelection(options) {
......
...@@ -10,7 +10,10 @@ export default class TemplateSelector { ...@@ -10,7 +10,10 @@ export default class TemplateSelector {
this.dropdown = dropdown; this.dropdown = dropdown;
this.$dropdownContainer = wrapper; this.$dropdownContainer = wrapper;
this.$filenameInput = $input || $('#file_name'); this.$filenameInput = $input || $('#file_name');
this.$dropdownIcon = $('.fa-chevron-down', dropdown); this.$dropdownIcon = $('.dropdown-menu-toggle-icon', dropdown);
this.$loadingIcon = $(
'<div class="gl-spinner gl-spinner-orange gl-spinner-sm gl-absolute gl-top-3 gl-right-3 gl-display-none"></div>',
).insertAfter(this.$dropdownIcon);
this.initDropdown(dropdown, data); this.initDropdown(dropdown, data);
this.listenForFilenameInput(); this.listenForFilenameInput();
...@@ -92,10 +95,12 @@ export default class TemplateSelector { ...@@ -92,10 +95,12 @@ export default class TemplateSelector {
} }
startLoadingSpinner() { startLoadingSpinner() {
this.$dropdownIcon.addClass('spinner').removeClass('fa-chevron-down'); this.$loadingIcon.removeClass('gl-display-none');
this.$dropdownIcon.addClass('gl-display-none');
} }
stopLoadingSpinner() { stopLoadingSpinner() {
this.$dropdownIcon.addClass('fa-chevron-down').removeClass('spinner'); this.$loadingIcon.addClass('gl-display-none');
this.$dropdownIcon.removeClass('gl-display-none');
} }
} }
...@@ -51,7 +51,7 @@ module DropdownsHelper ...@@ -51,7 +51,7 @@ module DropdownsHelper
default_label = data_attr[:default_label] default_label = data_attr[:default_label]
content_tag(:button, disabled: options[:disabled], class: "dropdown-menu-toggle #{options[:toggle_class] if options.key?(:toggle_class)}", id: (options[:id] if options.key?(:id)), type: "button", data: data_attr) do content_tag(:button, disabled: options[:disabled], class: "dropdown-menu-toggle #{options[:toggle_class] if options.key?(:toggle_class)}", id: (options[:id] if options.key?(:id)), type: "button", data: data_attr) do
output = content_tag(:span, toggle_text, class: "dropdown-toggle-text #{'is-default' if toggle_text == default_label}") output = content_tag(:span, toggle_text, class: "dropdown-toggle-text #{'is-default' if toggle_text == default_label}")
output << icon('chevron-down') output << sprite_icon('chevron-down', css_class: "dropdown-menu-toggle-icon gl-top-3")
output.html_safe output.html_safe
end end
end end
......
---
title: Replace fa-chevron-down in template selector dropdown
merge_request: 48015
author:
type: changed
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