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
49780c02
Commit
49780c02
authored
Dec 03, 2020
by
Marcel van Remmerden
Committed by
Miguel Rincon
Dec 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix segmented control in file header for markdown files
parent
7516adb5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
+10
-5
app/assets/javascripts/blob/viewer/index.js
app/assets/javascripts/blob/viewer/index.js
+3
-3
app/views/projects/blob/_viewer_switcher.html.haml
app/views/projects/blob/_viewer_switcher.html.haml
+1
-1
changelogs/unreleased/290597-segmented-control-in-file-header-for-markdown-files-does-not-have-.yml
...trol-in-file-header-for-markdown-files-does-not-have-.yml
+5
-0
spec/frontend/blob/viewer/index_spec.js
spec/frontend/blob/viewer/index_spec.js
+1
-1
No files found.
app/assets/javascripts/blob/viewer/index.js
View file @
49780c02
...
...
@@ -132,16 +132,16 @@ export default class BlobViewer {
const
newViewer
=
this
.
$fileHolder
[
0
].
querySelector
(
`.blob-viewer[data-type='
${
name
}
']`
);
if
(
this
.
activeViewer
===
newViewer
)
return
;
const
oldButton
=
document
.
querySelector
(
'
.js-blob-viewer-switch-btn.
active
'
);
const
oldButton
=
document
.
querySelector
(
'
.js-blob-viewer-switch-btn.
selected
'
);
const
newButton
=
document
.
querySelector
(
`.js-blob-viewer-switch-btn[data-viewer='
${
name
}
']`
);
const
oldViewer
=
this
.
$fileHolder
[
0
].
querySelector
(
`.blob-viewer:not([data-type='
${
name
}
'])`
);
if
(
oldButton
)
{
oldButton
.
classList
.
remove
(
'
active
'
);
oldButton
.
classList
.
remove
(
'
selected
'
);
}
if
(
newButton
)
{
newButton
.
classList
.
add
(
'
active
'
);
newButton
.
classList
.
add
(
'
selected
'
);
newButton
.
blur
();
}
...
...
app/views/projects/blob/_viewer_switcher.html.haml
View file @
49780c02
...
...
@@ -8,5 +8,5 @@
=
sprite_icon
(
simple_viewer
.
switcher_icon
)
-
rich_label
=
"Display
#{
rich_viewer
.
switcher_title
}
"
%button
.btn.gl-button.btn-default.btn-sm.js-blob-viewer-switch-btn.has-tooltip
{
'aria-label'
=>
rich_label
,
title:
rich_label
,
data:
{
viewer:
'rich'
,
container:
'body'
}
}
>
%button
.btn.gl-button.btn-default.btn-sm.js-blob-viewer-switch-btn.
gl-mr-3.
has-tooltip
{
'aria-label'
=>
rich_label
,
title:
rich_label
,
data:
{
viewer:
'rich'
,
container:
'body'
}
}
>
=
sprite_icon
(
rich_viewer
.
switcher_icon
)
changelogs/unreleased/290597-segmented-control-in-file-header-for-markdown-files-does-not-have-.yml
0 → 100644
View file @
49780c02
---
title
:
Fix margin and selected state in file header
merge_request
:
49059
author
:
type
:
fixed
spec/frontend/blob/viewer/index_spec.js
View file @
49780c02
...
...
@@ -154,7 +154,7 @@ describe('Blob viewer', () => {
blob
.
switchToViewer
(
'
simple
'
);
expect
(
simpleBtn
.
classList
.
contains
(
'
active
'
)).
toBeTruthy
();
expect
(
simpleBtn
.
classList
.
contains
(
'
selected
'
)).
toBeTruthy
();
expect
(
simpleBtn
.
blur
).
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