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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
6e328d55
Commit
6e328d55
authored
Sep 23, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7793 from cirosantilli/replace-javascript
Replace javascript:; links with buttons.
parents
e5fb2ad9
778afb69
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
app/assets/stylesheets/sections/notes.scss
app/assets/stylesheets/sections/notes.scss
+1
-0
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+4
-4
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+1
-4
features/steps/shared/diff_note.rb
features/steps/shared/diff_note.rb
+2
-2
spec/features/notes_on_merge_requests_spec.rb
spec/features/notes_on_merge_requests_spec.rb
+10
-5
No files found.
app/assets/stylesheets/sections/notes.scss
View file @
6e328d55
...
@@ -145,6 +145,7 @@ ul.notes {
...
@@ -145,6 +145,7 @@ ul.notes {
.diff-file
tr
.line_holder
{
.diff-file
tr
.line_holder
{
.add-diff-note
{
.add-diff-note
{
background
:
image-url
(
"diff_note_add.png"
)
no-repeat
left
0
;
background
:
image-url
(
"diff_note_add.png"
)
no-repeat
left
0
;
border
:
none
;
height
:
22px
;
height
:
22px
;
margin-left
:
-65px
;
margin-left
:
-65px
;
position
:
absolute
;
position
:
absolute
;
...
...
app/helpers/notes_helper.rb
View file @
6e328d55
...
@@ -52,8 +52,8 @@ module NotesHelper
...
@@ -52,8 +52,8 @@ module NotesHelper
discussion_id:
discussion_id
discussion_id:
discussion_id
}
}
link_to
""
,
"javascript:;"
,
class:
"add-diff-note js-add-diff-note-button"
,
button_tag
''
,
class:
'btn add-diff-note js-add-diff-note-button'
,
data:
data
,
title:
"Add a comment to this line"
data:
data
,
title:
'Add a comment to this line'
end
end
def
link_to_reply_diff
(
note
)
def
link_to_reply_diff
(
note
)
...
@@ -67,8 +67,8 @@ module NotesHelper
...
@@ -67,8 +67,8 @@ module NotesHelper
discussion_id:
note
.
discussion_id
discussion_id:
note
.
discussion_id
}
}
link_to
"javascript:;"
,
class:
"btn reply-btn js-discussion-reply-button"
,
button_tag
class:
'btn reply-btn js-discussion-reply-button'
,
data:
data
,
title:
"Add a reply"
do
data:
data
,
title:
'Add a reply'
do
link_text
=
content_tag
(
:i
,
nil
,
class:
'icon-comment'
)
link_text
=
content_tag
(
:i
,
nil
,
class:
'icon-comment'
)
link_text
<<
' Reply'
link_text
<<
' Reply'
end
end
...
...
features/steps/project/merge_requests.rb
View file @
6e328d55
...
@@ -4,6 +4,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -4,6 +4,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include
SharedNote
include
SharedNote
include
SharedPaths
include
SharedPaths
include
SharedMarkdown
include
SharedMarkdown
include
SharedDiffNote
step
'I click link "New Merge Request"'
do
step
'I click link "New Merge Request"'
do
click_link
"New Merge Request"
click_link
"New Merge Request"
...
@@ -292,8 +293,4 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -292,8 +293,4 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
def
have_visible_content
(
text
)
def
have_visible_content
(
text
)
have_css
(
"*"
,
text:
text
,
visible:
true
)
have_css
(
"*"
,
text:
text
,
visible:
true
)
end
end
def
click_diff_line
(
code
)
find
(
"a[data-line-code='
#{
code
}
']"
).
click
end
end
end
features/steps/shared/diff_note.rb
View file @
6e328d55
...
@@ -103,7 +103,7 @@ module SharedDiffNote
...
@@ -103,7 +103,7 @@ module SharedDiffNote
step
'I should see a discussion reply button'
do
step
'I should see a discussion reply button'
do
within
(
diff_file_selector
)
do
within
(
diff_file_selector
)
do
page
.
should
have_
link
(
"Reply"
)
page
.
should
have_
button
(
'Reply'
)
end
end
end
end
...
@@ -160,6 +160,6 @@ module SharedDiffNote
...
@@ -160,6 +160,6 @@ module SharedDiffNote
end
end
def
click_diff_line
(
code
)
def
click_diff_line
(
code
)
find
(
"
a
[data-line-code='
#{
code
}
']"
).
click
find
(
"
button
[data-line-code='
#{
code
}
']"
).
click
end
end
end
end
spec/features/notes_on_merge_requests_spec.rb
View file @
6e328d55
...
@@ -133,7 +133,7 @@ describe 'Comments' do
...
@@ -133,7 +133,7 @@ describe 'Comments' do
describe
"when adding a note"
do
describe
"when adding a note"
do
before
do
before
do
find
(
"a[data-line-code=
\"
#{
line_code
}
\"
]"
).
click
click_diff_line
end
end
describe
"the notes holder"
do
describe
"the notes holder"
do
...
@@ -144,7 +144,7 @@ describe 'Comments' do
...
@@ -144,7 +144,7 @@ describe 'Comments' do
describe
"the note form"
do
describe
"the note form"
do
it
"shouldn't add a second form for same row"
do
it
"shouldn't add a second form for same row"
do
find
(
"a[data-line-code=
\"
#{
line_code
}
\"
]"
).
click
click_diff_line
should
have_css
(
"tr[id='
#{
line_code
}
'] + .js-temp-notes-holder form"
,
count:
1
)
should
have_css
(
"tr[id='
#{
line_code
}
'] + .js-temp-notes-holder form"
,
count:
1
)
end
end
...
@@ -161,8 +161,8 @@ describe 'Comments' do
...
@@ -161,8 +161,8 @@ describe 'Comments' do
describe
"with muliple note forms"
do
describe
"with muliple note forms"
do
before
do
before
do
find
(
"a[data-line-code=
\"
#{
line_code
}
\"
]"
).
click
click_diff_line
find
(
"a[data-line-code=
\"
#{
line_code_2
}
\"
]"
).
click
click_diff_line
(
line_code_2
)
end
end
it
{
should
have_css
(
".js-temp-notes-holder"
,
count:
2
)
}
it
{
should
have_css
(
".js-temp-notes-holder"
,
count:
2
)
}
...
@@ -193,7 +193,7 @@ describe 'Comments' do
...
@@ -193,7 +193,7 @@ describe 'Comments' do
should
have_content
(
"Another comment on line 10"
)
should
have_content
(
"Another comment on line 10"
)
should
have_css
(
".notes_holder"
)
should
have_css
(
".notes_holder"
)
should
have_css
(
".notes_holder .note"
,
count:
1
)
should
have_css
(
".notes_holder .note"
,
count:
1
)
should
have_
link
(
"Reply"
)
should
have_
button
(
'Reply'
)
end
end
end
end
end
end
...
@@ -206,4 +206,9 @@ describe 'Comments' do
...
@@ -206,4 +206,9 @@ describe 'Comments' do
def
line_code_2
def
line_code_2
sample_compare
.
changes
.
last
[
:line_code
]
sample_compare
.
changes
.
last
[
:line_code
]
end
end
def
click_diff_line
(
data
=
nil
)
data
||=
line_code
find
(
"button[data-line-code=
\"
#{
data
}
\"
]"
).
click
end
end
end
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