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
415b032b
Commit
415b032b
authored
Jun 15, 2016
by
Fatih Acet
Committed by
Jacob Schatz
Jun 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent default disabled buttons and links.
parent
93a496d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
0 deletions
+41
-0
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+1
-0
app/assets/javascripts/lib/common_utils.js.coffee
app/assets/javascripts/lib/common_utils.js.coffee
+7
-0
spec/javascripts/application_spec.js.coffee
spec/javascripts/application_spec.js.coffee
+30
-0
spec/javascripts/fixtures/application.html.haml
spec/javascripts/fixtures/application.html.haml
+2
-0
No files found.
CHANGELOG
View file @
415b032b
...
...
@@ -77,6 +77,7 @@ v 8.9.0 (unreleased)
- RepositoryCheck::SingleRepositoryWorker public and private methods are now instrumented
- Improve issuables APIs performance when accessing notes !4471
- External links now open in a new tab
- Prevent default actions of disabled buttons and links
- Markdown editor now correctly resets the input value on edit cancellation !4175
- Toggling a task list item in a issue/mr description does not creates a Todo for mentions
- Improved UX of date pickers on issue & milestone forms
...
...
app/assets/javascripts/application.js.coffee
View file @
415b032b
...
...
@@ -125,6 +125,7 @@ window.onload = ->
setTimeout
shiftWindow
,
100
$
->
gl
.
utils
.
preventDisabledButtons
()
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
$
(
".nicescroll"
).
niceScroll
(
cursoropacitymax
:
'0.4'
,
cursorcolor
:
'#FFF'
,
cursorborder
:
"1px solid #FFF"
)
...
...
app/assets/javascripts/lib/common_utils.js.coffee
View file @
415b032b
...
...
@@ -32,5 +32,12 @@
.
attr
'title'
,
newTitle
.
tooltip
'fixTitle'
gl
.
utils
.
preventDisabledButtons
=
->
$
(
'.btn'
).
click
(
e
)
->
if
$
(
this
).
hasClass
'disabled'
e
.
preventDefault
()
e
.
stopImmediatePropagation
()
return
false
)
window
spec/javascripts/application_spec.js.coffee
0 → 100644
View file @
415b032b
#= require lib/common_utils
describe
'Application'
,
->
describe
'disable buttons'
,
->
fixture
.
preload
(
'application.html'
)
beforeEach
->
fixture
.
load
(
'application.html'
)
it
'should prevent default action for disabled buttons'
,
->
gl
.
utils
.
preventDisabledButtons
()
isClicked
=
false
$button
=
$
'#test-button'
$button
.
click
->
isClicked
=
true
$button
.
trigger
'click'
expect
(
isClicked
).
toBe
false
it
'should be on the same page if a disabled link clicked'
,
->
locationBeforeLinkClick
=
window
.
location
.
href
gl
.
utils
.
preventDisabledButtons
()
$
(
'#test-link'
).
click
()
expect
(
window
.
location
.
href
).
toBe
locationBeforeLinkClick
spec/javascripts/fixtures/application.html.haml
0 → 100644
View file @
415b032b
%a
#test-link
.btn.disabled
{
:href
=>
"/foo"
}
Test link
%button
#test-button
.btn.disabled
Test Button
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