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
0d3e10ed
Commit
0d3e10ed
authored
Apr 23, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: All Pages directory handling
parent
f44d0a3c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
all.js
client/js/pages/all.js
+5
-0
entries.js
libs/entries.js
+13
-2
all.pug
views/pages/all.pug
+6
-2
No files found.
client/js/pages/all.js
View file @
0d3e10ed
...
...
@@ -4,6 +4,8 @@ import $ from 'jquery'
import
Vue
from
'vue'
import
_
from
'lodash'
const
rootUrl
=
'/'
module
.
exports
=
(
alerts
,
socket
)
=>
{
if
(
$
(
'#page-type-all'
).
length
)
{
let
vueAllPages
=
new
Vue
({
// eslint-disable-line no-unused-vars
...
...
@@ -29,6 +31,9 @@ module.exports = (alerts, socket) => {
$
(
'#notifload'
).
removeClass
(
'active'
)
})
})
},
goto
:
function
(
entryPath
)
{
window
.
location
.
assign
(
rootUrl
+
entryPath
)
}
},
mounted
:
function
()
{
...
...
libs/entries.js
View file @
0d3e10ed
...
...
@@ -301,7 +301,7 @@ module.exports = {
winston.error(err)
return err
}).then((content) => {
// let entryPaths = _.split(content.entryPath, '
/
'
)
let parentPath = _.chain(content.entryPath).split('
/
').initial().join('
/
').value(
)
return db.Entry.findOneAndUpdate({
_id: content.entryPath
}, {
...
...
@@ -309,11 +309,22 @@ module.exports = {
title: content.meta.title || content.entryPath,
subtitle: content.meta.subtitle || '',
parentTitle: content.parent.title || '',
parentPath: content.parent.path || ''
parentPath: parentPath,
isDirectory: false
}, {
new: true,
upsert: true
})
}).then(result => {
return db.Entry.distinct('
parentPath
', { parentPath: { $ne: '' } }).then(allPaths => {
if (allPaths.length > 0) {
return db.Entry.updateMany({ _id: { $in: allPaths } }, { $set: { isDirectory: true } }).then(() => {
return result
})
} else {
return result
}
})
}).catch(err => {
winston.error(err)
return err
...
...
views/pages/all.pug
View file @
0d3e10ed
...
...
@@ -28,6 +28,10 @@ block content
span Login
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 }')
a(v-on:click='(page.isDirectory) ? fetch(page._id) : goto(page._id)')
template(v-if='page._id !== "home"')
i(:class='{ "icon-folder2": page.isDirectory, "icon-file-text-o": !page.isDirectory }')
span {{ page.title }}
template(v-else)
i.icon-home
span Home
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