diff --git a/app/PageRevision.php b/app/PageRevision.php index dae74cd0f..1ffd63dbd 100644 --- a/app/PageRevision.php +++ b/app/PageRevision.php @@ -3,7 +3,7 @@ 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 diff --git a/app/Repos/PageRepo.php b/app/Repos/PageRepo.php index de050e1c7..515d18bd9 100644 --- a/app/Repos/PageRepo.php +++ b/app/Repos/PageRepo.php @@ -310,7 +310,7 @@ class PageRepo extends EntityRepo { // Save a revision before updating 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 @@ -362,7 +362,7 @@ class PageRepo extends EntityRepo * @param Page $page * @return $this */ - public function saveRevision(Page $page) + public function saveRevision(Page $page, $summary = null) { $revision = $this->pageRevision->fill($page->toArray()); if (setting('app-editor') !== 'markdown') $revision->markdown = ''; @@ -372,6 +372,7 @@ class PageRepo extends EntityRepo $revision->created_by = auth()->user()->id; $revision->created_at = $page->updated_at; $revision->type = 'version'; + $revision->summary = $summary; $revision->save(); // Clear old revisions if ($this->pageRevision->where('page_id', '=', $page->id)->count() > 50) { diff --git a/database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php b/database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php new file mode 100644 index 000000000..c618877ef --- /dev/null +++ b/database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php @@ -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'); + }); + } +} diff --git a/resources/assets/sass/_grid.scss b/resources/assets/sass/_grid.scss index 2fe1ad113..1a1321e58 100644 --- a/resources/assets/sass/_grid.scss +++ b/resources/assets/sass/_grid.scss @@ -39,6 +39,9 @@ div[class^="col-"] img { &.fluid { max-width: 100%; } + &.medium { + max-width: 992px; + } &.small { max-width: 840px; } diff --git a/resources/assets/sass/_pages.scss b/resources/assets/sass/_pages.scss index 49b701dda..1d203ef78 100644 --- a/resources/assets/sass/_pages.scss +++ b/resources/assets/sass/_pages.scss @@ -18,6 +18,9 @@ flex: 1; flex-direction: column; } + #summary-input { + width: 140px; + } } .page-style.editor { diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php index 4196e946f..c2bdc6692 100644 --- a/resources/views/pages/form.blade.php +++ b/resources/views/pages/form.blade.php @@ -27,8 +27,8 @@ </div> <div class="col-sm-4 faded"> <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> + <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> </div> </div> diff --git a/resources/views/pages/revisions.blade.php b/resources/views/pages/revisions.blade.php index a73f16a4f..24e91b366 100644 --- a/resources/views/pages/revisions.blade.php +++ b/resources/views/pages/revisions.blade.php @@ -17,17 +17,18 @@ </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> @if(count($page->revisions) > 0) <table class="table"> <tr> - <th width="40%">Name</th> - <th colspan="2" width="20%">Created By</th> - <th width="20%">Revision Date</th> - <th width="20%">Actions</th> + <th width="30%">Name</th> + <th colspan="2" width="10%">Created By</th> + <th width="15%">Revision Date</th> + <th width="20%">Summary</th> + <th width="15%">Actions</th> </tr> @foreach($page->revisions as $revision) <tr> @@ -39,6 +40,7 @@ </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>{{$revision->summary}}</td> <td> <a href="{{$revision->getUrl()}}" target="_blank">Preview</a> <span class="text-muted"> | </span>