Project

General

Profile

User story #1262 » 0001-Filter-scrum-board-rows-to-show-asignees-tasks.patch

Bartosz Firyn, 2016-12-02 19:35

View differences:

app/views/post_its/sprint_board/_head.html.erb
18 18
          <label><%= l(:field_end_date) %>:</label>
19 19
          <%= format_date sprint.sprint_end_date %>
20 20
        </p>
21
        <p>
22
          <label><%= l(:field_assigned_to) %>:</label>
23
          <select id="tasks-assignees"></select>
24
        </p>
21 25
      </div>
22 26
    </td>
23 27
    <%- if !(sprint.description.blank?) -%>
......
26 30
      </td>
27 31
    <%- end -%>
28 32
  </tr>
29
</table>
33
</table>
app/views/sprints/_show.js.erb
1 1
<%- if User.current.allowed_to?(:sort_sprint_board, sprint.project) -%>
2 2
  <%= javascript_tag do %>
3 3
    $(document).ready(function() {
4

  
5
      // populate assignees select box
6

  
7
      var $assignees = $("#tasks-assignees");
8
      var names = { };
9

  
10
      $assignees.append("<option value='all'></option>");
11
    
12
      $("table.sprint-board a.user").each(function(i, a) {
13
        names[$.trim(a.text)] = i;
14
      });
15
      $.each(names, function(name, v) {
16
        $assignees.append("<option value='" + name + "'>" + name + "</option>");
17
      });
18

  
19
      $assignees.change(function(name){
20
        var name = $assignees.val();
21
        if (name === "all") {
22
          $("table.sprint-board tr.sprint-board").show();
23
        } else {
24
          $("table.sprint-board tr.sprint-board").hide();
25
          $("table.sprint-board a.user:contains('" + name + "')").parents("tr.sprint-board").show();
26
        }
27
      });
28

  
29
      // create sortables from items      
30

  
4 31
      $("#<%= sprint_board_id %>").sortable({
5 32
        handle: ".sprint-pbi",
6 33
        placeholder: "sprint-row-space",
......
27 54
      });
28 55
    });
29 56
  <% end %>
30
<%- end -%>
57
<%- end -%>
31
- 
    (1-1/1)