mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-19 08:32:45 +08:00
Merge branch 'diff' of git://github.com/younes0/BookStack into younes0-diff
This commit is contained in:
commit
fff5bbcee4
|
@ -12,6 +12,7 @@ use BookStack\Repos\ChapterRepo;
|
|||
use BookStack\Repos\PageRepo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Views;
|
||||
use GatherContent\Htmldiff\Htmldiff;
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
|
@ -335,9 +336,18 @@ 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;
|
||||
$diff = (new Htmldiff)->diff($revision->html, $next->html);
|
||||
|
||||
$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,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
"require": {
|
||||
"php": ">=5.6.4",
|
||||
"laravel/framework": "^5.3.4",
|
||||
"ext-tidy": "*",
|
||||
"intervention/image": "^2.3",
|
||||
"laravel/socialite": "^2.0",
|
||||
"barryvdh/laravel-ide-helper": "^2.1",
|
||||
"barryvdh/laravel-debugbar": "^2.2.3",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"barryvdh/laravel-dompdf": "^0.7",
|
||||
"predis/predis": "^1.1"
|
||||
"predis/predis": "^1.1",
|
||||
"gathercontent/htmldiff": "^0.2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
|
|
218
composer.lock
generated
218
composer.lock
generated
|
@ -4,21 +4,21 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "c90a6e41767306ceb3b8cedb91468390",
|
||||
"content-hash": "3b5d2d6b77fbe71101e7e8eaff0754fe",
|
||||
"hash": "3124d900cfe857392a94de479f3ff6d4",
|
||||
"content-hash": "a968767a73f77e66e865c276cf76eedf",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.19.6",
|
||||
"version": "3.19.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "34060bf0db260031697b17dbb37fa1bbec92f1c4"
|
||||
"reference": "19bac3bdd7988cbf7f89d5ce8e2748d774e2cde8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/34060bf0db260031697b17dbb37fa1bbec92f1c4",
|
||||
"reference": "34060bf0db260031697b17dbb37fa1bbec92f1c4",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/19bac3bdd7988cbf7f89d5ce8e2748d774e2cde8",
|
||||
"reference": "19bac3bdd7988cbf7f89d5ce8e2748d774e2cde8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -85,32 +85,32 @@
|
|||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2016-09-08 20:27:15"
|
||||
"time": "2016-09-27 19:38:36"
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/laravel-debugbar",
|
||||
"version": "V2.2.3",
|
||||
"version": "v2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd"
|
||||
"reference": "0c87981df959c7c1943abe227baf607c92f204f9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
||||
"reference": "ecd1ce5c4a827e2f6a8fb41bcf67713beb1c1cbd",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/0c87981df959c7c1943abe227baf607c92f204f9",
|
||||
"reference": "0c87981df959c7c1943abe227baf607c92f204f9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "5.1.*|5.2.*|5.3.*",
|
||||
"maximebf/debugbar": "~1.11.0|~1.12.0",
|
||||
"maximebf/debugbar": "~1.13.0",
|
||||
"php": ">=5.5.9",
|
||||
"symfony/finder": "~2.7|~3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
"dev-master": "2.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -139,7 +139,7 @@
|
|||
"profiler",
|
||||
"webprofiler"
|
||||
],
|
||||
"time": "2016-07-29 15:00:36"
|
||||
"time": "2016-09-15 14:05:56"
|
||||
},
|
||||
{
|
||||
"name": "barryvdh/laravel-dompdf",
|
||||
|
@ -358,6 +358,57 @@
|
|||
],
|
||||
"time": "2015-11-09 22:51:51"
|
||||
},
|
||||
{
|
||||
"name": "cogpowered/finediff",
|
||||
"version": "0.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cogpowered/FineDiff.git",
|
||||
"reference": "339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/cogpowered/FineDiff/zipball/339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8",
|
||||
"reference": "339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "*",
|
||||
"phpunit/phpunit": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"cogpowered\\FineDiff": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rob Crowe",
|
||||
"email": "rob@cogpowered.com"
|
||||
},
|
||||
{
|
||||
"name": "Raymond Hill"
|
||||
}
|
||||
],
|
||||
"description": "PHP implementation of a Fine granularity Diff engine",
|
||||
"homepage": "https://github.com/cogpowered/FineDiff",
|
||||
"keywords": [
|
||||
"diff",
|
||||
"finediff",
|
||||
"opcode",
|
||||
"string",
|
||||
"text"
|
||||
],
|
||||
"time": "2014-05-19 10:25:02"
|
||||
},
|
||||
{
|
||||
"name": "dnoegel/php-xdg-base-dir",
|
||||
"version": "0.1",
|
||||
|
@ -519,6 +570,55 @@
|
|||
"homepage": "https://github.com/dompdf/dompdf",
|
||||
"time": "2016-05-11 00:36:29"
|
||||
},
|
||||
{
|
||||
"name": "gathercontent/htmldiff",
|
||||
"version": "0.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/gathercontent/htmldiff.git",
|
||||
"reference": "24674a62315f64330134b4a4c5b01a7b59193c93"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/gathercontent/htmldiff/zipball/24674a62315f64330134b4a4c5b01a7b59193c93",
|
||||
"reference": "24674a62315f64330134b4a4c5b01a7b59193c93",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"cogpowered/finediff": "0.3.1",
|
||||
"ext-tidy": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*",
|
||||
"squizlabs/php_codesniffer": "1.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"GatherContent\\Htmldiff": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Andrew Cairns",
|
||||
"email": "andrew@gathercontent.com"
|
||||
},
|
||||
{
|
||||
"name": "Mathew Chapman",
|
||||
"email": "mat@gathercontent.com"
|
||||
},
|
||||
{
|
||||
"name": "Peter Legierski",
|
||||
"email": "peter@gathercontent.com"
|
||||
}
|
||||
],
|
||||
"description": "Compare two HTML strings",
|
||||
"time": "2015-04-15 15:39:46"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "6.2.1",
|
||||
|
@ -899,16 +999,16 @@
|
|||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.3.9",
|
||||
"version": "v5.3.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "f6fbb481672f8dc4bc6882d5d654bbfa3588c8ec"
|
||||
"reference": "ca48001b95a0543fb39fcd7219de960bbc03eaa5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/f6fbb481672f8dc4bc6882d5d654bbfa3588c8ec",
|
||||
"reference": "f6fbb481672f8dc4bc6882d5d654bbfa3588c8ec",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/ca48001b95a0543fb39fcd7219de960bbc03eaa5",
|
||||
"reference": "ca48001b95a0543fb39fcd7219de960bbc03eaa5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -956,6 +1056,7 @@
|
|||
"illuminate/http": "self.version",
|
||||
"illuminate/log": "self.version",
|
||||
"illuminate/mail": "self.version",
|
||||
"illuminate/notifications": "self.version",
|
||||
"illuminate/pagination": "self.version",
|
||||
"illuminate/pipeline": "self.version",
|
||||
"illuminate/queue": "self.version",
|
||||
|
@ -1022,7 +1123,7 @@
|
|||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2016-09-12 14:08:29"
|
||||
"time": "2016-09-28 02:15:37"
|
||||
},
|
||||
{
|
||||
"name": "laravel/socialite",
|
||||
|
@ -1273,16 +1374,16 @@
|
|||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
"version": "v1.12.0",
|
||||
"version": "v1.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988"
|
||||
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
||||
"reference": "e634fbd32cd6bc3fa0e8c972b52d4bf49bab3988",
|
||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||
"reference": "5f49a5ed6cfde81d31d89378806670d77462526e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1301,7 +1402,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.12-dev"
|
||||
"dev-master": "1.13-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -1330,7 +1431,7 @@
|
|||
"debug",
|
||||
"debugbar"
|
||||
],
|
||||
"time": "2016-05-15 13:11:34"
|
||||
"time": "2016-09-15 14:01:59"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
|
@ -1558,16 +1659,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v2.1.0",
|
||||
"version": "v2.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "47b254ea51f1d6d5dc04b9b299e88346bf2369e3"
|
||||
"reference": "4dd659edadffdc2143e4753df655d866dbfeedf0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/47b254ea51f1d6d5dc04b9b299e88346bf2369e3",
|
||||
"reference": "47b254ea51f1d6d5dc04b9b299e88346bf2369e3",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0",
|
||||
"reference": "4dd659edadffdc2143e4753df655d866dbfeedf0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1605,7 +1706,7 @@
|
|||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2016-04-19 13:41:41"
|
||||
"time": "2016-09-16 12:04:44"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
|
@ -1825,22 +1926,30 @@
|
|||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||
"reference": "5277094ed527a1c4477177d102fe4c53551953e0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0",
|
||||
"reference": "5277094ed527a1c4477177d102fe4c53551953e0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Psr\\Log\\": ""
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
@ -1854,12 +1963,13 @@
|
|||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2012-12-21 11:40:51"
|
||||
"time": "2016-09-19 16:02:08"
|
||||
},
|
||||
{
|
||||
"name": "psy/psysh",
|
||||
|
@ -3167,16 +3277,16 @@
|
|||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.5.2",
|
||||
"version": "1.5.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc"
|
||||
"reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/da8529775f14f4fdae33f916eb0cf65f6afbddbc",
|
||||
"reference": "da8529775f14f4fdae33f916eb0cf65f6afbddbc",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
|
||||
"reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3205,7 +3315,7 @@
|
|||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2016-09-06 16:07:05"
|
||||
"time": "2016-09-16 13:37:59"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
|
@ -3661,24 +3771,24 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "5.5.4",
|
||||
"version": "5.5.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5"
|
||||
"reference": "a57126dc681b08289fef6ac96a48e30656f84350"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5",
|
||||
"reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a57126dc681b08289fef6ac96a48e30656f84350",
|
||||
"reference": "a57126dc681b08289fef6ac96a48e30656f84350",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-reflection": "*",
|
||||
"ext-spl": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"myclabs/deep-copy": "~1.3",
|
||||
"php": "^5.6 || ^7.0",
|
||||
"phpspec/prophecy": "^1.3.1",
|
||||
|
@ -3700,7 +3810,12 @@
|
|||
"conflict": {
|
||||
"phpdocumentor/reflection-docblock": "3.0.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-pdo": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-tidy": "*",
|
||||
"ext-xdebug": "*",
|
||||
"phpunit/php-invoker": "~1.1"
|
||||
},
|
||||
"bin": [
|
||||
|
@ -3735,7 +3850,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2016-08-26 07:11:44"
|
||||
"time": "2016-09-21 14:40:13"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
|
@ -4524,7 +4639,8 @@
|
|||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.6.4"
|
||||
"php": ">=5.6.4",
|
||||
"ext-tidy": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
|
|
12
resources/assets/sass/_pages.scss
Normal file → Executable file
12
resources/assets/sass/_pages.scss
Normal file → Executable file
|
@ -71,6 +71,18 @@
|
|||
max-width: 100%;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
// diffs
|
||||
ins,
|
||||
del {
|
||||
text-decoration: none;
|
||||
}
|
||||
ins {
|
||||
background: #dbffdb;
|
||||
}
|
||||
del {
|
||||
background: #FFECEC;
|
||||
}
|
||||
}
|
||||
|
||||
// Page content pointers
|
||||
|
|
|
@ -24,5 +24,9 @@
|
|||
|
||||
<div style="clear:left;"></div>
|
||||
|
||||
{!! $page->html !!}
|
||||
@if (isset($diff) && $diff)
|
||||
{!! $diff !!}
|
||||
@else
|
||||
{!! $page->html !!}
|
||||
@endif
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user