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
eb578529
Commit
eb578529
authored
Nov 29, 2021
by
Jacques
Committed by
Jacques Erasmus
Dec 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PDF Viewer when vewing a PDF blob
Created a PDF blob viewer
parent
bef5540c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
app/assets/javascripts/repository/components/blob_viewers/index.js
...s/javascripts/repository/components/blob_viewers/index.js
+5
-0
app/assets/javascripts/repository/components/blob_viewers/pdf_viewer.vue
...scripts/repository/components/blob_viewers/pdf_viewer.vue
+16
-0
spec/frontend/repository/components/blob_viewers/pdf_viewer_spec.js
...end/repository/components/blob_viewers/pdf_viewer_spec.js
+22
-0
No files found.
app/assets/javascripts/repository/components/blob_viewers/index.js
View file @
eb578529
...
...
@@ -12,6 +12,8 @@ export const loadViewer = (type) => {
return
()
=>
import
(
/* webpackChunkName: 'blob_image_viewer' */
'
./image_viewer.vue
'
);
case
'
video
'
:
return
()
=>
import
(
/* webpackChunkName: 'blob_video_viewer' */
'
./video_viewer.vue
'
);
case
'
pdf
'
:
return
()
=>
import
(
/* webpackChunkName: 'blob_pdf_viewer' */
'
./pdf_viewer.vue
'
);
default
:
return
null
;
}
...
...
@@ -36,5 +38,8 @@ export const viewerProps = (type, blob) => {
video
:
{
url
:
blob
.
rawPath
,
},
pdf
:
{
url
:
blob
.
rawPath
,
},
}[
type
];
};
app/assets/javascripts/repository/components/blob_viewers/pdf_viewer.vue
0 → 100644
View file @
eb578529
<
script
>
import
PdfViewer
from
'
~/blob/pdf/pdf_viewer.vue
'
;
export
default
{
components
:
{
PdfViewer
},
props
:
{
url
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<pdf-viewer
:pdf=
"url"
/>
</
template
>
spec/frontend/repository/components/blob_viewers/pdf_viewer_spec.js
0 → 100644
View file @
eb578529
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Component
from
'
~/repository/components/blob_viewers/pdf_viewer.vue
'
;
import
PdfViewer
from
'
~/blob/pdf/pdf_viewer.vue
'
;
describe
(
'
PDF Viewer
'
,
()
=>
{
let
wrapper
;
const
propsData
=
{
url
:
'
some/pdf_blob.pdf
'
};
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
Component
,
{
propsData
});
};
const
findPDFViewer
=
()
=>
wrapper
.
findComponent
(
PdfViewer
);
it
(
'
renders a PDF Viewer component
'
,
()
=>
{
createComponent
();
expect
(
findPDFViewer
().
exists
()).
toBe
(
true
);
expect
(
findPDFViewer
().
props
(
'
pdf
'
)).
toBe
(
propsData
.
url
);
});
});
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