summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/right_sidebar.js
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-10-27 13:28:40 +0000
committerFatih Acet <acetfatih@gmail.com>2016-10-27 13:28:40 +0000
commitf879319840949c1d4b363742cb9573d89abd1296 (patch)
tree7138a0edfb88cc4cb86a078bc0a3e2f93df64125 /app/assets/javascripts/right_sidebar.js
parent337c5ded7ed46f69efc9d1c47114d3b5a18dceba (diff)
parentf610f69ab92827c49e9cbb528cacc26af10be081 (diff)
downloadgitlab-ce-f879319840949c1d4b363742cb9573d89abd1296.tar.gz
Merge branch 'add-todo-toggle-event' into 'master' remove-tooltip-text-truncation-from-pipeline-graph-build-node-tooltips
Add todo toggle event ## What does this MR do? Adds a custom jQuery event `todo:toggle` to detect when a new todo is added so that the respective todo counters (header navigation and sidebar) can update as needed ## Are there points in the code the reviewer needs to double check? * I wasn't sure whether each `spec` should be modularized based on the html templates or whether they should be separated based on function. There are some crossovers between the `dashboard_spec` and the `header_spec`. * The naming conventions for `sidebar` and `right_sidebar` were a little confusing since they were named the opposite in their `specs`. I made a few assumptions and named a few files based on what I thought they should be named. I'd be happy to change it to something else though :smile: ## Why was this MR needed? This resolves an existing issue where the todo count on the sidebar would not update (until refresh) and refactors the existing methods that are used to update the todo counters (header navigation and sidebar) ## What are the relevant issue numbers? Closes #20140 ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5724
Diffstat (limited to 'app/assets/javascripts/right_sidebar.js')
-rw-r--r--app/assets/javascripts/right_sidebar.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js
index dcedea17a9c..df38937858f 100644
--- a/app/assets/javascripts/right_sidebar.js
+++ b/app/assets/javascripts/right_sidebar.js
@@ -82,16 +82,11 @@
};
Sidebar.prototype.todoUpdateDone = function(data, $btn, $btnText, $todoLoading) {
- var $todoPendingCount;
- $todoPendingCount = $('.todos-pending-count');
- $todoPendingCount.text(data.count);
+ $(document).trigger('todo:toggle', data.count);
+
$btn.enable();
$todoLoading.addClass('hidden');
- if (data.count === 0) {
- $todoPendingCount.addClass('hidden');
- } else {
- $todoPendingCount.removeClass('hidden');
- }
+
if (data.delete_path != null) {
$btn.attr('aria-label', $btn.data('mark-text')).attr('data-delete-path', data.delete_path);
return $btnText.text($btn.data('mark-text'));