BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3a2f883f
Commit
3a2f883f
authored
Jul 17, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide With conflicts
parents
0b500111
51a936fb
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
290 additions
and
166 deletions
+290
-166
dispatcher.js
app/assets/javascripts/dispatcher.js
+4
-5
repo_binary_viewer.js
app/assets/javascripts/repo/repo_binary_viewer.js
+28
-8
repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+11
-0
repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+30
-15
repo_file.js
app/assets/javascripts/repo/repo_file.js
+4
-4
repo_file_buttons.js
app/assets/javascripts/repo/repo_file_buttons.js
+18
-1
repo_file_options.js
app/assets/javascripts/repo/repo_file_options.js
+4
-4
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+116
-79
repo_loading_file.js
app/assets/javascripts/repo/repo_loading_file.js
+4
-4
repo_mini_mixin.js
app/assets/javascripts/repo/repo_mini_mixin.js
+3
-3
repo_prev_directory.js
app/assets/javascripts/repo/repo_prev_directory.js
+4
-4
repo_service.js
app/assets/javascripts/repo/repo_service.js
+10
-10
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+21
-15
repo_store.js
app/assets/javascripts/repo/repo_store.js
+8
-5
repo_tab.js
app/assets/javascripts/repo/repo_tab.js
+4
-4
repo_tabs.js
app/assets/javascripts/repo/repo_tabs.js
+5
-5
repo_view_toggler.js
app/assets/javascripts/repo/repo_view_toggler.js
+16
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
3a2f883f
...
@@ -72,19 +72,18 @@ import RepoBundle from './repo/repo_bundle';
...
@@ -72,19 +72,18 @@ import RepoBundle from './repo/repo_bundle';
}
}
Dispatcher
.
prototype
.
initPageScripts
=
function
()
{
Dispatcher
.
prototype
.
initPageScripts
=
function
()
{
var
page
,
path
,
shortcut_handler
,
fileBlobPermalinkUrlElement
,
fileBlobPermalinkUrl
,
os
;
var
page
,
path
,
shortcut_handler
,
fileBlobPermalinkUrlElement
,
fileBlobPermalinkUrl
;
page
=
$
(
'body'
).
attr
(
'data-page'
);
page
=
$
(
'body'
).
attr
(
'data-page'
);
if
(
!
page
)
{
if
(
!
page
)
{
return
false
;
return
false
;
}
}
function
getScrollBarWidth
()
{
function
getScrollBarWidth
()
{
var
$outer
=
$
(
'<div>'
).
css
({
visibility
:
'hidden'
,
width
:
100
,
overflow
:
'scroll'
}).
appendTo
(
'body'
),
var
$outer
=
$
(
'<div>'
).
css
({
visibility
:
'hidden'
,
width
:
100
,
overflow
:
'scroll'
}).
appendTo
(
'body'
),
widthWithScroll
=
$
(
'<div>'
).
css
({
width
:
'100%'
}).
appendTo
(
$outer
).
outerWidth
();
widthWithScroll
=
$
(
'<div>'
).
css
({
width
:
'100%'
}).
appendTo
(
$outer
).
outerWidth
();
$outer
.
remove
();
$outer
.
remove
();
return
100
-
widthWithScroll
;
return
100
-
widthWithScroll
;
}
;
}
$
(
'body'
).
attr
(
'data-scroll-width'
,
getScrollBarWidth
());
$
(
'body'
).
attr
(
'data-scroll-width'
,
getScrollBarWidth
());
...
...
app/assets/javascripts/repo/repo_binary_viewer.js
View file @
3a2f883f
import
Vue
from
'vue'
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
import
{
loadingError
}
from
'./repo_helper'
;
export
default
class
RepoBinaryViewer
{
export
default
class
RepoBinaryViewer
{
constructor
(
url
)
{
constructor
()
{
this
.
initVue
();
this
.
initVue
();
}
}
...
@@ -15,32 +16,51 @@ export default class RepoBinaryViewer {
...
@@ -15,32 +16,51 @@ export default class RepoBinaryViewer {
computed
:
{
computed
:
{
pngBlobWithDataURI
()
{
pngBlobWithDataURI
()
{
return
`data:image/png;base64,
${
this
.
blobRaw
}
`
;
return
`data:image/png;base64,
${
this
.
blobRaw
}
`
;
}
}
,
},
},
methods
:
{
methods
:
{
<<<<<<<
HEAD
isMarkdown
()
{
isMarkdown
()
{
return
this
.
activeFile
.
extension
===
'md'
;
return
this
.
activeFile
.
extension
===
'md'
;
=======
supportedNonBinaryFileType
()
{
switch
(
this
.
activeFile
.
extension
)
{
case
'md'
:
this
.
binaryTypes
.
markdown
=
true
;
return
true
;
default
:
return
false
;
}
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
},
},
},
watch
:
{
watch
:
{
blobRaw
()
{
blobRaw
()
{
<<<<<<<
HEAD
if
(
this
.
isMarkdown
())
{
if
(
this
.
isMarkdown
())
{
=======
const
supported
=
this
.
supportedNonBinaryFileType
();
if
(
supported
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
this
.
binaryTypes
.
markdown
=
true
;
this
.
binaryTypes
.
markdown
=
true
;
this
.
activeFile
.
raw
=
false
;
this
.
activeFile
.
raw
=
false
;
// counts as binaryish so we use the binary viewer in this case.
// counts as binaryish so we use the binary viewer in this case.
this
.
binary
=
true
;
this
.
binary
=
true
;
return
;
return
;
}
}
if
(
!
this
.
binary
)
return
;
if
(
!
this
.
binary
)
return
;
switch
(
this
.
binaryMimeType
)
{
switch
(
this
.
binaryMimeType
)
{
case
'image/png'
:
case
'image/png'
:
this
.
binaryTypes
.
png
=
true
;
this
.
binaryTypes
.
png
=
true
;
break
;
break
;
default
:
loadingError
();
break
;
}
}
}
}
,
}
}
,
});
});
}
}
}
}
app/assets/javascripts/repo/repo_bundle.js
View file @
3a2f883f
<<<<<<<
HEAD
import
Tabs
from
'./repo_tabs'
import
Tabs
from
'./repo_tabs'
import
Sidebar
from
'./repo_sidebar'
import
Sidebar
from
'./repo_sidebar'
import
Editor
from
'./repo_editor'
import
Editor
from
'./repo_editor'
...
@@ -8,6 +9,16 @@ import CommitSection from './repo_commit_section'
...
@@ -8,6 +9,16 @@ import CommitSection from './repo_commit_section'
import
Service
from
'./repo_service'
import
Service
from
'./repo_service'
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
import
Helper
from
'./repo_helper'
=======
import
Tabs
from
'./repo_tabs'
;
import
Sidebar
from
'./repo_sidebar'
;
import
Editor
from
'./repo_editor'
;
import
FileButtons
from
'./repo_file_buttons'
;
import
BinaryViewer
from
'./repo_binary_viewer'
;
import
Service
from
'./repo_service'
;
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
export
default
class
RepoBundle
{
export
default
class
RepoBundle
{
constructor
()
{
constructor
()
{
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
3a2f883f
/* global monaco */
/* global monaco */
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
import
Helper
from
'./repo_helper'
;
export
default
class
RepoEditor
{
export
default
class
RepoEditor
{
constructor
()
{
constructor
()
{
...
@@ -10,12 +10,19 @@ export default class RepoEditor {
...
@@ -10,12 +10,19 @@ export default class RepoEditor {
}
}
addMonacoEvents
()
{
addMonacoEvents
()
{
<<<<<<<
HEAD
this
.
monacoEditor
.
onMouseUp
(
this
.
onMonacoEditorMouseUp
.
bind
(
this
));
this
.
monacoEditor
.
onMouseUp
(
this
.
onMonacoEditorMouseUp
.
bind
(
this
));
this
.
monacoEditor
.
onKeyUp
(
this
.
onMonacoEditorKeysPressed
.
bind
(
this
));
this
.
monacoEditor
.
onKeyUp
(
this
.
onMonacoEditorKeysPressed
.
bind
(
this
));
=======
this
.
vue
.
$watch
(
'activeFile.lineNumber'
,
()
=>
{
console
.
log
(
'cahnged'
);
});
this
.
monacoEditor
.
onMouseUp
(
RepoEditor
.
onMonacoEditorMouseUp
);
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
}
}
onMonacoEditorMouseUp
(
e
)
{
static
onMonacoEditorMouseUp
(
e
)
{
if
(
e
.
target
.
element
.
className
===
'line-numbers'
)
{
if
(
e
.
target
.
element
.
className
===
'line-numbers'
)
{
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
}
}
...
@@ -34,7 +41,7 @@ export default class RepoEditor {
...
@@ -34,7 +41,7 @@ export default class RepoEditor {
model
:
null
,
model
:
null
,
readOnly
:
true
,
readOnly
:
true
,
contextmenu
:
false
,
contextmenu
:
false
,
}
}
,
);
);
Helper
.
monacoInstance
=
monaco
;
Helper
.
monacoInstance
=
monaco
;
...
@@ -49,33 +56,37 @@ export default class RepoEditor {
...
@@ -49,33 +56,37 @@ export default class RepoEditor {
const
monacoEditor
=
this
.
monacoEditor
;
const
monacoEditor
=
this
.
monacoEditor
;
this
.
vue
=
new
Vue
({
this
.
vue
=
new
Vue
({
data
:
()
=>
Store
,
data
:
()
=>
Store
,
created
()
{
created
()
{
this
.
showHide
();
this
.
showHide
();
if
(
this
.
blobRaw
!==
''
)
{
if
(
this
.
blobRaw
!==
''
)
{
monacoEditor
.
setModel
(
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
blobRaw
,
'plain'
'plain'
,
)
)
,
);
);
}
}
},
},
methods
:
{
methods
:
{
showHide
()
{
showHide
()
{
<<<<<<<
HEAD
if
(
!
this
.
openedFiles
.
length
||
(
this
.
binary
&&
!
this
.
activeFile
.
raw
))
{
if
(
!
this
.
openedFiles
.
length
||
(
this
.
binary
&&
!
this
.
activeFile
.
raw
))
{
=======
if
((
!
this
.
openedFiles
.
length
)
||
this
.
binary
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
self
.
el
.
style
.
display
=
'none'
;
self
.
el
.
style
.
display
=
'none'
;
}
else
{
}
else
{
self
.
el
.
style
.
display
=
'inline-block'
;
self
.
el
.
style
.
display
=
'inline-block'
;
}
}
}
}
,
},
},
watch
:
{
watch
:
{
activeLine
()
{
activeLine
()
{
self
.
monacoEditor
.
setPosition
({
self
.
monacoEditor
.
setPosition
({
lineNumber
:
this
.
activeLine
,
lineNumber
:
this
.
activeLine
,
column
:
1
column
:
1
,
});
});
},
},
...
@@ -114,20 +125,24 @@ export default class RepoEditor {
...
@@ -114,20 +125,24 @@ export default class RepoEditor {
blobRaw
()
{
blobRaw
()
{
this
.
showHide
();
this
.
showHide
();
<<<<<<<
HEAD
if
(
!
this
.
isTree
)
{
if
(
!
this
.
isTree
)
{
// kill the current model;
// kill the current model;
self
.
monacoEditor
.
setModel
(
null
);
self
.
monacoEditor
.
setModel
(
null
);
// then create the new one
// then create the new one
=======
if
(
!
this
.
isTree
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
self
.
monacoEditor
.
setModel
(
self
.
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
blobRaw
,
this
.
activeFile
.
mime_type
this
.
activeFile
.
mime_type
,
)
)
,
);
);
console
.
log
(
monaco
.
editor
.
getModels
());
console
.
log
(
monaco
.
editor
.
getModels
());
}
}
}
}
,
}
}
,
});
});
}
}
}
}
app/assets/javascripts/repo/repo_file.js
View file @
3a2f883f
le
t
RepoFile
=
{
cons
t
RepoFile
=
{
template
:
`
template
:
`
<tr v-if='!loading.tree || hasFiles' :class='{"active": activeFile.url === file.url}'>
<tr v-if='!loading.tree || hasFiles' :class='{"active": activeFile.url === file.url}'>
<td>
<td>
...
@@ -20,13 +20,13 @@ let RepoFile = {
...
@@ -20,13 +20,13 @@ let RepoFile = {
isMini
:
Boolean
,
isMini
:
Boolean
,
loading
:
Object
,
loading
:
Object
,
hasFiles
:
Boolean
,
hasFiles
:
Boolean
,
activeFile
:
Object
activeFile
:
Object
,
},
},
methods
:
{
methods
:
{
linkClicked
(
file
)
{
linkClicked
(
file
)
{
this
.
$emit
(
'linkclicked'
,
file
);
this
.
$emit
(
'linkclicked'
,
file
);
}
}
,
}
}
,
};
};
export
default
RepoFile
;
export
default
RepoFile
;
app/assets/javascripts/repo/repo_file_buttons.js
View file @
3a2f883f
<<<<<<<
HEAD
import
Vue
from
'vue'
import
Vue
from
'vue'
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
import
Helper
from
'./repo_helper'
import
RepoMiniMixin
from
'./repo_mini_mixin'
import
RepoMiniMixin
from
'./repo_mini_mixin'
=======
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
export
default
class
RepoSidebar
{
export
default
class
RepoSidebar
{
constructor
(
url
)
{
constructor
(
url
)
{
...
@@ -31,9 +37,14 @@ export default class RepoSidebar {
...
@@ -31,9 +37,14 @@ export default class RepoSidebar {
</div>
</div>
`
,
`
,
computed
:
{
computed
:
{
<<<<<<<
HEAD
editableBorder
()
{
editableBorder
()
{
return
this
.
editMode
?
'1px solid #1F78D1'
:
'1px solid #f0f0f0'
;
return
this
.
editMode
?
'1px solid #1F78D1'
:
'1px solid #f0f0f0'
;
=======
previewLabel
()
{
return
this
.
activeFile
.
raw
?
'Preview'
:
'Raw'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
},
canPreview
()
{
canPreview
()
{
...
@@ -50,13 +61,19 @@ export default class RepoSidebar {
...
@@ -50,13 +61,19 @@ export default class RepoSidebar {
historyFileUrl
()
{
historyFileUrl
()
{
return
Helper
.
getHistoryURLFromBlobURL
(
this
.
activeFile
.
url
);
return
Helper
.
getHistoryURLFromBlobURL
(
this
.
activeFile
.
url
);
}
}
,
},
},
methods
:
{
methods
:
{
<<<<<<<
HEAD
rawPreviewToggle
()
{
rawPreviewToggle
()
{
Helper
.
setCurrentFileRawOrPreview
();
Helper
.
setCurrentFileRawOrPreview
();
}
}
=======
setRawPreviewMode
()
{
},
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
},
});
});
}
}
...
...
app/assets/javascripts/repo/repo_file_options.js
View file @
3a2f883f
le
t
RepoFileOptions
=
{
cons
t
RepoFileOptions
=
{
template
:
`
template
:
`
<tr v-if='isMini' class='repo-file-options'>
<tr v-if='isMini' class='repo-file-options'>
<td>
<td>
...
@@ -21,8 +21,8 @@ let RepoFileOptions = {
...
@@ -21,8 +21,8 @@ let RepoFileOptions = {
props
:
{
props
:
{
name
:
'repo-file-options'
,
name
:
'repo-file-options'
,
isMini
:
Boolean
,
isMini
:
Boolean
,
projectName
:
String
projectName
:
String
,
}
}
,
}
}
;
export
default
RepoFileOptions
;
export
default
RepoFileOptions
;
app/assets/javascripts/repo/repo_helper.js
View file @
3a2f883f
import
Service
from
'./repo_service'
import
Service
from
'./repo_service'
;
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
import
Flash
from
'../flash'
;
le
t
RepoHelper
=
{
cons
t
RepoHelper
=
{
isTree
(
data
)
{
isTree
(
data
)
{
return
data
.
hasOwnProperty
(
'blobs'
);
return
Object
.
hasOwnProperty
.
call
(
data
,
'blobs'
);
},
},
monacoInstance
:
undefined
,
monacoInstance
:
undefined
,
...
@@ -14,49 +15,42 @@ let RepoHelper = {
...
@@ -14,49 +15,42 @@ let RepoHelper = {
:
Date
,
:
Date
,
getLanguagesForMimeType
(
mimetypeNeedle
)
{
getLanguagesForMimeType
(
mimetypeNeedle
)
{
const
langs
=
monaco
.
languages
.
getLanguages
();
const
langs
=
window
.
monaco
.
languages
.
getLanguages
();
let
lang
=
''
;
langs
.
map
((
lang
)
=>
{
langs
.
every
((
lang
)
=>
{
const
hasLang
=
lang
.
mimetypes
.
some
(
mimetype
=>
mimetypeNeedle
===
mimetype
);
const
hasLang
=
lang
.
mimetypes
.
some
((
mimetype
)
=>
{
if
(
hasLang
)
return
lang
.
id
;
return
mimetypeNeedle
===
mimetype
return
lang
;
});
if
(
hasLang
)
{
lang
=
lang
.
id
;
return
true
;
}
return
false
;
});
});
},
},
blobURLtoParent
(
url
)
{
blobURLtoParent
(
url
)
{
let
joined
=
''
;
const
split
=
url
.
split
(
'/'
);
const
split
=
url
.
split
(
'/'
);
split
.
pop
();
split
.
pop
();
const
blobIndex
=
split
.
indexOf
(
'blob'
);
const
blobIndex
=
split
.
indexOf
(
'blob'
);
if
(
blobIndex
>
-
1
)
{
if
(
blobIndex
>
-
1
)
{
split
[
blobIndex
]
=
'tree'
;
split
[
blobIndex
]
=
'tree'
;
}
}
joined
=
split
.
join
(
'/'
);
return
split
.
join
(
'/'
);
return
split
.
join
(
'/'
);
},
},
insertNewFilesIntoParentDir
(
inDirectory
,
oldList
,
newList
)
{
insertNewFilesIntoParentDir
(
inDirectory
,
oldList
,
newList
)
{
let
indexOfFile
;
let
indexOfFile
;
if
(
!
inDirectory
)
{
if
(
!
inDirectory
)
{
return
newList
;
return
newList
;
}
}
oldList
.
find
((
file
,
i
)
=>
{
oldList
.
find
((
file
,
i
)
=>
{
if
(
file
.
url
===
inDirectory
.
url
)
{
if
(
file
.
url
===
inDirectory
.
url
)
{
indexOfFile
=
i
+
1
;
indexOfFile
=
i
+
1
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
});
});
if
(
indexOfFile
)
{
if
(
indexOfFile
)
{
// insert new list into old list
// insert new list into old list
newList
.
forEach
((
newFile
)
=>
{
newList
.
forEach
((
newFile
)
=>
{
newFile
.
level
=
inDirectory
.
level
+
1
;
const
file
=
newFile
;
oldList
.
splice
(
indexOfFile
,
0
,
newFile
);
file
.
level
=
inDirectory
.
level
+
1
;
oldList
.
splice
(
indexOfFile
,
0
,
file
);
});
});
return
oldList
;
return
oldList
;
}
}
...
@@ -64,10 +58,9 @@ let RepoHelper = {
...
@@ -64,10 +58,9 @@ let RepoHelper = {
},
},
resetBinaryTypes
()
{
resetBinaryTypes
()
{
let
s
=
''
;
Object
.
keys
(
Store
.
binaryTypes
).
forEach
((
typeKey
)
=>
{
for
(
s
in
Store
.
binaryTypes
)
{
Store
.
binaryTypes
[
typeKey
]
=
false
;
Store
.
binaryTypes
[
s
]
=
false
;
});
}
},
},
setCurrentFileRawOrPreview
()
{
setCurrentFileRawOrPreview
()
{
...
@@ -76,6 +69,7 @@ let RepoHelper = {
...
@@ -76,6 +69,7 @@ let RepoHelper = {
},
},
setActiveFile
(
file
)
{
setActiveFile
(
file
)
{
<<<<<<<
HEAD
// don't load the file that is already loaded
// don't load the file that is already loaded
if
(
file
.
url
===
Store
.
activeFile
.
url
)
return
;
if
(
file
.
url
===
Store
.
activeFile
.
url
)
return
;
...
@@ -84,9 +78,17 @@ let RepoHelper = {
...
@@ -84,9 +78,17 @@ let RepoHelper = {
if
(
openedFile
.
active
)
{
if
(
openedFile
.
active
)
{
Store
.
activeFile
=
openedFile
;
Store
.
activeFile
=
openedFile
;
Store
.
activeFileIndex
=
i
;
Store
.
activeFileIndex
=
i
;
=======
Store
.
openedFiles
=
Store
.
openedFiles
.
map
((
openedFile
)
=>
{
const
activeFile
=
openedFile
;
activeFile
.
active
=
file
.
url
===
activeFile
.
url
;
// eslint-disable-line no-param-reassign
if
(
activeFile
.
active
)
{
Store
.
activeFile
=
activeFile
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
}
}
return
opened
File
;
return
active
File
;
});
});
<<<<<<<
HEAD
// reset the active file raw
// reset the active file raw
Store
.
activeFile
.
raw
=
false
;
Store
.
activeFile
.
raw
=
false
;
...
@@ -94,39 +96,48 @@ let RepoHelper = {
...
@@ -94,39 +96,48 @@ let RepoHelper = {
Store
.
activeFileLabel
=
'Raw'
;
Store
.
activeFileLabel
=
'Raw'
;
if
(
file
.
binary
)
{
if
(
file
.
binary
)
{
=======
if
(
file
.
binary
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
Store
.
blobRaw
=
file
.
base64
;
Store
.
blobRaw
=
file
.
base64
;
}
else
{
}
else
{
Store
.
blobRaw
=
file
.
plain
;
Store
.
blobRaw
=
file
.
plain
;
}
}
if
(
!
file
.
loading
)
{
if
(
!
file
.
loading
)
{
this
.
toURL
(
file
.
url
);
this
.
toURL
(
file
.
url
);
}
}
Store
.
binary
=
file
.
binary
;
Store
.
binary
=
file
.
binary
;
},
},
removeFromOpenedFiles
(
file
)
{
removeFromOpenedFiles
(
file
)
{
if
(
file
.
type
===
'tree'
)
return
;
if
(
file
.
type
===
'tree'
)
return
;
Store
.
openedFiles
=
Store
.
openedFiles
.
filter
((
openedFile
)
=>
{
Store
.
openedFiles
=
Store
.
openedFiles
.
filter
(
openedFile
=>
openedFile
.
url
!==
file
.
url
);
return
openedFile
.
url
!==
file
.
url
;
});
},
},
addToOpenedFiles
(
file
)
{
addToOpenedFiles
(
file
)
{
<<<<<<<
HEAD
const
openedFilesAlreadyExists
=
Store
.
openedFiles
.
some
((
openedFile
)
=>
{
const
openedFilesAlreadyExists
=
Store
.
openedFiles
.
some
((
openedFile
)
=>
{
return
openedFile
.
url
===
file
.
url
return
openedFile
.
url
===
file
.
url
});
});
if
(
!
openedFilesAlreadyExists
)
{
if
(
!
openedFilesAlreadyExists
)
{
file
.
changed
=
false
;
file
.
changed
=
false
;
=======
const
openedFilesAlreadyExists
=
Store
.
openedFiles
.
some
(
openedFile
=>
openedFile
.
url
===
file
.
url
);
if
(
!
openedFilesAlreadyExists
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
Store
.
openedFiles
.
push
(
file
);
Store
.
openedFiles
.
push
(
file
);
}
}
},
},
/* eslint-disable no-param-reassign */
setDirectoryOpen
(
tree
)
{
setDirectoryOpen
(
tree
)
{
if
(
tree
)
{
if
(
tree
)
{
tree
.
opened
=
true
;
tree
.
opened
=
true
;
tree
.
icon
=
'fa-folder-open'
;
tree
.
icon
=
'fa-folder-open'
;
}
}
},
},
/* eslint-enable no-param-reassign */
getRawURLFromBlobURL
(
url
)
{
getRawURLFromBlobURL
(
url
)
{
return
url
.
replace
(
'blob'
,
'raw'
);
return
url
.
replace
(
'blob'
,
'raw'
);
...
@@ -144,8 +155,9 @@ let RepoHelper = {
...
@@ -144,8 +155,9 @@ let RepoHelper = {
Service
.
getBase64Content
(
url
)
Service
.
getBase64Content
(
url
)
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
Store
.
blobRaw
=
response
;
Store
.
blobRaw
=
response
;
file
.
base64
=
response
file
.
base64
=
response
;
// eslint-disable-line no-param-reassign
});
})
.
catch
(
this
.
loadingError
);
},
},
setActiveFileContents
(
contents
)
{
setActiveFileContents
(
contents
)
{
...
@@ -156,59 +168,80 @@ let RepoHelper = {
...
@@ -156,59 +168,80 @@ let RepoHelper = {
},
},
toggleFakeTab
(
loading
,
file
)
{
toggleFakeTab
(
loading
,
file
)
{
if
(
loading
)
{
if
(
loading
)
{
const
randomURL
=
this
.
Time
.
now
();
const
randomURL
=
this
.
Time
.
now
();
const
newFakeFile
=
{
const
newFakeFile
=
{
active
:
false
,
active
:
false
,
binary
:
true
,
binary
:
true
,
type
:
'blob'
,
type
:
'blob'
,
loading
:
true
,
loading
:
true
,
mime_type
:
'loading'
,
mime_type
:
'loading'
,
name
:
'loading'
,
name
:
'loading'
,
url
:
randomURL
url
:
randomURL
,
};
};
Store
.
openedFiles
.
push
(
newFakeFile
);
Store
.
openedFiles
.
push
(
newFakeFile
);
return
newFakeFile
;
return
newFakeFile
;
}
else
{
}
this
.
removeFromOpenedFiles
(
file
);
this
.
removeFromOpenedFiles
(
file
);
return
null
;
return
null
;
}
},
},
setLoading
(
loading
,
file
)
{
setLoading
(
loading
,
file
)
{
if
(
Service
.
url
.
indexOf
(
'tree'
)
>
-
1
)
{
if
(
Service
.
url
.
indexOf
(
'tree'
)
>
-
1
)
{
Store
.
loading
.
tree
=
loading
;
Store
.
loading
.
tree
=
loading
;
}
else
if
(
Service
.
url
.
indexOf
(
'blob'
)
>
-
1
)
{
}
else
if
(
Service
.
url
.
indexOf
(
'blob'
)
>
-
1
)
{
Store
.
loading
.
blob
=
loading
;
Store
.
loading
.
blob
=
loading
;
return
this
.
toggleFakeTab
(
loading
,
file
);
return
this
.
toggleFakeTab
(
loading
,
file
);
}
}
return
undefined
;
},
},
// may be tree or file.
// may be tree or file.
<<<<<<<
HEAD
getContent
(
file
)
{
getContent
(
file
)
{
// don't load the same active file. That's silly.
// don't load the same active file. That's silly.
// if(file && file.url === this.activeFile.url) return;
// if(file && file.url === this.activeFile.url) return;
=======
getContent
(
treeOrFile
)
{
let
file
=
treeOrFile
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
const
loadingData
=
this
.
setLoading
(
true
);
const
loadingData
=
this
.
setLoading
(
true
);
Service
.
getContent
()
Service
.
getContent
()
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
le
t
data
=
response
.
data
;
cons
t
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
{
if
(
!
file
)
{
file
=
data
;
file
=
data
;
}
}
// it's a blob
// it's a blob
Store
.
binary
=
data
.
binary
;
Store
.
binary
=
data
.
binary
;
if
(
data
.
binary
)
{
if
(
data
.
binary
)
{
Store
.
binaryMimeType
=
data
.
mime_type
;
Store
.
binaryMimeType
=
data
.
mime_type
;
this
.
setBinaryDataAsBase64
(
this
.
setBinaryDataAsBase64
(
this
.
getRawURLFromBlobURL
(
file
.
url
),
this
.
getRawURLFromBlobURL
(
file
.
url
),
data
data
,
);
);
data
.
binary
=
true
;
data
.
binary
=
true
;
<<<<<<<
HEAD
}
else
{
}
else
{
Store
.
blobRaw
=
data
.
plain
;
Store
.
blobRaw
=
data
.
plain
;
=======
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
}
data
.
url
=
file
.
url
;
this
.
addToOpenedFiles
(
data
);
this
.
setActiveFile
(
data
);
}
else
{
Store
.
blobRaw
=
data
.
plain
;
if
(
!
file
.
url
)
{
file
.
url
=
location
.
pathname
;
}
data
.
url
=
file
.
url
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
data
.
binary
=
false
;
data
.
binary
=
false
;
}
}
if
(
!
file
.
url
)
{
if
(
!
file
.
url
)
{
...
@@ -220,7 +253,7 @@ let RepoHelper = {
...
@@ -220,7 +253,7 @@ let RepoHelper = {
this
.
setActiveFile
(
data
);
this
.
setActiveFile
(
data
);
// if the file tree is empty
// if the file tree is empty
if
(
Store
.
files
.
length
===
0
)
{
if
(
Store
.
files
.
length
===
0
)
{
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Service
.
url
=
parentURL
;
Service
.
url
=
parentURL
;
this
.
getContent
();
this
.
getContent
();
...
@@ -228,14 +261,14 @@ let RepoHelper = {
...
@@ -228,14 +261,14 @@ let RepoHelper = {
}
else
{
}
else
{
// it's a tree
// it's a tree
this
.
setDirectoryOpen
(
file
);
this
.
setDirectoryOpen
(
file
);
le
t
newDirectory
=
this
.
dataToListOfFiles
(
data
);
cons
t
newDirectory
=
this
.
dataToListOfFiles
(
data
);
Store
.
files
=
this
.
insertNewFilesIntoParentDir
(
file
,
Store
.
files
,
newDirectory
);
Store
.
files
=
this
.
insertNewFilesIntoParentDir
(
file
,
Store
.
files
,
newDirectory
);
Store
.
prevURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
prevURL
=
this
.
blobURLtoParent
(
Service
.
url
);
}
}
})
})
.
catch
((
response
)
=>
{
.
catch
((
)
=>
{
this
.
setLoading
(
false
,
loadingData
);
this
.
setLoading
(
false
,
loadingData
);
new
Flash
(
'Unable to load the file at this time.'
)
this
.
loadingError
();
});
});
},
},
...
@@ -243,23 +276,23 @@ let RepoHelper = {
...
@@ -243,23 +276,23 @@ let RepoHelper = {
return
`fa-
${
icon
}
`
;
return
`fa-
${
icon
}
`
;
},
},
/* eslint-disable no-param-reassign */
removeChildFilesOfTree
(
tree
)
{
removeChildFilesOfTree
(
tree
)
{
let
foundTree
=
false
;
let
foundTree
=
false
;
Store
.
files
=
Store
.
files
.
filter
((
file
)
=>
{
Store
.
files
=
Store
.
files
.
filter
((
file
)
=>
{
if
(
file
.
url
===
tree
.
url
)
{
if
(
file
.
url
===
tree
.
url
)
{
foundTree
=
true
;
foundTree
=
true
;
}
}
if
(
foundTree
)
{
if
(
foundTree
)
{
return
file
.
level
<=
tree
.
level
return
file
.
level
<=
tree
.
level
;
}
else
{
return
true
;
}
}
return
true
;
});
});
tree
.
opened
=
false
;
tree
.
opened
=
false
;
tree
.
icon
=
'fa-folder'
;
tree
.
icon
=
'fa-folder'
;
},
},
/* eslint-enable no-param-reassign */
blobToSimpleBlob
(
blob
)
{
blobToSimpleBlob
(
blob
)
{
return
{
return
{
...
@@ -269,8 +302,8 @@ let RepoHelper = {
...
@@ -269,8 +302,8 @@ let RepoHelper = {
icon
:
this
.
toFA
(
blob
.
icon
),
icon
:
this
.
toFA
(
blob
.
icon
),
lastCommitMessage
:
blob
.
last_commit
.
message
,
lastCommitMessage
:
blob
.
last_commit
.
message
,
lastCommitUpdate
:
blob
.
last_commit
.
committed_date
,
lastCommitUpdate
:
blob
.
last_commit
.
committed_date
,
level
:
0
level
:
0
,
}
}
;
},
},
treeToSimpleTree
(
tree
)
{
treeToSimpleTree
(
tree
)
{
...
@@ -279,16 +312,16 @@ let RepoHelper = {
...
@@ -279,16 +312,16 @@ let RepoHelper = {
name
:
tree
.
name
,
name
:
tree
.
name
,
url
:
tree
.
url
,
url
:
tree
.
url
,
icon
:
this
.
toFA
(
tree
.
icon
),
icon
:
this
.
toFA
(
tree
.
icon
),
level
:
0
level
:
0
,
}
}
;
},
},
dataToListOfFiles
(
data
)
{
dataToListOfFiles
(
data
)
{
le
t
a
=
[];
cons
t
a
=
[];
//push in blobs
//
push in blobs
data
.
blobs
.
forEach
((
blob
)
=>
{
data
.
blobs
.
forEach
((
blob
)
=>
{
a
.
push
(
this
.
blobToSimpleBlob
(
blob
))
a
.
push
(
this
.
blobToSimpleBlob
(
blob
))
;
});
});
data
.
trees
.
forEach
((
tree
)
=>
{
data
.
trees
.
forEach
((
tree
)
=>
{
...
@@ -301,32 +334,36 @@ let RepoHelper = {
...
@@ -301,32 +334,36 @@ let RepoHelper = {
name
:
submodule
.
name
,
name
:
submodule
.
name
,
url
:
submodule
.
url
,
url
:
submodule
.
url
,
icon
:
this
.
toFA
(
submodule
.
icon
),
icon
:
this
.
toFA
(
submodule
.
icon
),
level
:
0
level
:
0
,
})
})
;
});
});
return
a
;
return
a
;
},
},
genKey
()
{
genKey
()
{
return
this
.
Time
.
now
().
toFixed
(
3
)
return
this
.
Time
.
now
().
toFixed
(
3
)
;
},
},
_
key
:
''
,
key
:
''
,
getStateKey
()
{
getStateKey
()
{
return
this
.
_key
return
this
.
key
;
},
},
setStateKey
(
key
)
{
setStateKey
(
key
)
{
this
.
_
key
=
key
;
this
.
key
=
key
;
},
},
toURL
(
url
)
{
toURL
(
url
)
{
var
history
=
window
.
history
;
const
history
=
window
.
history
;
this
.
_key
=
this
.
genKey
();
this
.
key
=
this
.
genKey
();
history
.
pushState
({
key
:
this
.
_key
},
''
,
url
);
history
.
pushState
({
key
:
this
.
key
},
''
,
url
);
}
},
loadingError
()
{
new
Flash
(
'Unable to load the file at this time.'
);
// eslint-disable-line no-new
},
};
};
export
default
RepoHelper
;
export
default
RepoHelper
;
app/assets/javascripts/repo/repo_loading_file.js
View file @
3a2f883f
le
t
RepoLoadingFile
=
{
cons
t
RepoLoadingFile
=
{
template
:
`
template
:
`
<tr v-if='loading.tree && !hasFiles'>
<tr v-if='loading.tree && !hasFiles'>
<td>
<td>
...
@@ -22,13 +22,13 @@ let RepoLoadingFile = {
...
@@ -22,13 +22,13 @@ let RepoLoadingFile = {
methods
:
{
methods
:
{
lineOfCode
(
n
)
{
lineOfCode
(
n
)
{
return
`line-of-code-
${
n
}
`
;
return
`line-of-code-
${
n
}
`
;
}
}
,
},
},
props
:
{
props
:
{
loading
:
Object
,
loading
:
Object
,
hasFiles
:
Boolean
,
hasFiles
:
Boolean
,
isMini
:
Boolean
isMini
:
Boolean
,
}
}
,
};
};
export
default
RepoLoadingFile
;
export
default
RepoLoadingFile
;
app/assets/javascripts/repo/repo_mini_mixin.js
View file @
3a2f883f
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
le
t
RepoMiniMixin
=
{
cons
t
RepoMiniMixin
=
{
computed
:
{
computed
:
{
isMini
()
{
isMini
()
{
return
!!
Store
.
openedFiles
.
length
;
return
!!
Store
.
openedFiles
.
length
;
}
}
,
},
},
};
};
...
...
app/assets/javascripts/repo/repo_prev_directory.js
View file @
3a2f883f
le
t
RepoPreviousDirectory
=
{
cons
t
RepoPreviousDirectory
=
{
template
:
`
template
:
`
<tr>
<tr>
<td colspan='3'>
<td colspan='3'>
...
@@ -8,13 +8,13 @@ let RepoPreviousDirectory = {
...
@@ -8,13 +8,13 @@ let RepoPreviousDirectory = {
`
,
`
,
props
:
{
props
:
{
name
:
'repo-previous-directory'
,
name
:
'repo-previous-directory'
,
prevUrl
:
String
prevUrl
:
String
,
},
},
methods
:
{
methods
:
{
linkClicked
(
file
)
{
linkClicked
(
file
)
{
this
.
$emit
(
'linkclicked'
,
file
);
this
.
$emit
(
'linkclicked'
,
file
);
}
}
,
}
}
,
};
};
export
default
RepoPreviousDirectory
;
export
default
RepoPreviousDirectory
;
app/assets/javascripts/repo/repo_service.js
View file @
3a2f883f
import
axios
from
'axios'
;
import
axios
from
'axios'
;
le
t
RepoService
=
{
cons
t
RepoService
=
{
url
:
''
,
url
:
''
,
params
:
{
params
:
{
params
:
{
params
:
{
format
:
'json'
format
:
'json'
,
}
}
,
},
},
setUrl
(
url
)
{
setUrl
(
url
)
{
...
@@ -14,16 +14,16 @@ let RepoService = {
...
@@ -14,16 +14,16 @@ let RepoService = {
paramsWithRich
(
url
)
{
paramsWithRich
(
url
)
{
// copy the obj so we don't modify perm.
// copy the obj so we don't modify perm.
le
t
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
params
));
cons
t
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
params
));
if
(
url
.
substr
(
url
.
length
-
2
)
===
'md'
)
{
if
(
url
.
substr
(
url
.
length
-
2
)
===
'md'
)
{
params
.
params
.
viewer
=
'rich'
;
params
.
params
.
viewer
=
'rich'
;
}
}
return
params
;
return
params
;
},
},
getContent
(
url
)
{
getContent
(
url
)
{
if
(
url
)
{
if
(
url
)
{
return
axios
.
get
(
url
,
this
.
paramsWithRich
(
url
,
params
));
return
axios
.
get
(
url
,
this
.
paramsWithRich
(
url
,
this
.
params
));
}
}
return
axios
.
get
(
this
.
url
,
this
.
paramsWithRich
(
this
.
url
,
this
.
params
));
return
axios
.
get
(
this
.
url
,
this
.
paramsWithRich
(
this
.
url
,
this
.
params
));
},
},
...
@@ -31,10 +31,10 @@ let RepoService = {
...
@@ -31,10 +31,10 @@ let RepoService = {
getBase64Content
(
url
)
{
getBase64Content
(
url
)
{
return
axios
return
axios
.
get
(
url
,
{
.
get
(
url
,
{
responseType
:
'arraybuffer'
responseType
:
'arraybuffer'
,
})
})
.
then
(
response
=>
new
Buffer
(
response
.
data
,
'binary'
).
toString
(
'base64'
))
.
then
(
response
=>
new
Buffer
(
response
.
data
,
'binary'
).
toString
(
'base64'
))
;
}
}
,
};
};
export
default
RepoService
;
export
default
RepoService
;
app/assets/javascripts/repo/repo_sidebar.js
View file @
3a2f883f
import
Service
from
'./repo_service'
import
Vue
from
'vue'
;
import
Helper
from
'./repo_helper'
import
Service
from
'./repo_service'
;
import
Vue
from
'vue'
import
Helper
from
'./repo_helper'
;
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
import
RepoPreviousDirectory
from
'./repo_prev_directory'
import
RepoPreviousDirectory
from
'./repo_prev_directory'
;
import
RepoFileOptions
from
'./repo_file_options'
import
RepoFileOptions
from
'./repo_file_options'
;
import
RepoFile
from
'./repo_file'
import
RepoFile
from
'./repo_file'
;
import
RepoLoadingFile
from
'./repo_loading_file'
import
RepoLoadingFile
from
'./repo_loading_file'
;
import
RepoMiniMixin
from
'./repo_mini_mixin'
import
RepoMiniMixin
from
'./repo_mini_mixin'
;
export
default
class
RepoSidebar
{
export
default
class
RepoSidebar
{
constructor
(
url
)
{
constructor
(
url
)
{
...
@@ -35,31 +35,37 @@ export default class RepoSidebar {
...
@@ -35,31 +35,37 @@ export default class RepoSidebar {
methods
:
{
methods
:
{
addPopEventListener
()
{
addPopEventListener
()
{
window
.
addEventListener
(
'popstate'
,
()
=>
{
window
.
addEventListener
(
'popstate'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'#'
)
>
-
1
)
return
;
if
(
location
.
href
.
indexOf
(
'#'
)
>
-
1
)
return
;
this
.
linkClicked
({
this
.
linkClicked
({
url
:
location
.
href
url
:
location
.
href
,
});
});
});
});
},
},
linkClicked
(
file
)
{
linkClicked
(
file
)
{
let
url
=
''
;
let
url
=
''
;
if
(
typeof
file
===
'object'
)
{
if
(
typeof
file
===
'object'
)
{
if
(
file
.
type
===
'tree'
&&
file
.
opened
)
{
if
(
file
.
type
===
'tree'
&&
file
.
opened
)
{
Helper
.
removeChildFilesOfTree
(
file
);
Helper
.
removeChildFilesOfTree
(
file
);
<<<<<<<
HEAD
return
;
return
;
}
else
{
}
else
{
url
=
file
.
url
;
url
=
file
.
url
;
Service
.
url
=
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
Helper
.
getContent
(
file
);
=======
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
}
}
}
else
if
(
typeof
file
===
'string'
)
{
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
}
else
if
(
typeof
file
===
'string'
)
{
// go back
// go back
url
=
file
;
url
=
file
;
Service
.
url
=
url
;
Service
.
url
=
url
;
Helper
.
getContent
();
Helper
.
getContent
();
}
}
}
}
,
},
},
});
});
}
}
...
...
app/assets/javascripts/repo/repo_store.js
View file @
3a2f883f
le
t
RepoStore
=
{
cons
t
RepoStore
=
{
service
:
''
,
service
:
''
,
editor
:
''
,
editor
:
''
,
sidebar
:
''
,
sidebar
:
''
,
...
@@ -22,9 +22,12 @@ let RepoStore = {
...
@@ -22,9 +22,12 @@ let RepoStore = {
plain
:
''
,
plain
:
''
,
size
:
0
,
size
:
0
,
url
:
''
,
url
:
''
,
<<<<<<<
HEAD
raw
:
false
,
raw
:
false
,
newContent
:
''
,
newContent
:
''
,
changed
:
false
changed
:
false
=======
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
},
activeFileIndex
:
0
,
activeFileIndex
:
0
,
activeLine
:
0
,
activeLine
:
0
,
...
@@ -32,15 +35,15 @@ let RepoStore = {
...
@@ -32,15 +35,15 @@ let RepoStore = {
files
:
[],
files
:
[],
binary
:
false
,
binary
:
false
,
binaryMimeType
:
''
,
binaryMimeType
:
''
,
//scroll bar space for windows
//
scroll bar space for windows
scrollWidth
:
0
,
scrollWidth
:
0
,
binaryTypes
:
{
binaryTypes
:
{
png
:
false
,
png
:
false
,
markdown
:
false
markdown
:
false
,
},
},
loading
:
{
loading
:
{
tree
:
false
,
tree
:
false
,
blob
:
false
blob
:
false
,
}
}
,
};
};
export
default
RepoStore
;
export
default
RepoStore
;
app/assets/javascripts/repo/repo_tab.js
View file @
3a2f883f
import
RepoHelper
from
'./repo_helper'
import
RepoHelper
from
'./repo_helper'
;
le
t
RepoTab
=
{
cons
t
RepoTab
=
{
template
:
`
template
:
`
<li>
<li>
<a href='#' @click.prevent='xClicked(tab)' v-if='!tab.loading'>
<a href='#' @click.prevent='xClicked(tab)' v-if='!tab.loading'>
...
@@ -34,7 +34,7 @@ let RepoTab = {
...
@@ -34,7 +34,7 @@ let RepoTab = {
xClicked
(
file
)
{
xClicked
(
file
)
{
if
(
file
.
changed
)
return
;
if
(
file
.
changed
)
return
;
RepoHelper
.
removeFromOpenedFiles
(
file
);
RepoHelper
.
removeFromOpenedFiles
(
file
);
}
}
,
}
}
,
};
};
export
default
RepoTab
;
export
default
RepoTab
;
app/assets/javascripts/repo/repo_tabs.js
View file @
3a2f883f
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
import
RepoTab
from
'./repo_tab'
import
RepoTab
from
'./repo_tab'
;
import
RepoMiniMixin
from
'./repo_mini_mixin'
import
RepoMiniMixin
from
'./repo_mini_mixin'
;
export
default
class
RepoTabs
{
export
default
class
RepoTabs
{
constructor
()
{
constructor
()
{
thi
s
.
styleTabsForWindows
();
RepoTab
s
.
styleTabsForWindows
();
this
.
initVue
();
this
.
initVue
();
}
}
...
@@ -20,7 +20,7 @@ export default class RepoTabs {
...
@@ -20,7 +20,7 @@ export default class RepoTabs {
});
});
}
}
styleTabsForWindows
()
{
st
atic
st
yleTabsForWindows
()
{
const
scrollWidth
=
Number
(
document
.
body
.
dataset
.
scrollWidth
);
const
scrollWidth
=
Number
(
document
.
body
.
dataset
.
scrollWidth
);
Store
.
scrollWidth
=
scrollWidth
;
Store
.
scrollWidth
=
scrollWidth
;
}
}
...
...
app/assets/javascripts/repo/repo_view_toggler.js
0 → 100644
View file @
3a2f883f
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
;
export
default
class
RepoViewToggler
{
constructor
()
{
this
.
initVue
();
}
initVue
()
{
this
.
vue
=
new
Vue
({
el
:
'#view-toggler'
,
data
:
()
=>
Store
,
});
}
}
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