Skip to content
Snippets Groups Projects
Commit 6bae610c authored by Winnie Hellmann's avatar Winnie Hellmann
Browse files

Replace showAny for NamespaceSelect by isFilter

parent fcc82ab6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,16 +3,13 @@ import Api from './api';
 
export default class NamespaceSelect {
constructor(opts) {
var fieldName, showAny;
const isFilter = opts.dropdown.dataset.isFilter === 'true';
var fieldName;
this.dropdown = $(opts.dropdown);
showAny = true;
fieldName = 'namespace_id';
if (this.dropdown.attr('data-field-name')) {
fieldName = this.dropdown.data('fieldName');
}
if (this.dropdown.attr('data-show-any')) {
showAny = this.dropdown.data('showAny');
}
this.dropdown.glDropdown({
filterable: true,
selectable: true,
Loading
Loading
@@ -31,7 +28,7 @@ export default class NamespaceSelect {
data: function(term, dataCallback) {
return Api.namespaces(term, function(namespaces) {
var anyNamespace;
if (showAny) {
if (isFilter) {
anyNamespace = {
text: 'Any namespace',
id: null
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
= hidden_field_tag :namespace_id, params[:namespace_id]
- namespace = Namespace.find(params[:namespace_id])
- toggle_text = "#{namespace.kind}: #{namespace.full_path}"
= dropdown_toggle(toggle_text, { toggle: 'dropdown' }, { toggle_class: 'js-namespace-select large' })
= dropdown_toggle(toggle_text, { toggle: 'dropdown', is_filter: 'true' }, { toggle_class: 'js-namespace-select large' })
.dropdown-menu.dropdown-select.dropdown-menu-align-right
= dropdown_title('Namespaces')
= dropdown_filter("Search for Namespace")
Loading
Loading
Loading
Loading
@@ -115,7 +115,7 @@
= f.label :new_namespace_id, "Namespace", class: 'control-label'
.col-sm-10
.dropdown
= dropdown_toggle('Search for Namespace', { toggle: 'dropdown', field_name: 'new_namespace_id', show_any: 'false' }, { toggle_class: 'js-namespace-select large' })
= dropdown_toggle('Search for Namespace', { toggle: 'dropdown', field_name: 'new_namespace_id' }, { toggle_class: 'js-namespace-select large' })
.dropdown-menu.dropdown-select
= dropdown_title('Namespaces')
= dropdown_filter("Search for Namespace")
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment