diff options
author | Phil Hughes <me@iamphill.com> | 2016-07-29 13:19:56 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-07-29 13:19:56 +0300 |
commit | efb74875cfe1a1e2b3696f0129b819fc8e204876 (patch) | |
tree | 53bc2e8a9e45f6c31dcc729bf4646532c1e6b41a /app/views/projects/notes | |
parent | d9a949c17c29c8531b2b0a1c227ab0b3341f0ba3 (diff) |
Moved most of the data handling into discussion & notes models
Reduced some duplicated code with compiling components
Fixed bug with resolve button tooltip not updating after resolving discussion
Diffstat (limited to 'app/views/projects/notes')
-rw-r--r-- | app/views/projects/notes/_form.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/notes/_note.html.haml | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 032aeec70fd..b915d0133f9 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -1,11 +1,10 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @note], remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new-note js-new-note-form js-quick-submit common-note-form" }, authenticity_token: true do |f| += form_for [@project.namespace.becomes(Namespace), @project, @note], remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new-note js-new-note-form js-quick-submit common-note-form", "data-noteable-iid" => @note.noteable.try(:iid), }, authenticity_token: true do |f| = hidden_field_tag :view, diff_view = hidden_field_tag :line_type = note_target_fields(@note) = f.hidden_field :commit_id = f.hidden_field :line_code = f.hidden_field :noteable_id - = hidden_field_tag :noteable_iid, @note.noteable.try(:iid) = f.hidden_field :noteable_type = f.hidden_field :type = f.hidden_field :position diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 69b770b62b7..c708bd46387 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -22,7 +22,7 @@ - if access %span.note-role.hidden-xs= access - - if note.resolvable? + - if (note.resolvable? && can?(current_user, :resolve_note, note)) || (note.resolved? && !can?(current_user, :resolve_note, note)) %resolve-btn{ ":namespace-path" => "'#{note.project.namespace.path}'", ":project-path" => "'#{note.project.path}'", ":discussion-id" => "'#{note.discussion_id}'", @@ -36,7 +36,7 @@ .note-action-button = icon("spin spinner", "v-show" => "loading") %button.line-resolve-btn{ type: "button", - class: ("is-disabled" if !can?(current_user, :resolve_note, note)), + class: ("is-disabled" unless can?(current_user, :resolve_note, note)), ":class" => "{ 'is-active': isResolved }", ":aria-label" => "buttonText", "@click" => "resolve", |