Commit b7f0b22b authored by Phil Hughes's avatar Phil Hughes

Started refactoring of note form

parent 3dd91f55
...@@ -251,14 +251,9 @@ class @Notes ...@@ -251,14 +251,9 @@ class @Notes
Sets some hidden fields in the form. Sets some hidden fields in the form.
### ###
setupMainTargetNoteForm: -> setupMainTargetNoteForm: ->
# find the form # find the form
form = $(".js-new-note-form") form = $(".js-new-note-form")
# insert the form after the button
form.clone().replaceAll $(".js-main-target-form")
form = form.prev("form")
# show the form # show the form
@setupNoteForm(form) @setupNoteForm(form)
...@@ -266,10 +261,6 @@ class @Notes ...@@ -266,10 +261,6 @@ class @Notes
form.removeClass "js-new-note-form" form.removeClass "js-new-note-form"
form.addClass "js-main-target-form" form.addClass "js-main-target-form"
# remove unnecessary fields and buttons
form.find("#note_line_code").remove()
form.find(".js-close-discussion-note-form").remove()
### ###
General note form setup. General note form setup.
......
...@@ -125,13 +125,6 @@ p.time { ...@@ -125,13 +125,6 @@ p.time {
height: 150px; height: 150px;
} }
// Fixes alignment on notes.
.new_note {
label {
text-align: left;
}
}
// Fix issue with notes & lists creating a bunch of bottom borders. // Fix issue with notes & lists creating a bunch of bottom borders.
li.note { li.note {
img { max-width: 100% } img { max-width: 100% }
......
...@@ -17,16 +17,17 @@ ...@@ -17,16 +17,17 @@
} }
.diff-file, .diff-file,
.discussion { .discussion {
.new_note { .new-note {
margin: 0; margin: 0;
border: none; border: none;
} }
} }
.new_note {
.new-note {
display: none; display: none;
} }
.new_note, .note-edit-form { .new-note, .note-edit-form {
.note-form-actions { .note-form-actions {
margin-top: $gl-padding; margin-top: $gl-padding;
} }
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
= f.text_area attr, class: classes = f.text_area attr, class: classes
- else - else
= text_area_tag attr, nil, class: classes = text_area_tag attr, nil, class: classes
%a.js-zen-enter(tabindex="-1" href="#") %a.js-zen-enter{ tabindex: "-1", href: "#" }
= icon('expand') Go full screen
Edit in fullscreen %a.js-zen-leave{ tabindex: "-1", href: "#" }
%a.js-zen-leave(tabindex="-1" href="#")
= icon('compress') = icon('compress')
= 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 gfm-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 gfm-form" }, authenticity_token: true do |f|
= hidden_field_tag :view, diff_view = hidden_field_tag :view, diff_view
= hidden_field_tag :line_type = hidden_field_tag :line_type
= note_target_fields(@note) = note_target_fields(@note)
......
%ul#notes-list.notes.main-notes-list.timeline %ul#notes-list.notes.main-notes-list.timeline
= render "projects/notes/notes" = render "projects/notes/notes"
.js-notes-busy %li.timeline-entry
.timeline-icon
.js-main-target-form - if can? current_user, :create_note, @project
- if can? current_user, :create_note, @project %a.author_link{ href: user_path(current_user) }
= render "projects/notes/form", view: diff_view = image_tag avatar_icon(current_user), alt: current_user.to_reference, class: 'avatar s40'
- else .timeline-content
.disabled-comment-area .js-main-target-form
.disabled-profile - if can? current_user, :create_note, @project
.disabled-comment = render "projects/notes/form", view: diff_view
%span - else
Please .disabled-comment-area
= link_to "register",new_user_session_path .disabled-profile
or .disabled-comment
= link_to "login",new_user_session_path %span
to post a comment Please
= link_to "register",new_user_session_path
or
= link_to "login",new_user_session_path
to post a comment
:javascript :javascript
var notes = new Notes("#{namespace_project_notes_path(namespace_id: @project.namespace, target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}") var notes = new Notes("#{namespace_project_notes_path(namespace_id: @project.namespace, target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment