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
Léo-Paul Géneau
gitlab-ce
Commits
f64a7c47
Commit
f64a7c47
authored
Aug 07, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove repo_binary_viewer as it is no longer needed
parent
ec93e17a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
159 deletions
+0
-159
app/assets/javascripts/repo/components/repo.vue
app/assets/javascripts/repo/components/repo.vue
+0
-3
app/assets/javascripts/repo/components/repo_binary_viewer.vue
...assets/javascripts/repo/components/repo_binary_viewer.vue
+0
-67
spec/javascripts/repo/components/repo_binary_viewer_spec.js
spec/javascripts/repo/components/repo_binary_viewer_spec.js
+0
-89
No files found.
app/assets/javascripts/repo/components/repo.vue
View file @
f64a7c47
...
@@ -3,7 +3,6 @@ import RepoSidebar from './repo_sidebar.vue';
...
@@ -3,7 +3,6 @@ import RepoSidebar from './repo_sidebar.vue';
import
RepoCommitSection
from
'
./repo_commit_section.vue
'
;
import
RepoCommitSection
from
'
./repo_commit_section.vue
'
;
import
RepoTabs
from
'
./repo_tabs.vue
'
;
import
RepoTabs
from
'
./repo_tabs.vue
'
;
import
RepoFileButtons
from
'
./repo_file_buttons.vue
'
;
import
RepoFileButtons
from
'
./repo_file_buttons.vue
'
;
import
RepoBinaryViewer
from
'
./repo_binary_viewer.vue
'
;
import
RepoPreview
from
'
./repo_preview.vue
'
;
import
RepoPreview
from
'
./repo_preview.vue
'
;
import
RepoMixin
from
'
../mixins/repo_mixin
'
;
import
RepoMixin
from
'
../mixins/repo_mixin
'
;
import
PopupDialog
from
'
../../vue_shared/components/popup_dialog.vue
'
;
import
PopupDialog
from
'
../../vue_shared/components/popup_dialog.vue
'
;
...
@@ -18,7 +17,6 @@ export default {
...
@@ -18,7 +17,6 @@ export default {
'
repo-sidebar
'
:
RepoSidebar
,
'
repo-sidebar
'
:
RepoSidebar
,
'
repo-tabs
'
:
RepoTabs
,
'
repo-tabs
'
:
RepoTabs
,
'
repo-file-buttons
'
:
RepoFileButtons
,
'
repo-file-buttons
'
:
RepoFileButtons
,
'
repo-binary-viewer
'
:
RepoBinaryViewer
,
'
repo-editor
'
:
MonacoLoaderHelper
.
repoEditorLoader
,
'
repo-editor
'
:
MonacoLoaderHelper
.
repoEditorLoader
,
'
repo-commit-section
'
:
RepoCommitSection
,
'
repo-commit-section
'
:
RepoCommitSection
,
'
popup-dialog
'
:
PopupDialog
,
'
popup-dialog
'
:
PopupDialog
,
...
@@ -50,7 +48,6 @@ export default {
...
@@ -50,7 +48,6 @@ export default {
<repo-tabs/>
<repo-tabs/>
<component
:is=
"currentBlobView"
class=
"blob-viewer-container"
></component>
<component
:is=
"currentBlobView"
class=
"blob-viewer-container"
></component>
<repo-file-buttons/>
<repo-file-buttons/>
<!--
<repo-binary-viewer/>
soon™ -->
</div>
</div>
<repo-commit-section/>
<repo-commit-section/>
<popup-dialog
<popup-dialog
...
...
app/assets/javascripts/repo/components/repo_binary_viewer.vue
deleted
100644 → 0
View file @
ec93e17a
<
script
>
import
Store
from
'
../stores/repo_store
'
;
import
Helper
from
'
../helpers/repo_helper
'
;
const
RepoBinaryViewer
=
{
data
:
()
=>
Store
,
computed
:
{
pngBlobWithDataURI
()
{
if
(
this
.
binaryTypes
.
png
)
{
return
`data:image/png;base64,
${
this
.
blobRaw
}
`
;
}
return
''
;
},
svgBlobWithDataURI
()
{
if
(
this
.
binaryTypes
.
svg
)
{
return
`data:image/svg+xml;utf8,
${
this
.
blobRaw
}
`
;
}
return
''
;
},
},
methods
:
{
errored
()
{
Store
.
binaryLoaded
=
false
;
},
loaded
()
{
Store
.
binaryLoaded
=
true
;
},
getBinaryType
()
{
if
(
Object
.
hasOwnProperty
.
call
(
this
.
binaryTypes
,
this
.
activeFile
.
extension
))
{
return
this
.
activeFile
.
extension
;
}
return
'
unknown
'
;
},
},
watch
:
{
blobRaw
()
{
Store
.
resetBinaryTypes
();
if
(
Helper
.
isKindaBinary
())
{
this
.
activeFile
.
raw
=
false
;
// counts as binaryish so we use the binary viewer in this case.
this
.
binary
=
true
;
}
if
(
!
this
.
binary
)
return
;
this
.
binaryTypes
[
this
.
getBinaryType
()]
=
true
;
},
},
};
export
default
RepoBinaryViewer
;
</
script
>
<
template
>
<div
id=
"binary-viewer"
v-if=
"binary && !activeFile.raw"
>
<img
v-show=
"binaryTypes.png && binaryLoaded"
@
error=
"errored"
@
load=
"loaded"
:src=
"pngBlobWithDataURI"
:alt=
"activeFile.name"
/>
<img
v-show=
"binaryTypes.svg"
@
error=
"errored"
@
load=
"loaded"
:src=
"svgBlobWithDataURI"
:alt=
"activeFile.name"
/>
<div
v-if=
"binaryTypes.md"
v-html=
"activeFile.html"
></div>
<div
class=
"binary-unknown"
v-if=
"binaryTypes.unknown"
>
<span>
Binary file. No preview available.
</span>
</div>
</div>
</
template
>
spec/javascripts/repo/components/repo_binary_viewer_spec.js
deleted
100644 → 0
View file @
ec93e17a
import
Vue
from
'
vue
'
;
import
Store
from
'
~/repo/stores/repo_store
'
;
import
repoBinaryViewer
from
'
~/repo/components/repo_binary_viewer.vue
'
;
describe
(
'
RepoBinaryViewer
'
,
()
=>
{
function
createComponent
()
{
const
RepoBinaryViewer
=
Vue
.
extend
(
repoBinaryViewer
);
return
new
RepoBinaryViewer
().
$mount
();
}
function
createActiveFile
(
type
,
activeFile
=
{})
{
const
file
=
activeFile
;
switch
(
type
)
{
case
'
svg
'
:
case
'
png
'
:
file
.
name
=
'
name
'
;
break
;
case
'
md
'
:
file
.
html
=
'
html
'
;
break
;
default
:
break
;
}
return
file
;
}
function
setActiveBinary
(
type
)
{
const
binaryTypes
=
{};
binaryTypes
[
type
]
=
true
;
const
activeFile
=
createActiveFile
(
type
);
const
uri
=
'
uri
'
;
Store
.
binary
=
true
;
Store
.
binaryTypes
=
binaryTypes
;
Store
.
activeFile
=
activeFile
;
Store
.
pngBlobWithDataURI
=
uri
;
return
{
activeFile
,
uri
,
};
}
function
assertBinaryImg
(
img
,
activeFile
,
uri
)
{
expect
(
img
.
src
).
toMatch
(
`/
${
uri
}
`
);
expect
(
img
.
alt
).
toEqual
(
activeFile
.
name
);
}
it
(
'
renders an img if its png
'
,
()
=>
{
const
{
activeFile
,
uri
}
=
setActiveBinary
(
'
png
'
);
const
vm
=
createComponent
();
const
img
=
vm
.
$el
.
querySelector
(
'
:scope > img
'
);
assertBinaryImg
(
img
,
activeFile
,
uri
);
});
it
(
'
renders an img if its svg
'
,
()
=>
{
const
{
activeFile
,
uri
}
=
setActiveBinary
(
'
svg
'
);
const
vm
=
createComponent
();
const
img
=
vm
.
$el
.
querySelector
(
'
:scope > img
'
);
assertBinaryImg
(
img
,
activeFile
,
uri
);
});
it
(
'
renders an div with content if its markdown
'
,
()
=>
{
const
{
activeFile
}
=
setActiveBinary
(
'
md
'
);
const
vm
=
createComponent
();
expect
(
vm
.
$el
.
querySelector
(
'
:scope > div
'
).
innerHTML
).
toEqual
(
activeFile
.
html
);
});
it
(
'
renders no preview message if its unknown
'
,
()
=>
{
setActiveBinary
(
'
unknown
'
);
const
vm
=
createComponent
();
expect
(
vm
.
$el
.
querySelector
(
'
.binary-unknown
'
).
textContent
).
toMatch
(
'
Binary file. No preview available.
'
);
});
it
(
'
does not render if no binary
'
,
()
=>
{
Store
.
binary
=
false
;
const
vm
=
createComponent
();
expect
(
vm
.
$el
.
innerHTML
).
toBeFalsy
();
});
});
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