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
01574ec5
Commit
01574ec5
authored
Nov 27, 2017
by
Clement Ho
Committed by
Fatih Acet
Nov 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix epic fullscreen editing
parent
af687aa1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
68 deletions
+106
-68
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+3
-0
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+4
-1
app/assets/javascripts/zen_mode.js
app/assets/javascripts/zen_mode.js
+6
-2
changelogs/unreleased-ee/fix-epic-fullscreen.yml
changelogs/unreleased-ee/fix-epic-fullscreen.yml
+5
-0
spec/ee/spec/features/epics/update_epic_spec.rb
spec/ee/spec/features/epics/update_epic_spec.rb
+7
-0
spec/javascripts/zen_mode_spec.js
spec/javascripts/zen_mode_spec.js
+81
-65
No files found.
app/assets/javascripts/dispatcher.js
View file @
01574ec5
...
...
@@ -270,6 +270,9 @@ import initGroupAnalytics from './init_group_analytics';
new
DueDateSelectors
();
new
GLForm
(
$
(
'
.milestone-form
'
),
false
);
break
;
case
'
groups:epics:show
'
:
new
ZenMode
();
break
;
case
'
projects:compare:show
'
:
new
Diff
();
const
paddingTop
=
16
;
...
...
app/assets/javascripts/dropzone_input.js
View file @
01574ec5
...
...
@@ -36,7 +36,10 @@ export default function dropzoneInput(form) {
$formDropzone
.
append
(
divHover
);
$formDropzone
.
find
(
'
.div-dropzone-hover
'
).
append
(
iconPaperclip
);
if
(
!
uploadsPath
)
return
;
if
(
!
uploadsPath
)
{
$formDropzone
.
addClass
(
'
js-invalid-dropzone
'
);
return
;
}
const
dropzone
=
$formDropzone
.
dropzone
({
url
:
uploadsPath
,
...
...
app/assets/javascripts/zen_mode.js
View file @
01574ec5
...
...
@@ -71,7 +71,7 @@ export default class ZenMode {
this
.
active_textarea
=
this
.
active_backdrop
.
find
(
'
textarea
'
);
// Prevent a user-resized textarea from persisting to fullscreen
this
.
active_textarea
.
removeAttr
(
'
style
'
);
return
this
.
active_textarea
.
focus
();
this
.
active_textarea
.
focus
();
}
exit
()
{
...
...
@@ -81,7 +81,11 @@ export default class ZenMode {
this
.
scrollTo
(
this
.
active_textarea
);
this
.
active_textarea
=
null
;
this
.
active_backdrop
=
null
;
return
Dropzone
.
forElement
(
'
.div-dropzone
'
).
enable
();
const
$dropzone
=
$
(
'
.div-dropzone
'
);
if
(
$dropzone
&&
!
$dropzone
.
hasClass
(
'
js-invalid-dropzone
'
))
{
Dropzone
.
forElement
(
'
.div-dropzone
'
).
enable
();
}
}
}
...
...
changelogs/unreleased-ee/fix-epic-fullscreen.yml
0 → 100644
View file @
01574ec5
---
title
:
Fix epic fullscreen editing
merge_request
:
author
:
type
:
fixed
spec/ee/spec/features/epics/update_epic_spec.rb
View file @
01574ec5
...
...
@@ -37,6 +37,13 @@ feature 'Update Epic', :js do
expect
(
find
(
'.issuable-details .description'
)).
to
have_content
(
'New epic description'
)
end
it
'edits full screen'
do
find
(
'.btn-edit'
).
click
find
(
'.js-zen-enter'
).
click
expect
(
page
).
to
have_selector
(
'.div-dropzone-wrapper.fullscreen'
)
end
# File attachment feature is not implemented yet for epics
it
'cannot attach files'
do
find
(
'.btn-edit'
).
click
...
...
spec/javascripts/zen_mode_spec.js
View file @
01574ec5
/* eslint-disable space-before-function-paren, no-var, one-var, one-var-declaration-per-line, object-shorthand, comma-dangle, no-return-assign, new-cap, max-len */
/* global Mousetrap */
import
Dropzone
from
'
dropzone
'
;
import
ZenMode
from
'
~/zen_mode
'
;
(
function
()
{
var
enterZen
,
escapeKeydown
,
exitZen
;
describe
(
'
ZenMode
'
,
function
()
{
var
fixtureName
=
'
merge_requests/merge_request_with_comment.html.raw
'
;
preloadFixtures
(
fixtureName
);
beforeEach
(
function
()
{
loadFixtures
(
fixtureName
);
spyOn
(
Dropzone
,
'
forElement
'
).
and
.
callFake
(
function
()
{
return
{
enable
:
function
()
{
return
true
;
}
};
// Stub Dropzone.forElement(...).enable()
});
this
.
zen
=
new
ZenMode
();
// Set this manually because we can't actually scroll the window
return
this
.
zen
.
scroll_position
=
456
;
describe
(
'
ZenMode
'
,
()
=>
{
let
zen
;
const
fixtureName
=
'
merge_requests/merge_request_with_comment.html.raw
'
;
preloadFixtures
(
fixtureName
);
function
enterZen
()
{
$
(
'
.notes-form .js-zen-enter
'
).
click
();
}
function
exitZen
()
{
$
(
'
.notes-form .js-zen-leave
'
).
click
();
}
function
escapeKeydown
()
{
$
(
'
.notes-form textarea
'
).
trigger
(
$
.
Event
(
'
keydown
'
,
{
keyCode
:
27
,
}));
}
beforeEach
(()
=>
{
loadFixtures
(
fixtureName
);
spyOn
(
Dropzone
,
'
forElement
'
).
and
.
callFake
(()
=>
({
enable
:
()
=>
true
,
}));
zen
=
new
ZenMode
();
// Set this manually because we can't actually scroll the window
zen
.
scroll_position
=
456
;
});
describe
(
'
on enter
'
,
()
=>
{
it
(
'
pauses Mousetrap
'
,
()
=>
{
spyOn
(
Mousetrap
,
'
pause
'
);
enterZen
();
expect
(
Mousetrap
.
pause
).
toHaveBeenCalled
();
});
describe
(
'
on enter
'
,
function
()
{
it
(
'
pauses Mousetrap
'
,
function
()
{
spyOn
(
Mousetrap
,
'
pause
'
);
enterZen
();
return
expect
(
Mousetrap
.
pause
).
toHaveBeenCalled
();
});
return
it
(
'
removes textarea styling
'
,
function
()
{
$
(
'
.notes-form textarea
'
).
attr
(
'
style
'
,
'
height: 400px
'
);
enterZen
();
return
expect
(
$
(
'
.notes-form textarea
'
)).
not
.
toHaveAttr
(
'
style
'
);
});
it
(
'
removes textarea styling
'
,
()
=>
{
$
(
'
.notes-form textarea
'
).
attr
(
'
style
'
,
'
height: 400px
'
);
enterZen
();
expect
(
$
(
'
.notes-form textarea
'
)).
not
.
toHaveAttr
(
'
style
'
);
});
describe
(
'
in use
'
,
function
()
{
beforeEach
(
function
()
{
return
enterZen
();
});
return
it
(
'
exits on Escape
'
,
function
()
{
escapeKeydown
();
return
expect
(
$
(
'
.notes-form .zen-backdrop
'
)).
not
.
toHaveClass
(
'
fullscreen
'
);
});
});
describe
(
'
in use
'
,
()
=>
{
beforeEach
(
enterZen
);
it
(
'
exits on Escape
'
,
()
=>
{
escapeKeydown
();
expect
(
$
(
'
.notes-form .zen-backdrop
'
)).
not
.
toHaveClass
(
'
fullscreen
'
);
});
});
describe
(
'
on exit
'
,
()
=>
{
beforeEach
(
enterZen
);
it
(
'
unpauses Mousetrap
'
,
()
=>
{
spyOn
(
Mousetrap
,
'
unpause
'
);
exitZen
();
expect
(
Mousetrap
.
unpause
).
toHaveBeenCalled
();
});
return
describe
(
'
on exit
'
,
function
()
{
beforeEach
(
function
()
{
return
enterZen
();
});
it
(
'
unpauses Mousetrap
'
,
function
()
{
spyOn
(
Mousetrap
,
'
unpause
'
);
exitZen
();
return
expect
(
Mousetrap
.
unpause
).
toHaveBeenCalled
();
});
return
it
(
'
restores the scroll position
'
,
function
()
{
spyOn
(
this
.
zen
,
'
scrollTo
'
);
exitZen
();
return
expect
(
this
.
zen
.
scrollTo
).
toHaveBeenCalled
();
});
it
(
'
restores the scroll position
'
,
()
=>
{
spyOn
(
zen
,
'
scrollTo
'
);
exitZen
();
expect
(
zen
.
scrollTo
).
toHaveBeenCalled
();
});
});
enterZen
=
function
()
{
return
$
(
'
.notes-form .js-zen-enter
'
).
click
();
};
describe
(
'
enabling dropzone
'
,
()
=>
{
beforeEach
(()
=>
{
enterZen
();
});
exitZen
=
function
()
{
return
$
(
'
.notes-form .js-zen-leave
'
).
click
();
};
it
(
'
should not call dropzone if element is not dropzone valid
'
,
()
=>
{
$
(
'
.div-dropzone
'
).
addClass
(
'
js-invalid-dropzone
'
);
exitZen
();
expect
(
Dropzone
.
forElement
).
not
.
toHaveBeenCalled
();
});
escapeKeydown
=
function
()
{
return
$
(
'
.notes-form textarea
'
).
trigger
(
$
.
Event
(
'
keydown
'
,
{
keyCode
:
27
}));
};
}).
call
(
window
);
it
(
'
should call dropzone if element is dropzone valid
'
,
()
=>
{
$
(
'
.div-dropzone
'
).
removeClass
(
'
js-invalid-dropzone
'
);
exitZen
();
expect
(
Dropzone
.
forElement
).
toHaveBeenCalled
();
});
});
});
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