Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
45d94e7e
You need to sign in or sign up before continuing.
Commit
45d94e7e
authored
May 21, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: Source view Vue component
parent
bf6eae14
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
125 deletions
+12
-125
app.js
client/js/app.js
+2
-0
alerts.js
client/js/components/alerts.js
+0
-112
source.component.js
client/js/pages/source.component.js
+7
-10
_editor.scss
client/scss/components/_editor.scss
+1
-1
source.pug
server/views/pages/source.pug
+2
-2
No files found.
client/js/app.js
View file @
45d94e7e
...
@@ -29,6 +29,7 @@ import adminUsersCreateComponent from './modals/admin-users-create.vue'
...
@@ -29,6 +29,7 @@ import adminUsersCreateComponent from './modals/admin-users-create.vue'
import
adminProfileComponent
from
'./pages/admin-profile.component.js'
import
adminProfileComponent
from
'./pages/admin-profile.component.js'
import
adminSettingsComponent
from
'./pages/admin-settings.component.js'
import
adminSettingsComponent
from
'./pages/admin-settings.component.js'
import
sourceComponent
from
'./pages/source.component.js'
// ====================================
// ====================================
// Initialize Vue Modules
// Initialize Vue Modules
...
@@ -83,6 +84,7 @@ $(() => {
...
@@ -83,6 +84,7 @@ $(() => {
colorPicker
:
colorPickerComponent
,
colorPicker
:
colorPickerComponent
,
loadingSpinner
:
loadingSpinnerComponent
,
loadingSpinner
:
loadingSpinnerComponent
,
search
:
searchComponent
,
search
:
searchComponent
,
sourceView
:
sourceComponent
,
tree
:
treeComponent
tree
:
treeComponent
},
},
store
,
store
,
...
...
client/js/components/alerts.js
deleted
100644 → 0
View file @
bf6eae14
'use strict'
import
Vue
from
'vue'
import
_
from
'lodash'
/**
* Alerts
*/
class
Alerts
{
/**
* Constructor
*
* @class
*/
constructor
()
{
let
self
=
this
self
.
mdl
=
new
Vue
({
el
:
'#alerts'
,
data
:
{
children
:
[]
},
methods
:
{
acknowledge
:
(
uid
)
=>
{
self
.
close
(
uid
)
}
}
})
self
.
uidNext
=
1
}
/**
* Show a new Alert
*
* @param {Object} options Alert properties
* @return {null} Void
*/
push
(
options
)
{
let
self
=
this
let
nAlert
=
_
.
defaults
(
options
,
{
_uid
:
self
.
uidNext
,
class
:
'info'
,
message
:
'---'
,
sticky
:
false
,
title
:
'---'
})
self
.
mdl
.
children
.
push
(
nAlert
)
if
(
!
nAlert
.
sticky
)
{
_
.
delay
(()
=>
{
self
.
close
(
nAlert
.
_uid
)
},
5000
)
}
self
.
uidNext
++
}
/**
* Shorthand method for pushing errors
*
* @param {String} title The title
* @param {String} message The message
*/
pushError
(
title
,
message
)
{
this
.
push
({
class
:
'error'
,
message
,
sticky
:
false
,
title
})
}
/**
* Shorthand method for pushing success messages
*
* @param {String} title The title
* @param {String} message The message
*/
pushSuccess
(
title
,
message
)
{
this
.
push
({
class
:
'success'
,
message
,
sticky
:
false
,
title
})
}
/**
* Close an alert
*
* @param {Integer} uid The unique ID of the alert
*/
close
(
uid
)
{
let
self
=
this
let
nAlertIdx
=
_
.
findIndex
(
self
.
mdl
.
children
,
[
'_uid'
,
uid
])
let
nAlert
=
_
.
nth
(
self
.
mdl
.
children
,
nAlertIdx
)
if
(
nAlertIdx
>=
0
&&
nAlert
)
{
nAlert
.
class
+=
' exit'
Vue
.
set
(
self
.
mdl
.
children
,
nAlertIdx
,
nAlert
)
_
.
delay
(()
=>
{
self
.
mdl
.
children
.
splice
(
nAlertIdx
,
1
)
},
500
)
}
}
}
export
default
Alerts
client/js/pages/source.js
→
client/js/pages/source.
component.
js
View file @
45d94e7e
'use strict'
'use strict'
import
$
from
'jquery'
import
*
as
ace
from
'brace'
import
*
as
ace
from
'brace'
import
'brace/theme/tomorrow_night'
import
'brace/theme/tomorrow_night'
import
'brace/mode/markdown'
import
'brace/mode/markdown'
import
pageLoader
from
'../components/page-loader'
import
pageLoader
from
'../components/page-loader'
module
.
exports
=
(
alerts
)
=>
{
export
default
{
if
(
$
(
'#page-type-source'
).
length
)
{
name
:
'source-view'
,
var
scEditor
=
ace
.
edit
(
'source-display'
)
data
()
{
return
{}
},
mounted
()
{
let
scEditor
=
ace
.
edit
(
'source-display'
)
scEditor
.
setTheme
(
'ace/theme/tomorrow_night'
)
scEditor
.
setTheme
(
'ace/theme/tomorrow_night'
)
scEditor
.
getSession
().
setMode
(
'ace/mode/markdown'
)
scEditor
.
getSession
().
setMode
(
'ace/mode/markdown'
)
scEditor
.
setOption
(
'fontSize'
,
'14px'
)
scEditor
.
setOption
(
'fontSize'
,
'14px'
)
...
@@ -16,12 +19,6 @@ module.exports = (alerts) => {
...
@@ -16,12 +19,6 @@ module.exports = (alerts) => {
scEditor
.
setOption
(
'wrap'
,
true
)
scEditor
.
setOption
(
'wrap'
,
true
)
scEditor
.
setReadOnly
(
true
)
scEditor
.
setReadOnly
(
true
)
scEditor
.
renderer
.
updateFull
()
scEditor
.
renderer
.
updateFull
()
let
currentBasePath
=
(
$
(
'#page-type-source'
).
data
(
'entrypath'
)
!==
'home'
)
?
$
(
'#page-type-source'
).
data
(
'entrypath'
)
:
''
require
(
'../modals/create.js'
)(
currentBasePath
)
require
(
'../modals/move.js'
)(
currentBasePath
,
alerts
)
scEditor
.
renderer
.
on
(
'afterRender'
,
()
=>
{
scEditor
.
renderer
.
on
(
'afterRender'
,
()
=>
{
pageLoader
.
complete
()
pageLoader
.
complete
()
})
})
...
...
client/scss/components/_editor.scss
View file @
45d94e7e
...
@@ -347,7 +347,7 @@
...
@@ -347,7 +347,7 @@
height: 100%;
height: 100%;
}*/
}*/
#page-type-source
.ace-container
{
main
>
.ace-container
{
min-height
:
95vh
;
min-height
:
95vh
;
}
}
...
...
server/views/pages/source.pug
View file @
45d94e7e
...
@@ -4,7 +4,7 @@ block rootNavCenter
...
@@ -4,7 +4,7 @@ block rootNavCenter
h2.nav-item= pageData.meta.title
h2.nav-item= pageData.meta.title
block rootNavRight
block rootNavRight
i.nav-item#notifload
loading-spinner
span.nav-item
span.nav-item
if rights.write
if rights.write
a.button.is-outlined.btn-move-prompt.is-hidden
a.button.is-outlined.btn-move-prompt.is-hidden
...
@@ -23,7 +23,7 @@ block rootNavRight
...
@@ -23,7 +23,7 @@ block rootNavRight
block content
block content
#page-type-source(
data-entrypath=pageData.meta.path)
source-view(inline-template,
data-entrypath=pageData.meta.path)
.ace-container
.ace-container
#source-display= pageData.markdown
#source-display= pageData.markdown
...
...
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