Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Younès EL BIACHE
2016-07-07 19:42:21 +0200
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
9537e2ae9572f75edc8da7fb23572346c56f101d
9537e2ae
1 parent
10418323
html diff in revision view
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
3 deletions
app/Http/Controllers/PageController.php
app/PageRevision.php
composer.json
composer.lock
resources/assets/sass/_pages.scss
resources/views/pages/page-display.blade.php
app/Http/Controllers/PageController.php
View file @
9537e2a
...
...
@@ -12,6 +12,7 @@ use BookStack\Repos\ChapterRepo;
use
BookStack\Repos\PageRepo
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Views
;
use
Icap\HtmlDiff\HtmlDiff
;
class
PageController
extends
Controller
{
...
...
@@ -332,9 +333,19 @@ class PageController extends Controller
$book
=
$this
->
bookRepo
->
getBySlug
(
$bookSlug
);
$page
=
$this
->
pageRepo
->
getBySlug
(
$pageSlug
,
$book
->
id
);
$revision
=
$this
->
pageRepo
->
getRevisionById
(
$revisionId
);
$next
=
$revision
->
getNext
()
?:
$page
;
$htmlDiff
=
new
HtmlDiff
(
$revision
->
html
,
$next
->
html
,
true
);
$diff
=
$htmlDiff
->
outputDiff
()
->
toString
();
$page
->
fill
(
$revision
->
toArray
());
$this
->
setPageTitle
(
'Page Revision For '
.
$page
->
getShortName
());
return
view
(
'pages/revision'
,
[
'page'
=>
$page
,
'book'
=>
$book
]);
return
view
(
'pages/revision'
,
[
'page'
=>
$page
,
'book'
=>
$book
,
'diff'
=>
$diff
,
]);
}
/**
...
...
app/PageRevision.php
View file @
9537e2a
...
...
@@ -32,4 +32,25 @@ class PageRevision extends Model
return
$this
->
page
->
getUrl
()
.
'/revisions/'
.
$this
->
id
;
}
/**
* Get previous revision
* @return \BookStack\PageRevision
*/
public
function
getPrevious
()
{
if
(
$id
=
PageRevision
::
where
(
'id'
,
'<'
,
$this
->
id
)
->
max
(
'id'
))
{
return
PageRevision
::
find
(
$id
);
}
}
/**
* Get next revision
* @return \BookStack\PageRevision
*/
public
function
getNext
()
{
if
(
$id
=
PageRevision
::
where
(
'id'
,
'>'
,
$this
->
id
)
->
min
(
'id'
))
{
return
PageRevision
::
find
(
$id
);
}
}
}
...
...
composer.json
View file @
9537e2a
...
...
@@ -13,7 +13,8 @@
"barryvdh/laravel-debugbar"
:
"^2.0"
,
"league/flysystem-aws-s3-v3"
:
"^1.0"
,
"barryvdh/laravel-dompdf"
:
"0.6.*"
,
"predis/predis"
:
"^1.0"
"predis/predis"
:
"^1.0"
,
"icap/html-diff"
:
"^1.1"
},
"require-dev"
:
{
"fzaninotto/faker"
:
"~1.4"
,
...
...
composer.lock
View file @
9537e2a
This diff is collapsed.
Click to expand it.
resources/assets/sass/_pages.scss
100644 → 100755
View file @
9537e2a
...
...
@@ -60,6 +60,18 @@
word-break
:
break-word
;
hyphens
:
auto
;
}
// diffs
.diff-html-removed
,
.diff-html-added
{
text-decoration
:
none
;
}
.diff-html-added
{
background
:
rgba
(
45
,
255
,
0
,
0
.2
);
}
.diff-html-removed
{
background
:
rgba
(
255
,
0
,
0
,
0
.2
);
}
}
// Page content pointers
...
...
resources/views/pages/page-display.blade.php
View file @
9537e2a
...
...
@@ -18,5 +18,9 @@
<div
style=
"clear:left;"
></div>
{!! $page->html !!}
@if (isset($diff)
&&
$diff)
{!! $diff !!}
@else
{!! $page->html !!}
@endif
</div>
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment