Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0581df29
Commit
0581df29
authored
Mar 30, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Discussion form
parent
f0d2f370
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
17 deletions
+27
-17
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+9
-4
app/assets/stylesheets/pages/note_form.scss
app/assets/stylesheets/pages/note_form.scss
+5
-0
app/views/projects/notes/_notes_with_form.html.haml
app/views/projects/notes/_notes_with_form.html.haml
+13
-13
No files found.
app/assets/javascripts/notes.js.coffee
View file @
0581df29
...
@@ -254,6 +254,9 @@ class @Notes
...
@@ -254,6 +254,9 @@ class @Notes
# find the form
# find the form
form
=
$
(
".js-new-note-form"
)
form
=
$
(
".js-new-note-form"
)
# Set a global clone of the form for later cloning
@
formClone
=
form
.
clone
()
# show the form
# show the form
@
setupNoteForm
(
form
)
@
setupNoteForm
(
form
)
...
@@ -452,15 +455,15 @@ class @Notes
...
@@ -452,15 +455,15 @@ class @Notes
Shows the note form below the notes.
Shows the note form below the notes.
###
###
replyToDiscussionNote
:
(
e
)
=>
replyToDiscussionNote
:
(
e
)
=>
form
=
$
(
".js-new-note-form"
)
form
=
@
formClone
.
clone
(
)
replyLink
=
$
(
e
.
target
).
closest
(
".js-discussion-reply-button"
)
replyLink
=
$
(
e
.
target
).
closest
(
".js-discussion-reply-button"
)
replyLink
.
hide
()
replyLink
.
hide
()
# insert the form after the button
# insert the form after the button
form
.
clone
().
insertAfter
replyLink
replyLink
.
after
form
# show the form
# show the form
@
setupDiscussionNoteForm
(
replyLink
,
replyLink
.
next
(
"form"
)
)
@
setupDiscussionNoteForm
(
replyLink
,
form
)
###
###
Shows the diff or discussion form and does some setup on it.
Shows the diff or discussion form and does some setup on it.
...
@@ -485,7 +488,9 @@ class @Notes
...
@@ -485,7 +488,9 @@ class @Notes
.
text
(
form
.
find
(
'.js-close-discussion-note-form'
).
data
(
'cancel-text'
))
.
text
(
form
.
find
(
'.js-close-discussion-note-form'
).
data
(
'cancel-text'
))
@
setupNoteForm
form
@
setupNoteForm
form
form
.
find
(
".js-note-text"
).
focus
()
form
.
find
(
".js-note-text"
).
focus
()
form
.
addClass
"js-discussion-note-form"
form
.
removeClass
(
'js-main-target-form'
)
.
addClass
(
"discussion-form js-discussion-note-form"
)
###
###
Called when clicking on the "add a comment" button on the side of a diff line.
Called when clicking on the "add a comment" button on the side of a diff line.
...
...
app/assets/stylesheets/pages/note_form.scss
View file @
0581df29
...
@@ -73,6 +73,11 @@
...
@@ -73,6 +73,11 @@
}
}
}
}
.discussion-form
{
padding
:
$gl-padding-top
$gl-padding
;
background-color
:
#fff
;
}
.note-edit-form
{
.note-edit-form
{
display
:
none
;
display
:
none
;
font-size
:
15px
;
font-size
:
15px
;
...
...
app/views/projects/notes/_notes_with_form.html.haml
View file @
0581df29
%ul
#notes-list
.notes.main-notes-list.timeline
%ul
#notes-list
.notes.main-notes-list.timeline
=
render
"projects/notes/notes"
=
render
"projects/notes/notes"
%ul
.notes.timeline
%li
.timeline-entry
%li
.timeline-entry
.timeline-icon.hidden-xs.hidden-sm
.timeline-icon.hidden-xs.hidden-sm
-
if
can?
current_user
,
:create_note
,
@project
-
if
can?
current_user
,
:create_note
,
@project
%a
.author_link
{
href:
user_path
(
current_user
)
}
%a
.author_link
{
href:
user_path
(
current_user
)
}
=
image_tag
avatar_icon
(
current_user
),
alt:
current_user
.
to_reference
,
class:
'avatar s40'
=
image_tag
avatar_icon
(
current_user
),
alt:
current_user
.
to_reference
,
class:
'avatar s40'
.timeline-content.timeline-content-form
.timeline-content.timeline-content-form
.js-main-target-form
-
if
can?
current_user
,
:create_note
,
@project
-
if
can?
current_user
,
:create_note
,
@project
=
render
"projects/notes/form"
,
view:
diff_view
=
render
"projects/notes/form"
,
view:
diff_view
-
else
-
else
.disabled-comment-area
.disabled-comment-area
.disabled-profile
.disabled-profile
.disabled-comment
.disabled-comment
%span
%span
Please
Please
=
link_to
"register"
,
new_user_session_path
=
link_to
"register"
,
new_user_session_path
or
or
=
link_to
"login"
,
new_user_session_path
=
link_to
"login"
,
new_user_session_path
to post a comment
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
}
"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment