BigW Consortium Gitlab

_sidebar.html.haml 9.95 KB
Newer Older
Phil Hughes committed
1
- todo = issuable_todo(issuable)
2
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
3
  .issuable-sidebar
4
    - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
Phil Hughes committed
5
    .block.issuable-sidebar-header
6 7 8
      - if current_user
        %span.issuable-header-text.hide-collapsed.pull-left
          Todo
9
      %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", aria: { label: "Toggle sidebar" } }
Phil Hughes committed
10
        = sidebar_gutter_toggle_icon
11
      - if current_user
Phil Hughes committed
12
        %button.btn.btn-default.issuable-header-btn.pull-right.js-issuable-todo{ type: "button", aria: { label: (todo.nil? ? "Add Todo" : "Mark Done") }, data: { todo_text: "Add Todo", mark_text: "Mark Done", issuable_id: issuable.id, issuable_type: issuable.class.name.underscore, url: namespace_project_todos_path(@project.namespace, @project), delete_path: (dashboard_todo_path(todo) if todo) } }
Phil Hughes committed
13
          %span.js-issuable-todo-text
Phil Hughes committed
14
            - if todo
15
              Mark Done
Phil Hughes committed
16 17
            - else
              Add Todo
18
          = icon('spin spinner', class: 'hidden js-issuable-todo-loading')
19

20
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
21
      .block.assignee
22
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.name if issuable.assignee)}
23
          - if issuable.assignee
24
            = link_to_member(@project, issuable.assignee, size: 24)
25 26
          - else
            = icon('user')
27
        .title.hide-collapsed
Phil Hughes committed
28
          Assignee
29
          = icon('spinner spin', class: 'block-loading')
30
          - if can_edit_issuable
Phil Hughes committed
31
            = link_to 'Edit', '#', class: 'edit-link pull-right'
32
        .value.hide-collapsed
33
          - if issuable.assignee
34
            = link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do
35 36 37
              - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
                %span.pull-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: 'Not allowed to merge' }
                  = icon('exclamation-triangle')
Phil Hughes committed
38 39
              %span.username
                = issuable.assignee.to_reference
40
          - else
41
            %span.assign-yourself.no-value
42
              No assignee
43
              - if can_edit_issuable
44
                \-
45
                %a.js-assign-yourself{ href: '#' }
46
                  assign yourself
47

48
        .selectbox.hide-collapsed
49
          = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
