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
fa1f3320
Commit
fa1f3320
authored
Jul 04, 2017
by
NGPixel
Committed by
Nicolas Giard
Jul 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: History - versions data
parent
43f9a104
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
38 deletions
+68
-38
history.vue
client/js/components/history.vue
+50
-16
history.scss
client/scss/components/history.scss
+13
-5
git.js
server/libs/git.js
+4
-0
history.pug
server/views/pages/history.pug
+1
-17
No files found.
client/js/components/history.vue
View file @
fa1f3320
<
template
lang=
"pug"
>
<
template
lang=
"pug"
>
.history
.container.is-fluid
.history-title
{{
currentPath
}}
.columns.is-gapless
.history-info
.columns
.column.is-narrow.is-hidden-touch.sidebar
.column
aside.stickyscroll
p Timestamp: #[strong 2017/07/02 5:19 PM]
.sidebar-label
p Author: #[strong Nicolas Giard]
span
{{
$t
(
'sidebar.pastversions'
)
}}
p Commit: #[strong 379ff16957b2b7f978e02bfe50cd0cee182fcb8a]
ul.sidebar-menu
.column.history-info-actions
li(v-for='item in versions')
.button-group
a.is-multiline(:title='item.dateFull')
button.button.is-blue-grey() Compare With...
span
{{
item
.
dateCalendar
}}
button.button.is-blue-grey() Revert to version
span.is-small
{{
item
.
commitAbbr
}}
toggle.is-dark(v-model='sidebyside', desc='Side-by-side View')
.history-diff#diff
.column
.history
.history-title
{{
currentPath
}}
.history-info
.columns
.column.history-info-meta
p
i.nc-icon-outline.ui-1_calendar-check-62
span Timestamp: #[strong 2017/07/02 5:19 PM]
p
i.nc-icon-outline.i.nc-icon-outline.users_man-23
span Author: #[strong Nicolas Giard]
p
i.nc-icon-outline.media-1_flash-21
span Commit: #[strong 379ff16957b2b7f978e02bfe50cd0cee182fcb8a]
.column.history-info-actions
.button-group
button.button.is-blue-grey()
i.nc-icon-outline.design_path-intersect
span Compare With...
button.button.is-blue-grey()
i.nc-icon-outline.ui-1_eye-17
span View
button.button.is-blue-grey()
i.nc-icon-outline.arrows-4_undo-29
span Revert to version
toggle.is-dark(v-model='sidebyside', desc='Side-by-side View')
.history-diff#diff
</
template
>
</
template
>
...
@@ -20,24 +47,31 @@
...
@@ -20,24 +47,31 @@
let
diffui
let
diffui
export
default
{
export
default
{
name
:
'history'
,
name
:
'history'
,
props
:
[
'currentPath'
],
props
:
[
'currentPath'
,
'historyData'
],
data
()
{
data
()
{
return
{
return
{
versions
:
[],
diffui
:
{},
diffui
:
{},
sidebyside
:
true
sidebyside
:
true
}
}
},
},
watch
:
{
sidebyside
()
{
this
.
draw
()
}
},
methods
:
{
methods
:
{
draw
()
{
draw
()
{
diffui
.
draw
(
'#diff'
,
{
diffui
.
draw
(
'#diff'
,
{
inputFormat
:
'json'
,
inputFormat
:
'json'
,
outputFormat
:
'side-by-sid
e'
,
outputFormat
:
this
.
sidebyside
?
'side-by-side'
:
'line-by-lin
e'
,
matching
:
'words'
,
matching
:
'words'
,
synchronisedScroll
:
true
synchronisedScroll
:
true
})
})
}
}
},
},
mounted
()
{
mounted
()
{
this
.
versions
=
JSON
.
parse
(
this
.
historyData
)
diffui
=
new
Diff2HtmlUI
({
diffui
=
new
Diff2HtmlUI
({
diff
:
`diff --git a/wiki/prerequisites.md b/wiki/prerequisites.md
diff
:
`diff --git a/wiki/prerequisites.md b/wiki/prerequisites.md
index 89a10de..4bc0d66 100644
index 89a10de..4bc0d66 100644
...
...
client/scss/components/history.scss
View file @
fa1f3320
...
@@ -14,12 +14,20 @@
...
@@ -14,12 +14,20 @@
&
-info
{
&
-info
{
background-color
:
mc
(
'blue-grey'
,
'50'
);
background-color
:
mc
(
'blue-grey'
,
'50'
);
padding
:
5px
1
5
px
;
padding
:
5px
1
0
px
;
p
{
&
-meta
{
padding
:
5px
0
;
i
{
font-size
:
14px
;
margin-right
:
8px
;
color
:
mc
(
'blue-grey'
,
'800'
);
}
p
{
padding
:
5px
0
;
font-size
:
14px
;
color
:
mc
(
'blue-grey'
,
'800'
);
display
:
flex
;
align-items
:
center
;
}
}
}
&
-actions
{
&
-actions
{
...
...
server/libs/git.js
View file @
fa1f3320
...
@@ -8,6 +8,7 @@ const path = require('path')
...
@@ -8,6 +8,7 @@ const path = require('path')
const
fs
=
Promise
.
promisifyAll
(
require
(
'fs-extra'
))
const
fs
=
Promise
.
promisifyAll
(
require
(
'fs-extra'
))
const
_
=
require
(
'lodash'
)
const
_
=
require
(
'lodash'
)
const
URL
=
require
(
'url'
)
const
URL
=
require
(
'url'
)
const
moment
=
require
(
'moment'
)
const
securityHelper
=
require
(
'../helpers/security'
)
const
securityHelper
=
require
(
'../helpers/security'
)
...
@@ -272,10 +273,13 @@ module.exports = {
...
@@ -272,10 +273,13 @@ module.exports = {
}
}
let
hist
=
_
.
chain
(
out
).
split
(
'
\
n'
).
map
(
h
=>
{
let
hist
=
_
.
chain
(
out
).
split
(
'
\
n'
).
map
(
h
=>
{
let
hParts
=
h
.
split
(
' '
,
4
)
let
hParts
=
h
.
split
(
' '
,
4
)
let
hDate
=
moment
(
hParts
[
2
])
return
{
return
{
commit
:
hParts
[
0
],
commit
:
hParts
[
0
],
commitAbbr
:
hParts
[
1
],
commitAbbr
:
hParts
[
1
],
date
:
hParts
[
2
],
date
:
hParts
[
2
],
dateFull
:
hDate
.
format
(
'LLLL'
),
dateCalendar
:
hDate
.
calendar
(
null
,
{
sameElse
:
'llll'
}),
email
:
hParts
[
3
],
email
:
hParts
[
3
],
name
:
hParts
[
4
]
name
:
hParts
[
4
]
}
}
...
...
server/views/pages/history.pug
View file @
fa1f3320
...
@@ -8,20 +8,4 @@ block rootNavRight
...
@@ -8,20 +8,4 @@ block rootNavRight
span= t('nav.viewlatest')
span= t('nav.viewlatest')
block content
block content
.container.is-fluid
history(current-path=pageData.meta._id, history-data=JSON.stringify(pageData.history))
.columns.is-gapless
.column.is-narrow.is-hidden-touch.sidebar
aside.stickyscroll
.sidebar-label
span= t('sidebar.pastversions')
ul.sidebar-menu
each item, index in pageData.history
- var itemDate = moment(item.date)
li: a.is-multiline(class={ 'is-active': index < 1 }, href='', title=itemDate.format('LLLL'))
span= itemDate.calendar(null, { sameElse: 'llll'})
span.is-small= item.commitAbbr
.column
history(current-path=pageData.meta._id)
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