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
1d8285fb
Commit
1d8285fb
authored
Apr 17, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on All Pages section
parent
d02b4a35
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
102 additions
and
106 deletions
+102
-106
launch.json
.vscode/launch.json
+28
-0
all.js
client/js/pages/all.js
+31
-1
pages.js
controllers/pages.js
+2
-10
ws.js
controllers/ws.js
+13
-0
fuse.js
fuse.js
+7
-2
entries.js
libs/entries.js
+4
-3
entry.js
models/entry.js
+7
-6
all.pug
views/pages/all.pug
+5
-84
wiki.js
wiki.js
+5
-0
No files found.
.vscode/launch.json
0 → 100644
View file @
1d8285fb
{
//
Use
IntelliSense
to
learn
about
possible
Node.js
debug
attributes.
//
Hover
to
view
descriptions
of
existing
attributes.
//
For
more
information
,
visit
:
https
:
//go.microsoft.com/fwlink/?linkid=
830387
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"type"
:
"node"
,
"request"
:
"attach"
,
"name"
:
"Attach (Inspector Protocol)"
,
"port"
:
9229
,
"protocol"
:
"inspector"
},
{
"type"
:
"node"
,
"request"
:
"launch"
,
"name"
:
"Launch Program"
,
"program"
:
"${workspaceRoot}
\\
server.js"
},
{
"type"
:
"node"
,
"request"
:
"attach"
,
"name"
:
"Attach to Port"
,
"address"
:
"localhost"
,
"port"
:
9222
}
]
}
client/js/pages/all.js
View file @
1d8285fb
'use strict'
import
$
from
'jquery'
import
Vue
from
'vue'
import
_
from
'lodash'
module
.
exports
=
(
alerts
,
socket
)
=>
{
if
(
$
(
'#page-type-all'
).
length
)
{
let
vueAllPages
=
new
Vue
({
// eslint-disable-line no-unused-vars
el
:
'#page-type-all'
,
data
:
{
tree
:
[]
},
methods
:
{
fetch
:
function
(
basePath
)
{
let
self
=
this
$
(
'#notifload'
).
addClass
(
'active'
)
Vue
.
nextTick
(()
=>
{
socket
.
emit
(
'treeFetch'
,
{
basePath
},
(
data
)
=>
{
if
(
self
.
tree
.
length
>
0
)
{
let
curTree
=
_
.
last
(
self
.
tree
)
curTree
.
hasChildren
=
true
_
.
find
(
curTree
.
pages
,
{
_id
:
basePath
}).
isActive
=
true
}
self
.
tree
.
push
({
hasChildren
:
false
,
pages
:
data
})
$
(
'#notifload'
).
removeClass
(
'active'
)
})
})
}
},
mounted
:
function
()
{
this
.
fetch
(
''
)
}
})
}
}
controllers/pages.js
View file @
1d8285fb
...
...
@@ -135,18 +135,10 @@ router.put('/create/*', (req, res, next) => {
// ==========================================
/**
* View
list
view of all pages
* View
tree
view of all pages
*/
router
.
get
(
'/all'
,
(
req
,
res
,
next
)
=>
{
entries
.
getFromTree
(
'/'
).
then
((
pageData
)
=>
{
res
.
render
(
'pages/all'
,
{
pageData
})
return
true
}).
catch
((
err
)
=>
{
res
.
render
(
'error'
,
{
message
:
err
.
message
,
error
:
{}
})
})
res
.
render
(
'pages/all'
)
})
// ==========================================
...
...
controllers/ws.js
View file @
1d8285fb
...
...
@@ -19,6 +19,19 @@ module.exports = (socket) => {
}
// -----------------------------------------
// TREE VIEW (LIST ALL PAGES)
// -----------------------------------------
if
(
socket
.
request
.
user
.
logged_in
)
{
socket
.
on
(
'treeFetch'
,
(
data
,
cb
)
=>
{
cb
=
cb
||
_
.
noop
entries
.
getFromTree
(
data
.
basePath
).
then
((
f
)
=>
{
return
cb
(
f
)
||
true
})
})
}
// -----------------------------------------
// UPLOADS
// -----------------------------------------
...
...
fuse.js
View file @
1d8285fb
...
...
@@ -30,6 +30,12 @@ const args = require('yargs')
describe
:
'Start in Configure Developer mode'
,
type
:
'boolean'
})
.
option
(
'i'
,
{
alias
:
'inspect'
,
describe
:
'Enable Inspector for debugging'
,
type
:
'boolean'
,
implies
:
'd'
})
.
help
(
'h'
)
.
alias
(
'h'
,
'help'
)
.
argv
...
...
@@ -204,8 +210,7 @@ globalTasks.then(() => {
_
.
delay
(()
=>
{
nodemon
({
script
:
'./server.js'
,
args
:
[],
exec
:
(
args
.
i
)
?
'node --inspect server'
:
'node server'
,
ignore
:
[
'assets/'
,
'client/'
,
'data/'
,
'repo/'
,
'tests/'
],
ext
:
'js json'
,
watch
:
[
...
...
libs/entries.js
View file @
1d8285fb
...
...
@@ -272,7 +272,7 @@ module.exports = {
},
/**
* Update local cache
and search index
* Update local cache
*
* @param {String} entryPath The entry path
* @return {Promise} Promise of the operation
...
...
@@ -301,13 +301,14 @@ module.exports = {
winston.error(err)
return err
}).then((content) => {
// let entryPaths = _.split(content.entryPath, '
/
')
return db.Entry.findOneAndUpdate({
_id: content.entryPath
}, {
_id: content.entryPath,
title: content.meta.title || content.entryPath,
subtitle: content.meta.subtitle || '',
parent: content.parent.title || '',
parent
Title
: content.parent.title || '',
parentPath: content.parent.path || ''
}, {
new: true,
...
...
@@ -416,6 +417,6 @@ module.exports = {
* @return {Promise<Array>} List of entries
*/
getFromTree (basePath) {
return
Promise.resolve([]
)
return
db.Entry.find({ parentPath: basePath }
)
}
}
models/entry.js
View file @
1d8285fb
...
...
@@ -6,7 +6,6 @@
* @type {<Mongoose.Schema>}
*/
var
entrySchema
=
Mongoose
.
Schema
({
_id
:
String
,
title
:
{
...
...
@@ -18,18 +17,20 @@ var entrySchema = Mongoose.Schema({
type
:
String
,
default
:
''
},
parent
:
{
parent
Title
:
{
type
:
String
,
default
:
''
},
parentPath
:
{
type
:
String
,
default
:
''
},
isDirectory
:
{
type
:
Boolean
,
default
:
false
}
},
{
},
{
timestamps
:
{}
})
})
module
.
exports
=
Mongoose
.
model
(
'Entry'
,
entrySchema
)
views/pages/all.pug
View file @
1d8285fb
...
...
@@ -26,87 +26,8 @@ block content
a(href='/login')
i.icon-unlock
span Login
ul.collapsable-nav.has-children
li: a
i.icon-file
span Page 1
li: a
i.icon-file
span Page 2
li: a
i.icon-file
span Page 3
li.is-active: a
i.icon-folder2
span Page 4
li: a
i.icon-file
span Page 5
ul.collapsable-nav.has-children
li.is-title page-4
li: a
i.icon-file
span Page 1
li.is-active: a
i.icon-file
span Page 2
li: a
i.icon-file
span Page 3
li: a
i.icon-file
span Page 4
li: a
i.icon-file
span Page 5
ul.collapsable-nav.has-children
li.is-title page-4
li: a
i.icon-file
span Page 1
li.is-active: a
i.icon-file
span Page 2
li: a
i.icon-file
span Page 3
li: a
i.icon-file
span Page 4
li: a
i.icon-file
span Page 5
ul.collapsable-nav.has-children
li.is-title page-4
li: a
i.icon-file
span Page 1
li.is-active: a
i.icon-file
span Page 2
li: a
i.icon-file
span Page 3
li: a
i.icon-file
span Page 4
li: a
i.icon-file
span Page 5
ul.collapsable-nav
li.is-title Sub-Pages
li: a
i.icon-file
span Page 1
li: a
i.icon-file
span Page 2
li: a
i.icon-file
span Page 3
li: a
i.icon-file
span Page 4
li: a
i.icon-file
span Page 5
ul.collapsable-nav(v-for='treeItem in tree', :class='{ "has-children": treeItem.hasChildren }', v-cloak)
li(v-for='page in treeItem.pages', :class='{ "is-active": page.isActive }')
a(v-on:click='fetch(page._id)')
i(:class='{ "icon-folder2": page.isFolder, "icon-file": !page.isFolder }')
span {{ page.title }}
wiki.js
View file @
1d8285fb
...
...
@@ -21,6 +21,10 @@ cmdr.version(packageObj.version)
cmdr
.
command
(
'start'
)
.
description
(
'Start Wiki.js process'
)
.
action
(()
=>
{
if
(
process
.
env
.
HEROKU
)
{
console
.
info
(
'Initializing Wiki.js for Heroku...'
)
// todo
}
else
{
let
spinner
=
ora
(
'Initializing...'
).
start
()
fs
.
emptyDirAsync
(
path
.
join
(
__dirname
,
'./logs'
)).
then
(()
=>
{
return
pm2
.
connectAsync
().
then
(()
=>
{
...
...
@@ -42,6 +46,7 @@ cmdr.command('start')
spinner
.
fail
(
err
)
process
.
exit
(
1
)
})
}
})
cmdr
.
command
(
'stop'
)
...
...
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