50
          = dropdown_tag('Select assignee', options: { toggle_class: 'js-user-search js-author-search', title: 'Assign to', filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author', placeholder: 'Search users', data: { first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), author_id: issuable.author_id, field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } })
51

52
      .block.milestone
53
        .sidebar-collapsed-icon
54
          = icon('clock-o')
55 56
          %span
            - if issuable.milestone
57
              %span.has-tooltip{title: milestone_remaining_days(issuable.milestone), data: {container: 'body', html: 1, placement: 'left'}}
58
                = issuable.milestone.title
59
            - else
Rémy Coutable committed
60
              None
61
        .title.hide-collapsed
Phil Hughes committed
62
          Milestone
63
          = icon('spinner spin', class: 'block-loading')
64
          - if can_edit_issuable
Phil Hughes committed
65
            = link_to 'Edit', '#', class: 'edit-link pull-right'
66
        .value.hide-collapsed
67
          - if issuable.milestone
68
            = link_to issuable.milestone.title, namespace_project_milestone_path(@project.namespace, @project, issuable.milestone), class: "bold has-tooltip", title: milestone_remaining_days(issuable.milestone), data: { container: "body", html: 1 }
69
          - else
70
            %span.no-value None
71

72
        .selectbox.hide-collapsed
73
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
74
          = dropdown_tag('Milestone', options: { title: 'Assign milestone', toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: 'Search milestones', data: { show_no: true, field_name: "#{issuable.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true }})
75

Rémy Coutable committed
76
      - if issuable.has_attribute?(:due_date)
77 78 79
        .block.due_date
          .sidebar-collapsed-icon
            = icon('calendar')
Phil Hughes committed
80
            %span.js-due-date-sidebar-value
Rémy Coutable committed
81
              = issuable.due_date.try(:to_s, :medium) || 'None'
82
          .title.hide-collapsed
Rémy Coutable committed
83
            Due date
84
            = icon('spinner spin', class: 'block-loading')
85
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
86
              = link_to 'Edit', '#', class: 'edit-link pull-right'
87
          .value.hide-collapsed
88 89
            %span.value-content
              - if issuable.due_date
90
                %span.bold= issuable.due_date.to_s(:medium)
91
              - else
92
                %span.no-value No due date
93
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
94
              %span.no-value.js-remove-due-date-holder{ class: ("hidden" if issuable.due_date.nil?) }
95 96 97
                \-
                %a.js-remove-due-date{ href: "#", role: "button" }
                  remove due date
98 99
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            .selectbox.hide-collapsed
Rémy Coutable committed
100
              = f.hidden_field :due_date, value: issuable.due_date
101
              .dropdown
Rémy Coutable committed
102 103 104
                %button.dropdown-menu-toggle.js-due-date-select{ type: 'button', data: { toggle: 'dropdown', field_name: "#{issuable.to_ability_name}[due_date]", ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable) } }
                  %span.dropdown-toggle-text Due date
                  = icon('chevron-down')
105
                .dropdown-menu.dropdown-menu-due-date
Rémy Coutable committed
106
                  = dropdown_title('Due date')
107 108
                  = dropdown_content do
                    .js-due-date-calendar
109

110
      - if issuable.project.labels.any?
111
        .block.labels
112 113
          .sidebar-collapsed-icon
            = icon('tags')
114
            %span
115
              = issuable.labels_array.size
116
          .title.hide-collapsed
Phil Hughes committed
117
            Labels
118
            = icon('spinner spin', class: 'block-loading')
119
            - if can_edit_issuable
Phil Hughes committed
120
              = link_to 'Edit', '#', class: 'edit-link pull-right'
121 122 123
          .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels_array.any?) }
            - if issuable.labels_array.any?
              - issuable.labels_array.each do |label|
124
                = link_to_label(label, type: issuable.to_ability_name)
125
            - else
126
              %span.no-value None
127
          .selectbox.hide-collapsed
128
            - issuable.labels_array.each do |label|
Alfredo Sumaran committed
129
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
130
            .dropdown
131
              %button.dropdown-menu-toggle.js-label-select.js-multiselect{type: "button", data: {toggle: "dropdown", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", project_id: (@project.id if @project), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}}
132 133 134 135
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
136
                = render partial: "shared/issuable/label_page_default"
137
                - if can? current_user, :admin_label, @project and @project
138
                  = render partial: "shared/issuable/label_page_create"
139

140 141 142
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
143
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
144 145
          .sidebar-collapsed-icon
            = icon('rss')
146
          .title.hide-collapsed
Phil Hughes committed
147
            Notifications
148
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
149
          %button.btn.btn-block.btn-default.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
150
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
151
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
152 153 154 155 156 157
            .unsubscribed{class: ( 'hidden' if subscribed )}
              You're not receiving notifications from this thread.
            .subscribed{class: ( 'hidden' unless subscribed )}
              You're receiving notifications because you're subscribed to this thread.

      - project_ref = cross_project_reference(@project, issuable)
158
      .block.project-reference
159
        .sidebar-collapsed-icon
160
          = clipboard_button(clipboard_text: project_ref)
161
        .cross-project-reference.hide-collapsed
162 163 164 165 166
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
167

168
    :javascript
169
      new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
170
      new LabelsSelect();
171
      new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
172
      new Subscription('.subscription')
173
      new DueDateSelect();
174
      sidebar = new Sidebar();