summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_sidebar.html.haml
blob: 0f488614cf966bdc6d0816a3084c9ef3b68e857d (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
  .issuable-sidebar
    .block.issuable-sidebar-header
      %span.issuable-count.hide-collapsed.pull-left
        = issuable.iid
        of
        = issuables_count(issuable)
      %a.gutter-toggle.pull-right.js-sidebar-toggle{href: '#'}
        = sidebar_gutter_toggle_icon
      .issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'}
        - if prev_issuable = prev_issuable_for(issuable)
          = link_to 'Prev', [@project.namespace.becomes(Namespace), @project, prev_issuable], class: 'btn btn-default prev-btn'
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Prev
        - if next_issuable = next_issuable_for(issuable)
          = link_to 'Next', [@project.namespace.becomes(Namespace), @project, next_issuable], class: 'btn btn-default next-btn'
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Next

    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
      .block.assignee
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.to_reference if issuable.assignee)}
          - if issuable.assignee
            = link_to_member(@project, issuable.assignee, size: 24)
          - else
            = icon('user')
        .title.hide-collapsed
          Assignee
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
          - if issuable.assignee
            = link_to_member(@project, issuable.assignee, size: 32) do
              - 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')
              %span.username
                = issuable.assignee.to_reference
          - else
            .light None

        .selectbox.hide-collapsed
          = users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true, current_user: true, first_user: true)

      .block.milestone
        .sidebar-collapsed-icon
          = icon('clock-o')
          %span
            - if issuable.milestone
              = issuable.milestone.title
            - else
              No
        .title.hide-collapsed
          Milestone
          =icon('spinner spin', class: 'block-loading')
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
          - if issuable.milestone
            = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
              = issuable.milestone.title
          - else
            .light None

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

      - if issuable.project.labels.any?
        .block.labels
          .sidebar-collapsed-icon
            = icon('tags')
            %span
              = issuable.labels.count
          .title.hide-collapsed
            Labels
            =icon('spinner spin', class: 'block-loading')
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
              = link_to 'Edit', '#', class: 'edit-link pull-right'
          .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels.any?) }
            - if issuable.labels.any?
              - issuable.labels.each do |label|
                = link_to_label(label, type: issuable.to_ability_name)
            - else
              .light None
          .selectbox.hide-collapsed
            - issuable.labels.each do |label|
              = hidden_field_tag 'issue[label_names][]', label.id, id: nil
            .dropdown
              %button.dropdown-menu-toggle.js-label-select.js-multiselect{type: "button", data: {toggle: "dropdown", field_name: "issue[label_names][]", show_no: "true", show_any: "true", selected: issuable.label_names.join(","), project_id: (@project.id if @project), issue_update: namespace_project_issue_path(@project.namespace, @project, issuable.id, :json), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}}
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
                .dropdown-page-one
                  = dropdown_title("Filter by label")
                  = dropdown_filter("Search labels")
                  = dropdown_content
                  - if @project
                    = dropdown_footer do
                      %ul.dropdown-footer-list
                        - if can? current_user, :admin_label, @project
                          %li
                            %a.dropdown-toggle-page{href: "#"}
                              Create new
                        %li
                          = link_to namespace_project_labels_path(@project.namespace, @project) do
                            - if can? current_user, :admin_label, @project
                              Manage labels
                            - else
                              View labels

      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
          .sidebar-collapsed-icon
            = icon('rss')
          .title.hide-collapsed
            Notifications
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
          %button.btn.btn-block.btn-gray.subscribe-button.hide-collapsed{:type => 'button'}
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
            .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)
      .block.project-reference
        .sidebar-collapsed-icon
          = clipboard_button(clipboard_text: project_ref)
        .cross-project-reference.hide-collapsed
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)

    :javascript
      new MilestoneSelect();
      new LabelsSelect();
      new IssuableContext();