]> BookStack Code Mirror - bookstack/commitdiff
edit summary 140/head
authorYounès EL BIACHE <redacted>
Thu, 7 Jul 2016 18:53:43 +0000 (20:53 +0200)
committerYounès EL BIACHE <redacted>
Thu, 7 Jul 2016 18:53:43 +0000 (20:53 +0200)
app/PageRevision.php
app/Repos/PageRepo.php
database/migrations/2016_07_07_181521_add_summary_to_page_revisions.php [new file with mode: 0644]
resources/assets/sass/_grid.scss
resources/assets/sass/_pages.scss
resources/views/pages/form.blade.php
resources/views/pages/revisions.blade.php

index dae74cd0f9683af8775c1422173275baa9453dc3..1ffd63dbd584700376c983e39a4f4c1c8ce36800 100644 (file)
@@ -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
index de050e1c7cb8ad245157f81316c6305c2fdff87a..515d18bd91ebb15964883c3447c50bb4a71a1324 100644 (file)
@@ -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 (file)
index 0000000..c618877
--- /dev/null
@@ -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');
+        });
+    }
+}
index 2fe1ad113cb7264ef72e7e9d504b1a0abe5a0916..1a1321e587335c498a3e8c0f8ab3248d01809d4f 100644 (file)
@@ -39,6 +39,9 @@ div[class^="col-"] img {
   &.fluid {
     max-width: 100%;
   }
+  &.medium {
+    max-width: 992px;
+  }
   &.small {
     max-width: 840px;
   }
index 49b701dda9468e1b9a67c3322d1eda09fc60f365..1d203ef78287779c277c6b03d075a4dbaf16a6f9 100644 (file)
@@ -18,6 +18,9 @@
     flex: 1;
     flex-direction: column;
   }
+  #summary-input {
+    width: 140px;
+  } 
 }
 
 .page-style.editor {
index 4196e946fc8b8398e5c7074715270895740995b9..c2bdc6692a4d2a76268c5982005ee230afaa4286 100644 (file)
@@ -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>
index a73f16a4ff8bbd882f453e1d1d38b0d0bc442028..24e91b3669f9a2b152252bda5c20cae3d16fa388 100644 (file)
     </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">&nbsp;|&nbsp;</span>