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
2fce0c86
Commit
2fce0c86
authored
Aug 03, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] WIP start to fix file raw state
parent
e361ed1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+17
-11
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+2
-0
No files found.
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
2fce0c86
...
@@ -166,22 +166,17 @@ const RepoHelper = {
...
@@ -166,22 +166,17 @@ const RepoHelper = {
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
||
Service
.
url
);
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
||
Service
.
url
);
RepoHelper
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
RepoHelper
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
Store
.
setViewToPreview
();
Store
.
setViewToPreview
();
}
else
{
}
else
if
(
!
Store
.
isPreviewView
())
{
if
(
!
Store
.
isPreviewView
())
{
Service
.
getRaw
(
data
.
raw_path
)
Service
.
getRaw
(
data
.
raw_path
)
.
then
((
rawResponse
)
=>
{
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
blobRaw
=
rawResponse
.
data
;
data
.
plain
=
rawResponse
.
data
;
RepoHelper
.
setFile
(
data
,
file
);
}).
catch
(
RepoHelper
.
loadingError
);
}).
catch
(
RepoHelper
.
loadingError
);
}
}
}
if
(
!
file
.
url
)
file
.
url
=
location
.
pathname
;
if
(
Store
.
isPreviewView
())
RepoHelper
.
setFile
(
data
,
file
);
data
.
url
=
file
.
url
;
data
.
newContent
=
''
;
Store
.
addToOpenedFiles
(
data
);
Store
.
setActiveFiles
(
data
);
// if the file tree is empty
// if the file tree is empty
if
(
Store
.
files
.
length
===
0
)
{
if
(
Store
.
files
.
length
===
0
)
{
...
@@ -200,6 +195,17 @@ const RepoHelper = {
...
@@ -200,6 +195,17 @@ const RepoHelper = {
}).
catch
(
RepoHelper
.
loadingError
);
}).
catch
(
RepoHelper
.
loadingError
);
},
},
setFile
(
data
,
file
)
{
const
newFile
=
data
;
newFile
.
url
=
file
.
url
||
location
.
pathname
;
newFile
.
url
=
file
.
url
;
newFile
.
newContent
=
''
;
Store
.
addToOpenedFiles
(
newFile
);
Store
.
setActiveFiles
(
newFile
);
},
toFA
(
icon
)
{
toFA
(
icon
)
{
return
`fa-
${
icon
}
`
;
return
`fa-
${
icon
}
`
;
},
},
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
2fce0c86
...
@@ -95,6 +95,8 @@ const RepoStore = {
...
@@ -95,6 +95,8 @@ const RepoStore = {
if
(
file
.
binary
)
{
if
(
file
.
binary
)
{
RepoStore
.
blobRaw
=
file
.
base64
;
RepoStore
.
blobRaw
=
file
.
base64
;
RepoStore
.
binaryMimeType
=
file
.
mime_type
;
RepoStore
.
binaryMimeType
=
file
.
mime_type
;
}
else
{
RepoStore
.
blobRaw
=
file
.
newContent
||
file
.
plain
;
}
}
if
(
!
file
.
loading
)
RepoHelper
.
toURL
(
file
.
url
,
file
.
name
);
if
(
!
file
.
loading
)
RepoHelper
.
toURL
(
file
.
url
,
file
.
name
);
...
...
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