Commit 52c72b66494ad2d3b8bc38631fc7d1bec66cc251

Authored by Aníbal Pacheco
1 parent f5296eab85
Exists in master

Filter to include tasks that the asignee is a watcher

Showing 2 changed files with 16 additions and 4 deletions Side-by-side Diff

app/views/taskboard/index.html.erb View file @ 52c72b6
... ... @@ -4,6 +4,8 @@
4 4 <p>
5 5 <%= label_tag "assignee", "Assigned to" %>
6 6 <%= select_tag("assignee", options_for_select([['Anyone', '0']] + @project.members.collect { |m| [ m.name, m.user.id ] } )) %>
  7 + <%= label_tag "watcher", "Watcher" %>
  8 + <%= check_box_tag "watcher", 1, true %>
7 9 <%= label_tag "priority", "Priority" %>
8 10 <%= select_tag("priority", options_for_select([['Any', '0']] + IssuePriority.all.collect { |m| [ m.name, m.id ] } )) %>
9 11 <%= label_tag "category", "Category" %>
... ... @@ -28,7 +30,7 @@
28 30 <% end %>
29 31 <ul data-status-id="<%= status_id %>" data-max-issues="<%= column.max_issues %>" id="column_<%= status_id %>"<% if issues.empty? %> class="empty"<% end %>>
30 32 <% issues.each do|issue| %>
31   - <li class="card priority-<%= issue.priority.id.to_s %> <%= issue.tracker.name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') %>" id="issue_<%= issue.id %>" data-issue-id="<%= issue.id %>" data-priority="<%= issue.priority.id.to_s %>" data-assignee="<%= issue.assigned_to ? issue.assigned_to.id.to_s : 0 %>" data-category="<%= issue.category ? issue.category.id.to_s : 0 %>" data-weight="<%= issue.weight %>" data-status-id="<%= issue.status_id %>">
  33 + <li class="card priority-<%= issue.priority.id.to_s %> <%= issue.tracker.name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') %>" id="issue_<%= issue.id %>" data-issue-id="<%= issue.id %>" data-priority="<%= issue.priority.id.to_s %>" data-assignee="<%= issue.assigned_to ? issue.assigned_to.id.to_s : 0 %>" data-watchers="<%= issue.watchers.collect { |w| w.user.id } %>" data-category="<%= issue.category ? issue.category.id.to_s : 0 %>" data-weight="<%= issue.weight %>" data-status-id="<%= issue.status_id %>">
32 34 <div class="issue">
33 35 <div class="issue-heading">
34 36 <p class="issue-number meta">
assets/javascripts/task_board.js View file @ 52c72b6
... ... @@ -41,6 +41,7 @@
41 41 priority: 0,
42 42 category: 0,
43 43 assignee: 0, // only used on project taskboard
  44 + watcher: false,
44 45 project: 0 // only used on "my" taskboard
45 46 },
46 47 init: function() {
... ... @@ -51,6 +52,12 @@
51 52 self.filters[$(this).attr('name')] = parseInt($(this).val());
52 53 self.applyFilters();
53 54 });
  55 +
  56 + self.filters["watcher"] = $("#watcher").change(function() {
  57 + self.filters["watcher"] = $("#watcher").prop("checked");
  58 + self.applyFilters();
  59 + }).prop("checked");
  60 +
54 61 if ($("#page_is_dirty").val() == 0) {
55 62 $("#assignee option[value=" + $("#user_id").val() + "]").prop("selected", true).change();
56 63 } else {
57 64  
... ... @@ -63,10 +70,13 @@
63 70 $('#sortable-root').find('li.card').each(function() {
64 71 var minimized = false;
65 72 for (var f in self.filters) {
66   - if (self.filters[f] == 0 || self.filters[f] == parseInt($(this).data(f))) {
  73 + if ((f == "assignee" && (self.filters[f] == 0 || (
  74 + self.filters[f] == parseInt($(this).data(f)) || self.filters["watcher"] &&
  75 + $.inArray(self.filters[f], $(this).data("watchers")) >= 0)))
  76 + || f == "watcher" || f != "assignee" && (
  77 + self.filters[f] == 0 || self.filters[f] == parseInt($(this).data(f)))) {
67 78 continue;
68   - }
69   - else {
  79 + } else {
70 80 minimized = true;
71 81 break;
72 82 }