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:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2016-08-28 18:24:48 +0300
committerLuke Bennett <lukeeeebennettplus@gmail.com>2016-09-01 16:35:34 +0300
commit922b38a0bea8c5b8610120dfb5ea168db713f3e3 (patch)
tree3acd8626b10ab6b2072426dcce30b51b1a884be9 /app/assets/javascripts/todos.js
parentf157a9e5144fde90dc31add4006b9132e1489aa1 (diff)
Removed inline JS and improved dropdown labels
Diffstat (limited to 'app/assets/javascripts/todos.js')
-rw-r--r--app/assets/javascripts/todos.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/app/assets/javascripts/todos.js b/app/assets/javascripts/todos.js
index 06605320a35..ef1eadfb9c0 100644
--- a/app/assets/javascripts/todos.js
+++ b/app/assets/javascripts/todos.js
@@ -13,6 +13,7 @@
this.perPage = this.el.data('perPage');
this.clearListeners();
this.initBtnListeners();
+ this.initFilters();
}
Todos.prototype.clearListeners = function() {
@@ -27,6 +28,61 @@
return $('.todo').on('click', this.goToTodoUrl);
};
+ Todos.prototype.initFilters = function() {
+ new UsersSelect();
+ this.initProjectFilterDropdown();
+ this.initTypeFilterDropdown();
+ this.initActionFilterDropdown();
+
+ $('form.filter-form').on('submit', function (event) {
+ event.preventDefault();
+ Turbolinks.visit(this.action + '&' + $(this).serialize());
+ });
+ };
+
+ Todos.prototype.initProjectFilterDropdown = function() {
+ $projectDropdown = $('.js-project-search');
+ $projectDropdown.glDropdown({
+ filterable: true,
+ selectable: true,
+ fieldName: 'project_id',
+ data: $projectDropdown.data('data'),
+ clicked: function() {
+ if ($projectDropdown.hasClass('js-filter-submit')) {
+ return $projectDropdown.closest('form.filter-form').submit();
+ }
+ }
+ });
+ };
+
+ Todos.prototype.initTypeFilterDropdown = function() {
+ $typeDropdown = $('.js-type-search');
+ $typeDropdown.glDropdown({
+ selectable: true,
+ fieldName: 'type',
+ data: $typeDropdown.data('data'),
+ clicked: function() {
+ if ($typeDropdown.hasClass('js-filter-submit')) {
+ return $typeDropdown.closest('form.filter-form').submit();
+ }
+ }
+ });
+ };
+
+ Todos.prototype.initActionFilterDropdown = function() {
+ $actionDropdown = $('.js-action-search');
+ $actionDropdown.glDropdown({
+ selectable: true,
+ fieldName: 'action_id',
+ data: $actionDropdown.data('data'),
+ clicked: function() {
+ if ($actionDropdown.hasClass('js-filter-submit')) {
+ return $actionDropdown.closest('form.filter-form').submit();
+ }
+ }
+ });
+ };
+
Todos.prototype.doneClicked = function(e) {
var $this;
e.preventDefault();