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
Boxiang Sun
gitlab-ce
Commits
d2482f15
Commit
d2482f15
authored
Mar 31, 2018
by
Fabian Schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix template selector menu visibility
parent
dd552d06
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
app/assets/javascripts/blob/file_template_mediator.js
app/assets/javascripts/blob/file_template_mediator.js
+1
-1
app/assets/javascripts/blob/file_template_selector.js
app/assets/javascripts/blob/file_template_selector.js
+4
-0
changelogs/unreleased/32617-fix-template-selector-menu-visibility.yml
...nreleased/32617-fix-template-selector-menu-visibility.yml
+6
-0
spec/features/projects/files/template_selector_menu_spec.rb
spec/features/projects/files/template_selector_menu_spec.rb
+66
-0
No files found.
app/assets/javascripts/blob/file_template_mediator.js
View file @
d2482f15
...
@@ -94,7 +94,7 @@ export default class FileTemplateMediator {
...
@@ -94,7 +94,7 @@ export default class FileTemplateMediator {
const
hash
=
urlPieces
[
1
];
const
hash
=
urlPieces
[
1
];
if
(
hash
===
'
preview
'
)
{
if
(
hash
===
'
preview
'
)
{
this
.
hideTemplateSelectorMenu
();
this
.
hideTemplateSelectorMenu
();
}
else
if
(
hash
===
'
editor
'
)
{
}
else
if
(
hash
===
'
editor
'
&&
!
this
.
typeSelector
.
isHidden
()
)
{
this
.
showTemplateSelectorMenu
();
this
.
showTemplateSelectorMenu
();
}
}
});
});
...
...
app/assets/javascripts/blob/file_template_selector.js
View file @
d2482f15
...
@@ -32,6 +32,10 @@ export default class FileTemplateSelector {
...
@@ -32,6 +32,10 @@ export default class FileTemplateSelector {
}
}
}
}
isHidden
()
{
return
this
.
$wrapper
.
hasClass
(
'
hidden
'
);
}
getToggleText
()
{
getToggleText
()
{
return
this
.
$dropdownToggleText
.
text
();
return
this
.
$dropdownToggleText
.
text
();
}
}
...
...
changelogs/unreleased/32617-fix-template-selector-menu-visibility.yml
0 → 100644
View file @
d2482f15
---
title
:
Fix template selector menu visibility when toggling preview mode in file edit
view
merge_request
:
18118
author
:
Fabian Schneider
type
:
fixed
spec/features/projects/files/template_selector_menu_spec.rb
0 → 100644
View file @
d2482f15
require
'spec_helper'
feature
'Template selector menu'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
user
end
context
'editing a non-matching file'
do
before
do
create_and_edit_file
(
'README.md'
)
end
scenario
'is not displayed'
do
check_template_selector_menu_display
(
false
)
end
context
'user toggles preview'
do
before
do
click_link
'Preview'
end
scenario
'template selector menu is not displayed'
do
check_template_selector_menu_display
(
false
)
click_link
'Write'
check_template_selector_menu_display
(
false
)
end
end
end
context
'editing a matching file'
do
before
do
visit
project_edit_blob_path
(
project
,
File
.
join
(
project
.
default_branch
,
'LICENSE'
))
end
scenario
'is displayed'
do
check_template_selector_menu_display
(
true
)
end
context
'user toggles preview'
do
before
do
click_link
'Preview'
end
scenario
'template selector menu is hidden and shown correctly'
do
check_template_selector_menu_display
(
false
)
click_link
'Write'
check_template_selector_menu_display
(
true
)
end
end
end
end
def
check_template_selector_menu_display
(
is_visible
)
count
=
is_visible
?
1
:
0
expect
(
page
).
to
have_css
(
'.template-selectors-menu'
,
count:
count
)
end
def
create_and_edit_file
(
file_name
)
visit
project_new_blob_path
(
project
,
'master'
,
file_name:
file_name
)
click_button
"Commit changes"
visit
project_edit_blob_path
(
project
,
File
.
join
(
project
.
default_branch
,
file_name
))
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