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
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 @@
...
@@ -13,7 +13,7 @@
},
},
data
()
{
data
()
{
return
{
return
{
entryName
:
''
,
entryName
:
RepoStore
.
path
!==
''
?
`
${
RepoStore
.
path
}
/`
:
''
,
};
};
},
},
components
:
{
components
:
{
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
const
dirNames
=
this
.
entryName
.
split
(
'
/
'
);
const
dirNames
=
this
.
entryName
.
split
(
'
/
'
);
dirNames
.
forEach
((
dirName
)
=>
{
dirNames
.
forEach
((
dirName
)
=>
{
if
(
dirName
===
''
)
return
;
tree
=
RepoHelper
.
findOrCreateEntry
(
'
tree
'
,
tree
,
dirName
).
entry
;
tree
=
RepoHelper
.
findOrCreateEntry
(
'
tree
'
,
tree
,
dirName
).
entry
;
});
});
}
}
...
...
app/assets/javascripts/repo/components/repo_editor.vue
View file @
10dcaea1
...
@@ -16,35 +16,28 @@ const RepoEditor = {
...
@@ -16,35 +16,28 @@ const RepoEditor = {
},
},
mounted
()
{
mounted
()
{
if
(
!
this
.
activeFile
.
tempFile
)
{
Service
.
getRaw
(
this
.
activeFile
)
Service
.
getRaw
(
this
.
activeFile
.
raw_path
)
.
then
((
rawResponse
)
=>
{
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
activeFile
.
plain
=
rawResponse
.
data
;
Store
.
activeFile
.
plain
=
rawResponse
.
data
;
const
monacoInstance
=
Helper
.
monaco
.
editor
.
create
(
this
.
$el
,
{
this
.
createMonacoInstance
();
model
:
null
,
})
readOnly
:
false
,
.
catch
(
Helper
.
loadingError
);
contextmenu
:
true
,
}
else
{
scrollBeyondLastLine
:
false
,
this
.
createMonacoInstance
();
});
}
},
methods
:
{
Helper
.
monacoInstance
=
monacoInstance
;
createMonacoInstance
()
{
const
monacoInstance
=
Helper
.
monaco
.
editor
.
create
(
this
.
$el
,
{
model
:
null
,
readOnly
:
false
,
contextmenu
:
true
,
scrollBeyondLastLine
:
false
,
});
Helper
.
monacoInstance
=
monacoInstance
;
this
.
addMonacoEvents
()
;
this
.
addMonacoEvents
();
this
.
setupEditor
();
})
.
catch
(
Helper
.
loadingError
);
},
this
.
setupEditor
();
methods
:
{
},
setupEditor
()
{
setupEditor
()
{
this
.
showHide
();
this
.
showHide
();
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
10dcaea1
...
@@ -110,7 +110,7 @@ const RepoHelper = {
...
@@ -110,7 +110,7 @@ const RepoHelper = {
RepoHelper
.
setBinaryDataAsBase64
(
data
);
RepoHelper
.
setBinaryDataAsBase64
(
data
);
Store
.
setViewToPreview
();
Store
.
setViewToPreview
();
}
else
if
(
!
Store
.
isPreviewView
()
&&
!
data
.
render_error
)
{
}
else
if
(
!
Store
.
isPreviewView
()
&&
!
data
.
render_error
)
{
Service
.
getRaw
(
data
.
raw_path
)
Service
.
getRaw
(
data
)
.
then
((
rawResponse
)
=>
{
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
Store
.
blobRaw
=
rawResponse
.
data
;
data
.
plain
=
rawResponse
.
data
;
data
.
plain
=
rawResponse
.
data
;
...
...
app/assets/javascripts/repo/services/repo_service.js
View file @
10dcaea1
...
@@ -12,8 +12,14 @@ const RepoService = {
...
@@ -12,8 +12,14 @@ const RepoService = {
},
},
richExtensionRegExp
:
/md/
,
richExtensionRegExp
:
/md/
,
getRaw
(
url
)
{
getRaw
(
file
)
{
return
axios
.
get
(
url
,
{
if
(
file
.
tempFile
)
{
return
Promise
.
resolve
({
data
:
''
,
});
}
return
axios
.
get
(
file
.
raw_path
,
{
// Stop Axios from parsing a JSON file into a JS object
// Stop Axios from parsing a JSON file into a JS object
transformResponse
:
[
res
=>
res
],
transformResponse
:
[
res
=>
res
],
});
});
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
10dcaea1
...
@@ -77,7 +77,7 @@ const RepoStore = {
...
@@ -77,7 +77,7 @@ const RepoStore = {
}
else
if
(
file
.
newContent
||
file
.
plain
)
{
}
else
if
(
file
.
newContent
||
file
.
plain
)
{
RepoStore
.
blobRaw
=
file
.
newContent
||
file
.
plain
;
RepoStore
.
blobRaw
=
file
.
newContent
||
file
.
plain
;
}
else
if
(
!
file
.
tempFile
)
{
}
else
if
(
!
file
.
tempFile
)
{
Service
.
getRaw
(
file
.
raw_path
)
Service
.
getRaw
(
file
)
.
then
((
rawResponse
)
=>
{
.
then
((
rawResponse
)
=>
{
RepoStore
.
blobRaw
=
rawResponse
.
data
;
RepoStore
.
blobRaw
=
rawResponse
.
data
;
Helper
.
findOpenedFileFromActive
().
plain
=
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';
...
@@ -2,7 +2,16 @@ import Vue from 'vue';
import
repoFileButtons
from
'
~/repo/components/repo_file_buttons.vue
'
;
import
repoFileButtons
from
'
~/repo/components/repo_file_buttons.vue
'
;
import
RepoStore
from
'
~/repo/stores/repo_store
'
;
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
()
{
function
createComponent
()
{
const
RepoFileButtons
=
Vue
.
extend
(
repoFileButtons
);
const
RepoFileButtons
=
Vue
.
extend
(
repoFileButtons
);
...
@@ -14,14 +23,6 @@ describe('RepoFileButtons', () => {
...
@@ -14,14 +23,6 @@ describe('RepoFileButtons', () => {
});
});
it
(
'
renders Raw, Blame, History, Permalink and Preview toggle
'
,
()
=>
{
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
'
;
const
activeFileLabel
=
'
activeFileLabel
'
;
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
RepoStore
.
activeFile
=
activeFile
;
...
@@ -46,10 +47,6 @@ describe('RepoFileButtons', () => {
...
@@ -46,10 +47,6 @@ describe('RepoFileButtons', () => {
});
});
it
(
'
triggers rawPreviewToggle on preview click
'
,
()
=>
{
it
(
'
triggers rawPreviewToggle on preview click
'
,
()
=>
{
const
activeFile
=
{
extension
:
'
md
'
,
url
:
'
url
'
,
};
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
RepoStore
.
activeFile
=
activeFile
;
RepoStore
.
editMode
=
true
;
RepoStore
.
editMode
=
true
;
...
@@ -65,10 +62,7 @@ describe('RepoFileButtons', () => {
...
@@ -65,10 +62,7 @@ describe('RepoFileButtons', () => {
});
});
it
(
'
does not render preview toggle if not canPreview
'
,
()
=>
{
it
(
'
does not render preview toggle if not canPreview
'
,
()
=>
{
const
activeFile
=
{
activeFile
.
extension
=
'
js
'
;
extension
:
'
abcd
'
,
url
:
'
url
'
,
};
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
openedFiles
=
new
Array
(
1
);
RepoStore
.
activeFile
=
activeFile
;
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