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
10dcaea1
Commit
10dcaea1
authored
Oct 19, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
failing spec fixes
parent
389c852d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
47 deletions
+42
-47
app/assets/javascripts/repo/components/new_dropdown/modal.vue
...assets/javascripts/repo/components/new_dropdown/modal.vue
+3
-1
app/assets/javascripts/repo/components/repo_editor.vue
app/assets/javascripts/repo/components/repo_editor.vue
+18
-25
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+1
-1
app/assets/javascripts/repo/services/repo_service.js
app/assets/javascripts/repo/services/repo_service.js
+8
-2
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+1
-1
spec/javascripts/repo/components/repo_file_buttons_spec.js
spec/javascripts/repo/components/repo_file_buttons_spec.js
+11
-17
No files found.
app/assets/javascripts/repo/components/new_dropdown/modal.vue
View file @
10dcaea1
...
...
@@ -13,7 +13,7 @@
},
data
()
{
return
{
entryName
:
''
,
entryName
:
RepoStore
.
path
!==
''
?
`
${
RepoStore
.
path
}
/`
:
''
,
};
},
components
:
{
...
...
@@ -30,6 +30,8 @@
const
dirNames
=
this
.
entryName
.
split
(
'
/
'
);
dirNames
.
forEach
((
dirName
)
=>
{
if
(
dirName
===
''
)
return
;
tree
=
RepoHelper
.
findOrCreateEntry
(
'
tree
'
,
tree
,
dirName
).
entry
;
});
}
...
...
app/assets/javascripts/repo/components/repo_editor.vue
View file @
10dcaea1
...
...
@@ -16,35 +16,28 @@ const RepoEditor = {
},
mounted
()
{
if
(
!
this
.
activeFile
.
tempFile
)
{
Service
.
getRaw
(
this
.
activeFile
.
raw_path
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
activeFile
.
plain
=
rawResponse
.
data
;
this
.
createMonacoInstance
();
})
.
catch
(
Helper
.
loadingError
);
}
else
{
this
.
createMonacoInstance
();
}
},
Service
.
getRaw
(
this
.
activeFile
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
activeFile
.
plain
=
rawResponse
.
data
;
const
monacoInstance
=
Helper
.
monaco
.
editor
.
create
(
this
.
$el
,
{
model
:
null
,
readOnly
:
false
,
contextmenu
:
true
,
scrollBeyondLastLine
:
false
,
});
methods
:
{
createMonacoInstance
()
{
const
monacoInstance
=
Helper
.
monaco
.
editor
.
create
(
this
.
$el
,
{
model
:
null
,
readOnly
:
false
,
contextmenu
:
true
,
scrollBeyondLastLine
:
false
,
});
Helper
.
monacoInstance
=
monacoInstance
;
Helper
.
monacoInstance
=
monacoInstance
;
this
.
addMonacoEvents
()
;
this
.
addMonacoEvents
();
this
.
setupEditor
();
})
.
catch
(
Helper
.
loadingError
);
},
this
.
setupEditor
();
},
methods
:
{
setupEditor
()
{
this
.
showHide
();
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
10dcaea1
...
...
@@ -110,7 +110,7 @@ const RepoHelper = {
RepoHelper
.
setBinaryDataAsBase64
(
data
);
Store
.
setViewToPreview
();
}
else
if
(
!
Store
.
isPreviewView
()
&&
!
data
.
render_error
)
{
Service
.
getRaw
(
data
.
raw_path
)
Service
.
getRaw
(
data
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
data
.
plain
=
rawResponse
.
data
;
...
...
app/assets/javascripts/repo/services/repo_service.js
View file @
10dcaea1
...
...
@@ -12,8 +12,14 @@ const RepoService = {
},
richExtensionRegExp
:
/md/
,
getRaw
(
url
)
{
return
axios
.
get
(
url
,
{
getRaw
(
file
)
{
if
(
file
.
tempFile
)
{
return
Promise
.
resolve
({
data
:
''
,
});
}
return
axios
.
get
(
file
.
raw_path
,
{
// Stop Axios from parsing a JSON file into a JS object
transformResponse
:
[
res
=>
res
],
});
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
10dcaea1
...
...
@@ -77,7 +77,7 @@ const RepoStore = {
}
else
if
(
file
.
newContent
||
file
.
plain
)
{
RepoStore
.
blobRaw
=
file
.
newContent
||
file
.
plain
;
}
else
if
(
!
file
.
tempFile
)
{
Service
.
getRaw
(
file
.
raw_path
)
Service
.
getRaw
(
file
)
.
then
((
rawResponse
)
=>
{
RepoStore
.
blobRaw
=
rawResponse
.
data
;
Helper
.
findOpenedFileFromActive
().
plain
=
rawResponse
.
data
;
...
...
spec/javascripts/repo/components/repo_file_buttons_spec.js
View file @
10dcaea1
...
...
@@ -2,7 +2,16 @@ import Vue from 'vue';
import
repoFileButtons
from
'
~/repo/components/repo_file_buttons.vue
'
;
import
RepoStore
from
'
~/repo/stores/repo_store
'
;
describe
(
'
RepoFileButtons
'
,
()
=>
{
fdescribe
(
'
RepoFileButtons
'
,
()
=>
{
const
activeFile
=
{
extension
:
'
md
'
,
url
:
'
url
'
,
raw_path
:
'
raw_path
'
,
blame_path
:
'
blame_path
'
,
commits_path
:
'
commits_path
'
,
permalink
:
'
permalink
'
,
};
function
createComponent
()
{
const
RepoFileButtons
=
Vue
.
extend
(
repoFileButtons
);
...
...
@@ -14,14 +23,6 @@ describe('RepoFileButtons', () => {
});
it
(
'
renders Raw, Blame, History, Permalink and Preview toggle
'
,
()
=>
{
const
activeFile
=
{
extension
:
'
md
'
,
url
:
'
url
'
,
raw_path
:
'
raw_path
'
,
blame_path
:
'
blame_path
'
,
commits_path
:
'
commits_path
'
,
permalink
:
'
permalink
'
,
};
const
activeFileLabel
=
'
activeFileLabel
'
;
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
...
...
@@ -46,10 +47,6 @@ describe('RepoFileButtons', () => {
});
it
(
'
triggers rawPreviewToggle on preview click
'
,
()
=>
{
const
activeFile
=
{
extension
:
'
md
'
,
url
:
'
url
'
,
};
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
RepoStore
.
editMode
=
true
;
...
...
@@ -65,10 +62,7 @@ describe('RepoFileButtons', () => {
});
it
(
'
does not render preview toggle if not canPreview
'
,
()
=>
{
const
activeFile
=
{
extension
:
'
abcd
'
,
url
:
'
url
'
,
};
activeFile
.
extension
=
'
js
'
;
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
...
...
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