_sidebar.html.haml 8.3 KB
Newer Older
1
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
J
Jacob Schatz 已提交
2
  .issuable-sidebar
P
Phil Hughes 已提交
3
    .block.issuable-sidebar-header
4
      %span.issuable-count.hide-collapsed.pull-left
5
        = issuable.iid
6
        of
7
        = issuables_count(issuable)
P
Phil Hughes 已提交
8 9
      %a.gutter-toggle.pull-right.js-sidebar-toggle{href: '#'}
        = sidebar_gutter_toggle_icon
10
      .issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'}
11 12
        - if prev_issuable = prev_issuable_for(issuable)
          = link_to 'Prev', [@project.namespace.becomes(Namespace), @project, prev_issuable], class: 'btn btn-default prev-btn'
13 14 15
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Prev
16 17
        - if next_issuable = next_issuable_for(issuable)
          = link_to 'Next', [@project.namespace.becomes(Namespace), @project, next_issuable], class: 'btn btn-default next-btn'
18 19 20
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Next
21

22
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
J
Jacob Schatz 已提交
23
      .block.assignee
P
Phil Hughes 已提交
24
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.to_reference if issuable.assignee)}
J
Jacob Schatz 已提交
25
          - if issuable.assignee
26
            = link_to_member(@project, issuable.assignee, size: 24)
J
Jacob Schatz 已提交
27 28
          - else
            = icon('user')
29
        .title.hide-collapsed
P
Phil Hughes 已提交
30
          Assignee
J
Jacob Schatz 已提交
31
          = icon('spinner spin', class: 'block-loading')
J
Jacob Schatz 已提交
32
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
33 34
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
35
          - if issuable.assignee
P
Phil Hughes 已提交
36
            = link_to_member(@project, issuable.assignee, size: 32) do
37 38 39
              - 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')
P
Phil Hughes 已提交
40 41
              %span.username
                = issuable.assignee.to_reference
J
Jacob Schatz 已提交
42
          - else
P
Phil Hughes 已提交
43
            %span.assign-yourself
44
              No assignee -
J
Jacob Schatz 已提交
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'
J
Jacob Schatz 已提交
50
          = dropdown_tag('Select assignee', options: { toggle_class: 'js-user-search js-author-search', title: 'Assign user', 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), field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } })
51

J
Jacob Schatz 已提交
52
      .block.milestone
J
Jacob Schatz 已提交
53
        .sidebar-collapsed-icon
J
Jacob Schatz 已提交
54
          = icon('clock-o')
J
Jacob Schatz 已提交
55 56 57 58 59
          %span
            - if issuable.milestone
              = issuable.milestone.title
            - else
              No
60
        .title.hide-collapsed
P
Phil Hughes 已提交
61
          Milestone
J
Jacob Schatz 已提交
62
          = icon('spinner spin', class: 'block-loading')
63
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
64 65
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
66
          - if issuable.milestone
P
Phil Hughes 已提交
67 68
            = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
              = issuable.milestone.title
69
          - else
70
            .light None
71

72
        .selectbox.hide-collapsed
73
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
J
Jacob Schatz 已提交
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

J
Jacob Schatz 已提交
76
      - if issuable.project.labels.any?
J
Jacob Schatz 已提交
77
        .block.labels
78 79
          .sidebar-collapsed-icon
            = icon('tags')
J
Jacob Schatz 已提交
80 81
            %span
              = issuable.labels.count
82
          .title.hide-collapsed
P
Phil Hughes 已提交
83
            Labels
J
Jacob Schatz 已提交
84
            = icon('spinner spin', class: 'block-loading')
J
Jacob Schatz 已提交
85
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
86
              = link_to 'Edit', '#', class: 'edit-link pull-right'
P
Phil Hughes 已提交
87
          .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels.any?) }
J
Jacob Schatz 已提交
88 89
            - if issuable.labels.any?
              - issuable.labels.each do |label|
90
                = link_to_label(label, type: issuable.to_ability_name)
J
Jacob Schatz 已提交
91 92
            - else
              .light None
93
          .selectbox.hide-collapsed
94
            - issuable.labels.each do |label|
A
Alfredo Sumaran 已提交
95
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
96
            .dropdown
J
Jacob Schatz 已提交
97
              %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", selected: issuable.label_names.join(","), project_id: (@project.id if @project), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}}
98 99 100 101 102
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
                .dropdown-page-one
J
Jacob Schatz 已提交
103
                  = dropdown_title("Assign labels")
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
                  = 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
119

J
Jacob Schatz 已提交
120 121 122
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
123
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
124 125
          .sidebar-collapsed-icon
            = icon('rss')
126
          .title.hide-collapsed
P
Phil Hughes 已提交
127
            Notifications
J
Jacob Schatz 已提交
128
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
129
          %button.btn.btn-block.btn-gray.subscribe-button.hide-collapsed{:type => 'button'}
J
Jacob Schatz 已提交
130
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
131
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
J
Jacob Schatz 已提交
132 133 134 135 136 137
            .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)
J
Jacob Schatz 已提交
138
      .block.project-reference
139
        .sidebar-collapsed-icon
140
          = clipboard_button(clipboard_text: project_ref)
141
        .cross-project-reference.hide-collapsed
J
Jacob Schatz 已提交
142 143 144 145 146
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
147

J
Jacob Schatz 已提交
148
    :javascript
J
Jacob Schatz 已提交
149
      new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
150
      new LabelsSelect();
151
      new IssuableContext('#{current_user.to_json(only: [:username, :id, :name])}');
P
Phil Hughes 已提交
152
      new Subscription('.subscription')