summaryrefslogtreecommitdiff
path: root/app/views/dashboard/todos/index.html.haml
blob: d320d3bcc1e31ffec36a9f09b11733ed93de2d84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- page_title "Todos"
- header_title "Todos", dashboard_todos_path

.top-area
  %ul.nav-links
    - todo_pending_active = ('active' if params[:state].blank? || params[:state] == 'pending')
    %li{class: "todos-pending #{todo_pending_active}"}
      = link_to todos_filter_path(state: 'pending') do
        %span
          To do
        %span.badge
          = number_with_delimiter(todos_pending_count)
    - todo_done_active = ('active' if params[:state] == 'done')
    %li{class: "todos-done #{todo_done_active}"}
      = link_to todos_filter_path(state: 'done') do
        %span
          Done
        %span.badge
          = number_with_delimiter(todos_done_count)

  .nav-controls
    - if @todos.any?(&:pending?)
      = link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'btn btn-loading js-todos-mark-all', method: :delete do
        Mark all as done
        = icon('spinner spin')

.todos-filters
  .row-content-block.second-block
    = form_tag todos_filter_path(without: [:project_id, :author_id, :type, :action_id]), method: :get, class: 'filter-form' do
      .filter-item.inline
        = select_tag('project_id', todo_projects_options,
          class: 'select2 trigger-submit', include_blank: true,
          data: {placeholder: 'Project'})
      .filter-item.inline
        = users_select_tag(:author_id, selected: params[:author_id],
          placeholder: 'Author', class: 'trigger-submit', any_user: "Any Author", first_user: true, current_user: true)
      .filter-item.inline
        = select_tag('type', todo_types_options,
          class: 'select2 trigger-submit', include_blank: true,
          data: {placeholder: 'Type'})
      .filter-item.inline.actions-filter
        = select_tag('action_id', todo_actions_options,
          class: 'select2 trigger-submit', include_blank: true,
          data: {placeholder: 'Action'})

      .pull-right
        .dropdown.inline.prepend-left-10
          %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
            %span.light
            - if @sort.present?
              = sort_options_hash[@sort]
            - else
              = sort_title_recently_created
            %b.caret
          %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-sort
            %li
              = link_to todos_filter_path(sort: sort_value_priority) do
                = sort_title_priority
              = link_to todos_filter_path(sort: sort_value_recently_created) do
                = sort_title_recently_created
              = link_to todos_filter_path(sort: sort_value_oldest_created) do
                = sort_title_oldest_created


.prepend-top-default
  - if @todos.any?
    .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} }
    - @todos.group_by(&:project).each do |group|
      .panel.panel-default.panel-small.js-todos-list
        - project = group[0]
        .panel-heading
          = link_to project.name_with_namespace, namespace_project_path(project.namespace, project)

        %ul.content-list.todos-list
          = render group[1]
    = paginate @todos, theme: "gitlab"
  - else
    .nothing-here-block You're all done!

:javascript
  new UsersSelect();

  $('form.filter-form').on('submit', function (event) {
    event.preventDefault();
    Turbolinks.visit(this.action + '&' + $(this).serialize());
  });