mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-28 21:22:30 +00:00
Merge branch 'summary' of git://github.com/younes0/BookStack into younes0-summary
This commit is contained in:
commit
8a9a8dfae5
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
class PageRevision extends Model
|
class PageRevision extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = ['name', 'html', 'text', 'markdown'];
|
protected $fillable = ['name', 'html', 'text', 'markdown', 'summary'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user that created the page revision
|
* Get the user that created the page revision
|
||||||
|
@ -310,7 +310,7 @@ class PageRepo extends EntityRepo
|
|||||||
{
|
{
|
||||||
// Save a revision before updating
|
// Save a revision before updating
|
||||||
if ($page->html !== $input['html'] || $page->name !== $input['name']) {
|
if ($page->html !== $input['html'] || $page->name !== $input['name']) {
|
||||||
$this->saveRevision($page);
|
$this->saveRevision($page, $input['summary']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent slug being updated if no name change
|
// Prevent slug being updated if no name change
|
||||||
@ -362,7 +362,7 @@ class PageRepo extends EntityRepo
|
|||||||
* @param Page $page
|
* @param Page $page
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function saveRevision(Page $page)
|
public function saveRevision(Page $page, $summary = null)
|
||||||
{
|
{
|
||||||
$revision = $this->pageRevision->fill($page->toArray());
|
$revision = $this->pageRevision->fill($page->toArray());
|
||||||
if (setting('app-editor') !== 'markdown') $revision->markdown = '';
|
if (setting('app-editor') !== 'markdown') $revision->markdown = '';
|
||||||
@ -372,6 +372,7 @@ class PageRepo extends EntityRepo
|
|||||||
$revision->created_by = auth()->user()->id;
|
$revision->created_by = auth()->user()->id;
|
||||||
$revision->created_at = $page->updated_at;
|
$revision->created_at = $page->updated_at;
|
||||||
$revision->type = 'version';
|
$revision->type = 'version';
|
||||||
|
$revision->summary = $summary;
|
||||||
$revision->save();
|
$revision->save();
|
||||||
// Clear old revisions
|
// Clear old revisions
|
||||||
if ($this->pageRevision->where('page_id', '=', $page->id)->count() > 50) {
|
if ($this->pageRevision->where('page_id', '=', $page->id)->count() > 50) {
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddSummaryToPageRevisions extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('page_revisions', function ($table) {
|
||||||
|
$table->string('summary')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('page_revisions', function ($table) {
|
||||||
|
$table->dropColumn('summary');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -39,6 +39,9 @@ div[class^="col-"] img {
|
|||||||
&.fluid {
|
&.fluid {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
&.medium {
|
||||||
|
max-width: 992px;
|
||||||
|
}
|
||||||
&.small {
|
&.small {
|
||||||
max-width: 840px;
|
max-width: 840px;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
#summary-input {
|
||||||
|
width: 140px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-style.editor {
|
.page-style.editor {
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4 faded">
|
<div class="col-sm-4 faded">
|
||||||
<div class="action-buttons" ng-cloak>
|
<div class="action-buttons" ng-cloak>
|
||||||
|
|
||||||
<button type="button" ng-if="isUpdateDraft" ng-click="discardDraft()" class="text-button text-neg"><i class="zmdi zmdi-close-circle"></i>Discard Draft</button>
|
<button type="button" ng-if="isUpdateDraft" ng-click="discardDraft()" class="text-button text-neg"><i class="zmdi zmdi-close-circle"></i>Discard Draft</button>
|
||||||
|
<input name="summary" id="summary-input" type="text" placeholder="edit summary" />
|
||||||
<button type="submit" id="save-button" class="text-button text-pos"><i class="zmdi zmdi-floppy"></i>Save Page</button>
|
<button type="submit" id="save-button" class="text-button text-pos"><i class="zmdi zmdi-floppy"></i>Save Page</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,17 +17,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="container small" ng-non-bindable>
|
<div class="container medium" ng-non-bindable>
|
||||||
<h1>Page Revisions <span class="subheader">For "{{ $page->name }}"</span></h1>
|
<h1>Page Revisions <span class="subheader">For "{{ $page->name }}"</span></h1>
|
||||||
|
|
||||||
@if(count($page->revisions) > 0)
|
@if(count($page->revisions) > 0)
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="40%">Name</th>
|
<th width="30%">Name</th>
|
||||||
<th colspan="2" width="20%">Created By</th>
|
<th colspan="2" width="10%">Created By</th>
|
||||||
<th width="20%">Revision Date</th>
|
<th width="15%">Revision Date</th>
|
||||||
<th width="20%">Actions</th>
|
<th width="20%">Summary</th>
|
||||||
|
<th width="15%">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($page->revisions as $revision)
|
@foreach($page->revisions as $revision)
|
||||||
<tr>
|
<tr>
|
||||||
@ -39,6 +40,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td> @if($revision->createdBy) {{$revision->createdBy->name}} @else Deleted User @endif</td>
|
<td> @if($revision->createdBy) {{$revision->createdBy->name}} @else Deleted User @endif</td>
|
||||||
<td><small>{{$revision->created_at->format('jS F, Y H:i:s')}} <br> ({{$revision->created_at->diffForHumans()}})</small></td>
|
<td><small>{{$revision->created_at->format('jS F, Y H:i:s')}} <br> ({{$revision->created_at->diffForHumans()}})</small></td>
|
||||||
|
<td>{{$revision->summary}}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{$revision->getUrl()}}" target="_blank">Preview</a>
|
<a href="{{$revision->getUrl()}}" target="_blank">Preview</a>
|
||||||
<span class="text-muted"> | </span>
|
<span class="text-muted"> | </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user