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
e361ed1e
Commit
e361ed1e
authored
Aug 03, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] formalise repo_preview component and logic
parent
a70e53b4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
11 deletions
+26
-11
app/assets/javascripts/repo/components/repo.vue
app/assets/javascripts/repo/components/repo.vue
+3
-7
app/assets/javascripts/repo/components/repo_preview.vue
app/assets/javascripts/repo/components/repo_preview.vue
+11
-0
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+2
-2
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+10
-2
No files found.
app/assets/javascripts/repo/components/repo.vue
View file @
e361ed1e
...
...
@@ -4,6 +4,7 @@ import RepoCommitSection from './repo_commit_section.vue';
import
RepoTabs
from
'
./repo_tabs.vue
'
;
import
RepoFileButtons
from
'
./repo_file_buttons.vue
'
;
import
RepoBinaryViewer
from
'
./repo_binary_viewer.vue
'
;
import
RepoPreview
from
'
./repo_preview.vue
'
;
import
RepoMixin
from
'
../mixins/repo_mixin
'
;
import
PopupDialog
from
'
../../vue_shared/components/popup_dialog.vue
'
;
import
Store
from
'
../stores/repo_store
'
;
...
...
@@ -21,16 +22,11 @@ export default {
'
repo-editor
'
:
MonacoLoaderHelper
.
repoEditorLoader
,
'
repo-commit-section
'
:
RepoCommitSection
,
'
popup-dialog
'
:
PopupDialog
,
preview
:
{
// POC
data
:
()
=>
Store
,
template
:
'
<div v-html="activeFile.html"></div>
'
,
},
'
repo-preview
'
:
RepoPreview
,
},
mounted
()
{
RepoHelper
.
getContent
().
then
(()
=>
{
}).
catch
(
RepoHelper
.
loadingError
);
RepoHelper
.
getContent
().
catch
(
RepoHelper
.
loadingError
);
},
methods
:
{
...
...
app/assets/javascripts/repo/components/repo_preview.vue
0 → 100644
View file @
e361ed1e
<
script
>
import
RepoStore
from
'
../stores/repo_store
'
;
export
default
{
data
:
()
=>
RepoStore
,
}
</
script
>
<
template
>
<div
v-html=
"activeFile.html"
></div>
</
template
>
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
e361ed1e
...
...
@@ -165,9 +165,9 @@ const RepoHelper = {
// file might be undefined
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
||
Service
.
url
);
RepoHelper
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
Store
.
currentBlobView
=
'
preview
'
;
Store
.
setViewToPreview
()
;
}
else
{
if
(
Store
.
currentBlobView
!==
'
preview
'
)
{
if
(
!
Store
.
isPreviewView
()
)
{
Service
.
getRaw
(
data
.
raw_path
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
e361ed1e
...
...
@@ -20,7 +20,7 @@ const RepoStore = {
submodules
:
[],
blobRaw
:
''
,
blobRendered
:
''
,
currentBlobView
:
'
preview
'
,
currentBlobView
:
'
repo-
preview
'
,
openedFiles
:
[],
tabSize
:
100
,
defaultTabSize
:
100
,
...
...
@@ -211,7 +211,11 @@ const RepoStore = {
},
toggleBlobView
()
{
RepoStore
.
currentBlobView
=
RepoStore
.
currentBlobView
===
'
preview
'
?
'
repo-editor
'
:
'
preview
'
;
RepoStore
.
currentBlobView
=
RepoStore
.
isPreviewView
()
?
'
repo-editor
'
:
'
repo-preview
'
;
},
setViewToPreview
()
{
RepoStore
.
currentBlobView
=
'
repo-preview
'
;
},
// getters
...
...
@@ -219,5 +223,9 @@ const RepoStore = {
isActiveFile
(
file
)
{
return
file
&&
file
.
url
===
RepoStore
.
activeFile
.
url
;
},
isPreviewView
()
{
return
RepoStore
.
currentBlobView
===
'
repo-preview
'
;
},
};
export
default
RepoStore
;
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