Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-05-11 04:24:31 +0300
committerAlfredo Sumaran <alfredo@gitlab.com>2017-05-11 04:24:31 +0300
commit8064a400a83cfbf8e5f22b29d722fac7883b0217 (patch)
tree87adf41eb164120299377c05a055c5092369d29d /app/assets/javascripts/groups/groups_filterable_list.js
parent312d02ad6db5b38b7c393f9a84a73e9ead4adfe0 (diff)
Add support to filter groups by filter options
Diffstat (limited to 'app/assets/javascripts/groups/groups_filterable_list.js')
-rw-r--r--app/assets/javascripts/groups/groups_filterable_list.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/groups/groups_filterable_list.js b/app/assets/javascripts/groups/groups_filterable_list.js
index b120adb36b1..f8ba11caccc 100644
--- a/app/assets/javascripts/groups/groups_filterable_list.js
+++ b/app/assets/javascripts/groups/groups_filterable_list.js
@@ -6,13 +6,17 @@ export default class GroupFilterableList extends FilterableList {
super(form, filter, holder);
this.store = store;
+ this.$dropdown = $('.js-group-filter-dropdown-wrap');
}
bindEvents() {
super.bindEvents();
this.onFormSubmitWrapper = this.onFormSubmit.bind(this);
+ this.onFilterOptionClikWrapper = this.onOptionClick.bind(this);
+
this.filterForm.addEventListener('submit', this.onFormSubmitWrapper);
+ this.$dropdown.on('click', 'a', this.onFilterOptionClikWrapper);
}
onFormSubmit(e) {
@@ -21,8 +25,17 @@ export default class GroupFilterableList extends FilterableList {
this.filterResults();
}
+ onOptionClick(e) {
+ e.preventDefault();
+ const currentOption = $.trim(e.currentTarget.text);
+
+ this.filterUrl = e.currentTarget.href;
+ this.$dropdown.find('.dropdown-label').text(currentOption);
+ this.filterResults(this.filterUrl);
+ }
+
onFilterSuccess(data) {
- super.onFilterSuccess();
+ super.onFilterSuccess(data);
this.store.setGroups(data);
}