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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4258589d
Commit
4258589d
authored
Apr 05, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'note-form-design' into 'master'
Notes form design update Part of #3401 See merge request !3442
parents
b8d0f174
4d9d06ec
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
254 additions
and
266 deletions
+254
-266
app/assets/javascripts/issue.js.coffee
app/assets/javascripts/issue.js.coffee
+0
-15
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+0
-16
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+20
-18
app/assets/javascripts/zen_mode.js.coffee
app/assets/javascripts/zen_mode.js.coffee
+1
-1
app/assets/stylesheets/framework/common.scss
app/assets/stylesheets/framework/common.scss
+0
-7
app/assets/stylesheets/framework/markdown_area.scss
app/assets/stylesheets/framework/markdown_area.scss
+21
-13
app/assets/stylesheets/framework/typography.scss
app/assets/stylesheets/framework/typography.scss
+1
-1
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+6
-0
app/assets/stylesheets/framework/zen.scss
app/assets/stylesheets/framework/zen.scss
+51
-50
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+0
-36
app/assets/stylesheets/pages/note_form.scss
app/assets/stylesheets/pages/note_form.scss
+75
-52
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+25
-1
app/views/projects/_md_preview.html.haml
app/views/projects/_md_preview.html.haml
+9
-8
app/views/projects/_zen.html.haml
app/views/projects/_zen.html.haml
+8
-12
app/views/projects/notes/_edit_form.html.haml
app/views/projects/notes/_edit_form.html.haml
+4
-3
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+2
-2
app/views/projects/notes/_hints.html.haml
app/views/projects/notes/_hints.html.haml
+7
-8
app/views/projects/notes/_notes_with_form.html.haml
app/views/projects/notes/_notes_with_form.html.haml
+16
-15
features/steps/shared/diff_note.rb
features/steps/shared/diff_note.rb
+2
-2
features/steps/shared/note.rb
features/steps/shared/note.rb
+2
-2
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+1
-1
spec/features/notes_on_merge_requests_spec.rb
spec/features/notes_on_merge_requests_spec.rb
+2
-2
spec/javascripts/fixtures/zen_mode.html.haml
spec/javascripts/fixtures/zen_mode.html.haml
+1
-1
No files found.
app/assets/javascripts/issue.js.coffee
View file @
4258589d
...
@@ -6,25 +6,10 @@ class @Issue
...
@@ -6,25 +6,10 @@ class @Issue
constructor
:
->
constructor
:
->
# Prevent duplicate event bindings
# Prevent duplicate event bindings
@
disableTaskList
()
@
disableTaskList
()
@
fixAffixScroll
()
if
$
(
'a.btn-close'
).
length
if
$
(
'a.btn-close'
).
length
@
initTaskList
()
@
initTaskList
()
@
initIssueBtnEventListeners
()
@
initIssueBtnEventListeners
()
fixAffixScroll
:
->
fixAffix
=
->
$discussion
=
$
(
'.issuable-discussion'
)
$sidebar
=
$
(
'.issuable-sidebar'
)
if
$sidebar
.
hasClass
(
'no-affix'
)
$sidebar
.
removeClass
([
'affix-top'
,
'affix'
])
discussionHeight
=
$discussion
.
height
()
sidebarHeight
=
$sidebar
.
height
()
if
sidebarHeight
>
discussionHeight
$discussion
.
height
(
sidebarHeight
+
50
)
$sidebar
.
addClass
(
'no-affix'
)
$
(
window
).
on
(
'resize'
,
fixAffix
)
fixAffix
()
initTaskList
:
->
initTaskList
:
->
$
(
'.detail-page-description .js-task-list-container'
).
taskList
(
'enable'
)
$
(
'.detail-page-description .js-task-list-container'
).
taskList
(
'enable'
)
$
(
document
).
on
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
,
@
updateTaskList
$
(
document
).
on
'tasklist:changed'
,
'.detail-page-description .js-task-list-container'
,
@
updateTaskList
...
...
app/assets/javascripts/merge_request.js.coffee
View file @
4258589d
...
@@ -15,8 +15,6 @@ class @MergeRequest
...
@@ -15,8 +15,6 @@ class @MergeRequest
this
.
$
(
'.show-all-commits'
).
on
'click'
,
=>
this
.
$
(
'.show-all-commits'
).
on
'click'
,
=>
this
.
showAllCommits
()
this
.
showAllCommits
()
@
fixAffixScroll
();
@
initTabs
()
@
initTabs
()
# Prevent duplicate event bindings
# Prevent duplicate event bindings
...
@@ -30,20 +28,6 @@ class @MergeRequest
...
@@ -30,20 +28,6 @@ class @MergeRequest
$
:
(
selector
)
->
$
:
(
selector
)
->
this
.
$el
.
find
(
selector
)
this
.
$el
.
find
(
selector
)
fixAffixScroll
:
->
fixAffix
=
->
$discussion
=
$
(
'.issuable-discussion'
)
$sidebar
=
$
(
'.issuable-sidebar'
)
if
$sidebar
.
hasClass
(
'no-affix'
)
$sidebar
.
removeClass
([
'affix-top'
,
'affix'
])
discussionHeight
=
$discussion
.
height
()
sidebarHeight
=
$sidebar
.
height
()
if
sidebarHeight
>
discussionHeight
$discussion
.
height
(
sidebarHeight
+
50
)
$sidebar
.
addClass
(
'no-affix'
)
$
(
window
).
on
(
'resize'
,
fixAffix
)
fixAffix
()
initTabs
:
->
initTabs
:
->
if
@
opts
.
action
!=
'new'
if
@
opts
.
action
!=
'new'
# `MergeRequests#new` has no tab-persisting or lazy-loading behavior
# `MergeRequests#new` has no tab-persisting or lazy-loading behavior
...
...
app/assets/javascripts/notes.js.coffee
View file @
4258589d
...
@@ -251,13 +251,11 @@ class @Notes
...
@@ -251,13 +251,11 @@ 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
# Set a global clone of the form for later cloning
form
.
clone
().
replaceAll
$
(
".js-main-target-form"
)
@
formClone
=
form
.
clone
()
form
=
form
.
prev
(
"form"
)
# show the form
# show the form
@
setupNoteForm
(
form
)
@
setupNoteForm
(
form
)
...
@@ -266,9 +264,7 @@ class @Notes
...
@@ -266,9 +264,7 @@ 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
(
"#note_line_code"
).
remove
()
form
.
find
(
".js-close-discussion-note-form"
).
remove
()
###
###
General note form setup.
General note form setup.
...
@@ -297,7 +293,14 @@ class @Notes
...
@@ -297,7 +293,14 @@ class @Notes
else
else
previewButton
.
removeClass
(
"turn-on"
).
addClass
"turn-off"
previewButton
.
removeClass
(
"turn-on"
).
addClass
"turn-off"
textarea
.
on
'focus'
,
->
$
(
this
).
closest
(
'.md-area'
).
addClass
'is-focused'
textarea
.
on
'blur'
,
->
$
(
this
).
closest
(
'.md-area'
).
removeClass
'is-focused'
autosize
(
textarea
)
autosize
(
textarea
)
new
Autosave
textarea
,
[
new
Autosave
textarea
,
[
"Note"
"Note"
form
.
find
(
"#note_commit_id"
).
val
()
form
.
find
(
"#note_commit_id"
).
val
()
...
@@ -307,7 +310,6 @@ class @Notes
...
@@ -307,7 +310,6 @@ class @Notes
]
]
# remove notify commit author checkbox for non-commit notes
# remove notify commit author checkbox for non-commit notes
form
.
find
(
".js-notify-commit-author"
).
remove
()
if
form
.
find
(
"#note_noteable_type"
).
val
()
isnt
"Commit"
GitLab
.
GfmAutoComplete
.
setup
()
GitLab
.
GfmAutoComplete
.
setup
()
new
DropzoneInput
(
form
)
new
DropzoneInput
(
form
)
form
.
show
()
form
.
show
()
...
@@ -455,15 +457,15 @@ class @Notes
...
@@ -455,15 +457,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.
...
@@ -488,7 +490,9 @@ class @Notes
...
@@ -488,7 +490,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.
...
@@ -498,9 +502,8 @@ class @Notes
...
@@ -498,9 +502,8 @@ class @Notes
###
###
addDiffNote
:
(
e
)
=>
addDiffNote
:
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
link
=
e
.
currentTarget
$link
=
$
(
e
.
currentTarget
)
form
=
$
(
".js-new-note-form"
)
row
=
$link
.
closest
(
"tr"
)
row
=
$
(
link
).
closest
(
"tr"
)
nextRow
=
row
.
next
()
nextRow
=
row
.
next
()
hasNotes
=
nextRow
.
is
(
".notes_holder"
)
hasNotes
=
nextRow
.
is
(
".notes_holder"
)
addForm
=
false
addForm
=
false
...
@@ -509,7 +512,7 @@ class @Notes
...
@@ -509,7 +512,7 @@ class @Notes
# In parallel view, look inside the correct left/right pane
# In parallel view, look inside the correct left/right pane
if
@
isParallelView
()
if
@
isParallelView
()
lineType
=
$
(
link
)
.
data
(
"lineType"
)
lineType
=
$
link
.
data
(
"lineType"
)
targetContent
+=
"."
+
lineType
targetContent
+=
"."
+
lineType
rowCssToAdd
=
"<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel old
\"
></td><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel new
\"
></td></tr>"
rowCssToAdd
=
"<tr class=
\"
notes_holder js-temp-notes-holder
\"
><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel old
\"
></td><td class=
\"
notes_line
\"
></td><td class=
\"
notes_content parallel new
\"
></td></tr>"
...
@@ -531,11 +534,11 @@ class @Notes
...
@@ -531,11 +534,11 @@ class @Notes
addForm
=
true
addForm
=
true
if
addForm
if
addForm
newForm
=
form
.
clone
()
newForm
=
@
formClone
.
clone
()
newForm
.
appendTo
row
.
next
().
find
(
targetContent
)
newForm
.
appendTo
row
.
next
().
find
(
targetContent
)
# show the form
# show the form
@
setupDiscussionNoteForm
$
(
link
)
,
newForm
@
setupDiscussionNoteForm
$
link
,
newForm
###
###
Called in response to "cancel" on a diff note form.
Called in response to "cancel" on a diff note form.
...
@@ -560,7 +563,6 @@ class @Notes
...
@@ -560,7 +563,6 @@ class @Notes
cancelDiscussionForm
:
(
e
)
=>
cancelDiscussionForm
:
(
e
)
=>
e
.
preventDefault
()
e
.
preventDefault
()
form
=
$
(
".js-new-note-form"
)
form
=
$
(
e
.
target
).
closest
(
".js-discussion-note-form"
)
form
=
$
(
e
.
target
).
closest
(
".js-discussion-note-form"
)
@
removeDiscussionNoteForm
(
form
)
@
removeDiscussionNoteForm
(
form
)
...
...
app/assets/javascripts/zen_mode.js.coffee
View file @
4258589d
...
@@ -42,7 +42,7 @@ class @ZenMode
...
@@ -42,7 +42,7 @@ class @ZenMode
$
(
e
.
currentTarget
).
trigger
(
'zen_mode:leave'
)
$
(
e
.
currentTarget
).
trigger
(
'zen_mode:leave'
)
$
(
document
).
on
'zen_mode:enter'
,
(
e
)
=>
$
(
document
).
on
'zen_mode:enter'
,
(
e
)
=>
@
enter
(
e
.
target
.
parentNode
)
@
enter
(
$
(
e
.
target
).
closest
(
'.md-area'
).
find
(
'.zen-backdrop'
)
)
$
(
document
).
on
'zen_mode:leave'
,
(
e
)
=>
$
(
document
).
on
'zen_mode:leave'
,
(
e
)
=>
@
exit
()
@
exit
()
...
...
app/assets/stylesheets/framework/common.scss
View file @
4258589d
...
@@ -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%
}
...
...
app/assets/stylesheets/framework/markdown_area.scss
View file @
4258589d
.div-dropzone-wrapper
{
.div-dropzone-wrapper
{
.div-dropzone
{
.div-dropzone
{
position
:
relative
;
position
:
relative
;
padding
:
0
;
margin-bottom
:
-5px
;
border
:
0
;
margin-bottom
:
5px
;
.div-dropzone-focus
{
.div-dropzone-focus
{
border-color
:
#66afe9
!
important
;
border-color
:
#66afe9
!
important
;
...
@@ -25,12 +23,10 @@
...
@@ -25,12 +23,10 @@
.div-dropzone-spinner
{
.div-dropzone-spinner
{
position
:
absolute
;
position
:
absolute
;
top
:
100%
;
bottom
:
10px
;
left
:
100%
;
right
:
5px
;
margin-top
:
-1
.1em
;
margin-left
:
-1
.1em
;
opacity
:
0
;
opacity
:
0
;
font-size
:
3
0px
;
font-size
:
2
0px
;
transition
:
opacity
200ms
ease-in-out
;
transition
:
opacity
200ms
ease-in-out
;
}
}
...
@@ -65,17 +61,29 @@
...
@@ -65,17 +61,29 @@
position
:
relative
;
position
:
relative
;
}
}
.md-header
{
.nav-links
{
.active
{
a
{
border-bottom-color
:
#000
;
}
}
a
{
padding-top
:
0
;
line-height
:
1
;
}
}
}
.referenced-users
{
.referenced-users
{
color
:
#4c4e54
;
color
:
#4c4e54
;
padding-top
:
10px
;
padding-top
:
10px
;
}
}
.md-preview-holder
{
.md-preview-holder
{
background
:
#fff
;
min-height
:
167px
;
border
:
1px
solid
#ddd
;
padding
:
10px
0
;
min-height
:
169px
;
padding
:
5px
;
box-shadow
:
none
;
}
}
.markdown-area
{
.markdown-area
{
...
...
app/assets/stylesheets/framework/typography.scss
View file @
4258589d
...
@@ -250,7 +250,7 @@ a > code {
...
@@ -250,7 +250,7 @@ a > code {
* Textareas intended for GFM
* Textareas intended for GFM
*
*
*/
*/
textarea
.js-gfm-input
{
.js-gfm-input
{
font-family
:
$monospace_font
;
font-family
:
$monospace_font
;
color
:
$gl-text-color
;
color
:
$gl-text-color
;
}
}
...
...
app/assets/stylesheets/framework/variables.scss
View file @
4258589d
...
@@ -217,3 +217,9 @@ $notes-light-color: #8e8e8e;
...
@@ -217,3 +217,9 @@ $notes-light-color: #8e8e8e;
$notes-action-color
:
#c3c3c3
;
$notes-action-color
:
#c3c3c3
;
$notes-role-color
:
#8e8e8e
;
$notes-role-color
:
#8e8e8e
;
$notes-role-border-color
:
#e4e4e4
;
$notes-role-border-color
:
#e4e4e4
;
$note-disabled-comment-color
:
#b2b2b2
;
$note-form-border-color
:
#e5e5e5
;
$note-toolbar-color
:
#959494
;
$zen-control-hover-color
:
#111
;
app/assets/stylesheets/framework/zen.scss
View file @
4258589d
.zen
nable
{
.zen
-backdrop
{
a
.js-zen-enter
{
&
.fullscreen
{
color
:
$gl-gray
;
background-color
:
white
;
position
:
absolute
;
position
:
fixed
;
top
:
0
;
top
:
0
;
right
:
4px
;
bottom
:
0
;
line-height
:
56px
;
left
:
0
;
}
right
:
0
;
z-index
:
1031
;
a
.js-zen-leave
{
textarea
{
display
:
none
;
border
:
none
;
color
:
$gl-text-color
;
box-shadow
:
none
;
position
:
absolute
;
border-radius
:
0
;
top
:
10px
;
color
:
#000
;
right
:
10px
;
font-size
:
20px
;
padding
:
5px
;
line-height
:
26px
;
font-size
:
36px
;
padding
:
30px
;
display
:
block
;
outline
:
none
;
resize
:
none
;
height
:
100vh
;
max-width
:
900px
;
margin
:
0
auto
;
}
&
:hover
{
.zen-control-leave
{
color
:
#111
;
display
:
block
;
position
:
absolute
;
top
:
0
;
}
}
}
}
}
.zen-backdrop
{
.zen-cotrol
{
&
.fullscreen
{
padding
:
0
;
background-color
:
white
;
color
:
#555
;
position
:
fixed
;
background
:
none
;
top
:
0
;
border
:
0
;
bottom
:
0
;
}
left
:
0
;
right
:
0
;
z-index
:
1031
;
textarea
{
.zen-control-full
{
border
:
none
;
color
:
$note-toolbar-color
;
box-shadow
:
none
;
border-radius
:
0
;
color
:
#000
;
font-size
:
20px
;
line-height
:
26px
;
padding
:
30px
;
display
:
block
;
outline
:
none
;
resize
:
none
;
height
:
100vh
;
max-width
:
900px
;
margin
:
0
auto
;
}
a
.js-zen-enter
{
&
:hover
{
display
:
none
;
color
:
$gl-link-color
;
}
text-decoration
:
none
;
}
}
a
.js-zen-leave
{
.zen-control-leave
{
display
:
block
;
display
:
none
;
position
:
absolute
;
color
:
$gl-text-color
;
top
:
0
;
position
:
absolute
;
}
right
:
10px
;
}
padding
:
5px
;
font-size
:
36px
;
&
:hover
{
color
:
$zen-control-hover-color
;
}
}
}
}
app/assets/stylesheets/pages/merge_requests.scss
View file @
4258589d
...
@@ -195,42 +195,6 @@
...
@@ -195,42 +195,6 @@
line-height
:
31px
;
line-height
:
31px
;
}
}
.disabled-comment-area
{
padding
:
16px
0
;
.disabled-profile
{
width
:
40px
;
height
:
40px
;
background
:
$border-gray-dark
;
border-radius
:
20px
;
display
:
inline-block
;
margin-right
:
10px
;
}
.disabled-comment
{
background
:
$gray-light
;
display
:
inline-block
;
vertical-align
:
top
;
height
:
200px
;
border-radius
:
4px
;
border
:
1px
solid
$border-gray-normal
;
padding-top
:
90px
;
text-align
:
center
;
right
:
20px
;
position
:
absolute
;
left
:
70px
;
margin-bottom
:
20px
;
span
{
color
:
#b2b2b2
;
a
{
color
:
$md-link-color
;
}
}
}
}
.builds
{
.builds
{
.table-holder
{
.table-holder
{
overflow-x
:
scroll
;
overflow-x
:
scroll
;
...
...
app/assets/stylesheets/pages/note_form.scss
View file @
4258589d
/**
/**
* Note Form
* Note Form
*/
*/
.comment-btn
{
@extend
.btn-create
;
}
.reply-btn
{
.reply-btn
{
@extend
.btn-primary
;
@extend
.btn-primary
;
margin
:
10px
$gl-padding
;
margin
:
10px
$gl-padding
;
...
@@ -17,16 +13,17 @@
...
@@ -17,16 +13,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
;
}
}
...
@@ -40,21 +37,18 @@
...
@@ -40,21 +37,18 @@
img
{
img
{
max-width
:
100%
;
max-width
:
100%
;
}
}
}
.note_text
{
.note-textarea
{
width
:
100%
;
padding
:
10px
0
;
}
font-family
:
$regular_font
;
border
:
0
;
.comment-hint
s
{
&
:focu
s
{
margin-top
:
-12px
;
outline
:
0
;
}
}
}
}
/* loading indicator */
.notes-busy
{
margin
:
18px
;
}
.note-image-attach
{
.note-image-attach
{
@extend
.col-md-4
;
@extend
.col-md-4
;
margin-left
:
45px
;
margin-left
:
45px
;
...
@@ -62,38 +56,29 @@
...
@@ -62,38 +56,29 @@
}
}
.common-note-form
{
.common-note-form
{
margin
:
0
;
.md-area
{
background
:
#fff
;
padding
:
$gl-padding-top
$gl-padding
;
padding
:
$gl-padding
;
border
:
1px
solid
$note-form-border-color
;
margin-left
:
-
$gl-padding
;
border-radius
:
$border-radius-base
;
margin-right
:
-
$gl-padding
;
margin-bottom
:
-
$gl-padding
;
&
.is-focused
{
}
border-color
:
$focus-border-color
;
box-shadow
:
0
0
2px
rgba
(
#000
,
.2
)
,
.note-form-actions
{
0
0
4px
rgba
(
$focus-border-color
,
.4
);
.note-form-option
{
margin-top
:
8px
;
.comment-toolbar
,
margin-left
:
30px
;
.nav-links
{
@extend
.pull-left
;
border-color
:
$focus-border-color
;
}
}
.js-notify-commit-author
{
float
:
left
;
}
.write-preview-btn
{
// makes the "absolute" position for links relative to this
position
:
relative
;
// preview/edit buttons
>
a
{
position
:
absolute
;
right
:
5px
;
top
:
8px
;
}
}
}
}
}
}
.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
;
...
@@ -152,11 +137,49 @@
...
@@ -152,11 +137,49 @@
}
}
}
}
.comment-hints
{
.comment-toolbar
{
color
:
#999
;
padding-top
:
$gl-padding-top
;
background
:
#fff
;
color
:
$note-toolbar-color
;
padding
:
7px
;
border-top
:
1px
solid
$border-color
;
margin-top
:
-7px
;
}
border
:
1px
solid
$border-color
;
font-size
:
13px
;
.toolbar-button
{
padding
:
0
;
background
:
none
;
border
:
0
;
font-size
:
14px
;
line-height
:
16px
;
&
:hover
,
&
:focus
{
color
:
$gl-link-color
;
outline
:
0
;
}
@media
(
min-width
:
$screen-md-min
)
{
float
:
left
;
margin-right
:
$gl-padding
;
&
:last-child
{
float
:
right
;
margin-right
:
0
;
}
}
}
.toolbar-button-icon
{
position
:
relative
;
top
:
1px
;
margin-right
:
3px
;
color
:
inherit
;
font-size
:
16px
;
}
.toolbar-text
{
font-size
:
14px
;
line-height
:
16px
;
@media
(
min-width
:
$screen-md-min
)
{
float
:
left
;
}
}
}
app/assets/stylesheets/pages/notes.scss
View file @
4258589d
...
@@ -20,6 +20,12 @@ ul.notes {
...
@@ -20,6 +20,12 @@ ul.notes {
.timeline-content
{
.timeline-content
{
margin-left
:
55px
;
margin-left
:
55px
;
&
.timeline-content-form
{
@media
(
max-width
:
$screen-sm-max
)
{
margin-left
:
0
;
}
}
}
}
.note-created-ago
,
.note-updated-at
{
.note-created-ago
,
.note-updated-at
{
...
@@ -149,7 +155,7 @@ ul.notes {
...
@@ -149,7 +155,7 @@ ul.notes {
&
.notes_content
{
&
.notes_content
{
background-color
:
#fff
;
background-color
:
#fff
;
border-width
:
1px
0
;
border-width
:
1px
0
;
padding
-top
:
0
;
padding
:
0
;
vertical-align
:
top
;
vertical-align
:
top
;
&
.parallel
{
&
.parallel
{
border-width
:
1px
;
border-width
:
1px
;
...
@@ -281,3 +287,21 @@ ul.notes {
...
@@ -281,3 +287,21 @@ ul.notes {
}
}
}
}
}
}
.disabled-comment
{
margin-left
:
-
$gl-padding-top
;
margin-right
:
-
$gl-padding-top
;
background-color
:
$gray-light
;
border-radius
:
$border-radius-base
;
border
:
1px
solid
$border-gray-normal
;
color
:
$note-disabled-comment-color
;
line-height
:
200px
;
.disabled-comment-text
{
line-height
:
normal
;
}
a
{
color
:
$gl-link-color
;
}
}
app/views/projects/_md_preview.html.haml
View file @
4258589d
.md-area
.md-area
.md-header
.clearfix
.md-header
%ul
.nav-links
%ul
.nav-links
%li
.active
%li
.active
%a
.js-md-write-button
(
href=
"#md-write-holder"
tabindex=
"-1"
)
%a
.js-md-write-button
{
href:
"#md-write-holder"
}
Write
Write
%li
%li
%a
.js-md-preview-button
(
href=
"#md-preview-holder"
tabindex=
"-1"
)
%a
.js-md-preview-button
{
href:
"#md-preview-holder"
}
Preview
Preview
%li
.pull-right
%button
.zen-cotrol.zen-control-full.js-zen-enter
{
type:
'button'
}
Go full screen
%div
.md-write-holder
.md-write-holder
=
yield
=
yield
.md.md-preview-holder.js-md-preview.hide
{
class:
(
preview_class
if
defined?
(
preview_class
))}
.md.md-preview-holder.hide
.js-md-preview
{
class:
(
preview_class
if
defined?
(
preview_class
))}
-
if
defined?
(
referenced_users
)
&&
referenced_users
-
if
defined?
(
referenced_users
)
&&
referenced_users
%div
.referenced-users.hide
%div
.referenced-users.hide
...
...
app/views/projects/_zen.html.haml
View file @
4258589d
.zennable
.zen-backdrop
.zen-backdrop
-
classes
<<
' js-gfm-input js-autosize markdown-area'
-
classes
<<
' js-gfm-input js-autosize markdown-area'
-
if
defined?
(
f
)
&&
f
-
if
defined?
(
f
)
&&
f
=
f
.
text_area
attr
,
class:
classes
,
placeholder:
"Write a comment or drag your files here..."
=
f
.
text_area
attr
,
class:
classes
-
else
-
else
=
text_area_tag
attr
,
nil
,
class:
classes
,
placeholder:
"Write a comment or drag your files here..."
=
text_area_tag
attr
,
nil
,
class:
classes
%a
.zen-cotrol.zen-control-leave.js-zen-leave
{
href:
"#"
}
%a
.js-zen-enter
(
tabindex=
"-1"
href=
"#"
)
=
icon
(
'compress'
)
=
icon
(
'expand'
)
Edit in fullscreen
%a
.js-zen-leave
(
tabindex=
"-1"
href=
"#"
)
=
icon
(
'compress'
)
app/views/projects/notes/_edit_form.html.haml
View file @
4258589d
.note-edit-form
.note-edit-form
=
form_for
note
,
url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
method: :put
,
remote:
true
,
authenticity_token:
true
,
html:
{
class:
'edit-note js-quick-submit'
}
do
|
f
|
=
form_for
note
,
url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
method: :put
,
remote:
true
,
authenticity_token:
true
,
html:
{
class:
'edit-note
common-note-form
js-quick-submit'
}
do
|
f
|
=
note_target_fields
(
note
)
=
note_target_fields
(
note
)
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
'md-preview'
}
do
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
'md-preview'
}
do
=
render
'projects/zen'
,
f:
f
,
attr: :note
,
classes:
'note
_text
js-note-text js-task-list-field'
=
render
'projects/zen'
,
f:
f
,
attr: :note
,
classes:
'note
-textarea
js-note-text js-task-list-field'
=
render
'projects/notes/hints'
=
render
'projects/notes/hints'
.note-form-actions.clearfix
.note-form-actions.clearfix
=
f
.
submit
'Save Comment'
,
class:
'btn btn-nr btn-save btn-grouped js-comment-button'
=
f
.
submit
'Save Comment'
,
class:
'btn btn-nr btn-save btn-grouped js-comment-button'
=
link_to
'Cancel'
,
'#'
,
class:
'btn btn-nr btn-cancel note-edit-cancel'
%button
.btn.btn-nr.btn-cancel.note-edit-cancel
{
type:
'button'
}
Cancel
app/views/projects/notes/_form.html.haml
View file @
4258589d
=
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
)
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:noteable_type
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"md-preview"
,
referenced_users:
true
}
do
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"md-preview"
,
referenced_users:
true
}
do
=
render
'projects/zen'
,
f:
f
,
attr: :note
,
classes:
'note
_text
js-note-text'
=
render
'projects/zen'
,
f:
f
,
attr: :note
,
classes:
'note
-textarea
js-note-text'
=
render
'projects/notes/hints'
=
render
'projects/notes/hints'
.error-alert
.error-alert
...
...
app/views/projects/notes/_hints.html.haml
View file @
4258589d
.comment-hints.clearfix
.comment-toolbar.clearfix
.pull-left
.toolbar-text
Styling with
=
link_to
'Markdown'
,
help_page_path
(
'markdown'
,
'markdown'
),
target:
'_blank'
,
tabindex:
-
1
=
link_to
'Markdown'
,
help_page_path
(
'markdown'
,
'markdown'
),
target:
'_blank'
,
tabindex:
-
1
tip:
is supported
=
random_markdown_tip
%button
.toolbar-button.markdown-selector
{
type:
'button'
,
tabindex:
'-1'
}
.pull-right
=
icon
(
'file-image-o'
,
class:
'toolbar-button-icon'
)
=
link_to
'#'
,
class:
'markdown-selector'
,
tabindex:
-
1
do
Attach a file
=
icon
(
'paperclip'
)
Attach a file
app/views/projects/notes/_notes_with_form.html.haml
View file @
4258589d
%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
%ul
.notes.timeline
%li
.timeline-entry
.js-main-target-form
-
if
can?
current_user
,
:create_note
,
@project
-
if
can?
current_user
,
:create_note
,
@project
.timeline-icon.hidden-xs.hidden-sm
=
render
"projects/notes/form"
,
view:
diff_view
%a
.author_link
{
href:
user_path
(
current_user
)
}
-
else
=
image_tag
avatar_icon
(
current_user
),
alt:
current_user
.
to_reference
,
class:
'avatar s40'
.disabled-comment-area
.timeline-content.timeline-content-form
.disabled-profile
=
render
"projects/notes/form"
,
view:
diff_view
.disabled-comment
-
else
%span
.disabled-comment.text-center
Please
.disabled-comment-text.inline
=
link_to
"register"
,
new_user_session_path
Please
or
=
link_to
"register"
,
new_user_session_path
=
link_to
"login"
,
new_user_session_path
or
to post a comment
=
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
}
"
)
features/steps/shared/diff_note.rb
View file @
4258589d
...
@@ -125,7 +125,7 @@ module SharedDiffNote
...
@@ -125,7 +125,7 @@ module SharedDiffNote
step
'I should only see one diff form'
do
step
'I should only see one diff form'
do
page
.
within
(
diff_file_selector
)
do
page
.
within
(
diff_file_selector
)
do
expect
(
page
).
to
have_css
(
"form.new
_
note"
,
count:
1
)
expect
(
page
).
to
have_css
(
"form.new
-
note"
,
count:
1
)
end
end
end
end
...
@@ -161,7 +161,7 @@ module SharedDiffNote
...
@@ -161,7 +161,7 @@ module SharedDiffNote
step
'I should see a temporary diff comment form'
do
step
'I should see a temporary diff comment form'
do
page
.
within
(
diff_file_selector
)
do
page
.
within
(
diff_file_selector
)
do
expect
(
page
).
to
have_css
(
".js-temp-notes-holder form.new
_
note"
)
expect
(
page
).
to
have_css
(
".js-temp-notes-holder form.new
-
note"
)
end
end
end
end
...
...
features/steps/shared/note.rb
View file @
4258589d
...
@@ -2,7 +2,7 @@ module SharedNote
...
@@ -2,7 +2,7 @@ module SharedNote
include
Spinach
::
DSL
include
Spinach
::
DSL
step
'I delete a comment'
do
step
'I delete a comment'
do
page
.
within
(
'.
notes
'
)
do
page
.
within
(
'.
main-notes-list
'
)
do
find
(
'.note'
).
hover
find
(
'.note'
).
hover
find
(
".js-note-delete"
).
click
find
(
".js-note-delete"
).
click
end
end
...
@@ -128,7 +128,7 @@ module SharedNote
...
@@ -128,7 +128,7 @@ module SharedNote
end
end
step
'I edit the last comment with a +1'
do
step
'I edit the last comment with a +1'
do
page
.
within
(
".
notes
"
)
do
page
.
within
(
".
main-notes-list
"
)
do
find
(
".note"
).
hover
find
(
".note"
).
hover
find
(
'.js-note-edit'
).
click
find
(
'.js-note-edit'
).
click
end
end
...
...
spec/features/issues_spec.rb
View file @
4258589d
...
@@ -22,7 +22,7 @@ describe 'Issues', feature: true do
...
@@ -22,7 +22,7 @@ describe 'Issues', feature: true do
before
do
before
do
visit
edit_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
visit
edit_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
click_
link
"Edit
"
click_
button
"Go full screen
"
end
end
it
'should open new issue popup'
do
it
'should open new issue popup'
do
...
...
spec/features/notes_on_merge_requests_spec.rb
View file @
4258589d
...
@@ -152,7 +152,7 @@ describe 'Comments', feature: true do
...
@@ -152,7 +152,7 @@ describe 'Comments', feature: true do
it
'has .new_note css class'
do
it
'has .new_note css class'
do
page
.
within
(
'.js-temp-notes-holder'
)
do
page
.
within
(
'.js-temp-notes-holder'
)
do
expect
(
subject
).
to
have_css
(
'.new
_
note'
)
expect
(
subject
).
to
have_css
(
'.new
-
note'
)
end
end
end
end
end
end
...
@@ -225,6 +225,6 @@ describe 'Comments', feature: true do
...
@@ -225,6 +225,6 @@ describe 'Comments', feature: true do
end
end
def
click_diff_line
(
data
=
line_code
)
def
click_diff_line
(
data
=
line_code
)
page
.
find
(
%Q{button[data-line-code="
#{
data
}
"]}
,
visible:
false
).
click
execute_script
(
"$('button[data-line-code=
\"
#{
data
}
\"
]').click()"
)
end
end
end
end
spec/javascripts/fixtures/zen_mode.html.haml
View file @
4258589d
.
zennable
.
md-area
.zen-backdrop
.zen-backdrop
%textarea
#note_note
.js-gfm-input.markdown-area
%textarea
#note_note
.js-gfm-input.markdown-area
%a
.js-zen-enter
(
tabindex=
"-1"
href=
"#"
)
%a
.js-zen-enter
(
tabindex=
"-1"
href=
"#"
)
...
...
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