]> BookStack Code Mirror - bookstack/commitdiff
Refactored Angular code to instead use VueJS, left with permissions, testing and...
authorAbijeet <redacted>
Sun, 20 Aug 2017 14:51:27 +0000 (20:21 +0530)
committerAbijeet <redacted>
Sun, 20 Aug 2017 14:51:27 +0000 (20:21 +0530)
config/app.php
config/database.php
resources/assets/js/vues/vues.js
resources/views/comments/comments.blade.php
resources/views/comments/list-item.blade.php

index a390eaf83a16eb20360f47e30be0d6090ad73eea..23aad7d487811ab7d0861b9a26de4373da0455fb 100644 (file)
@@ -18,7 +18,7 @@ return [
     |
     */
 
-    'debug' => env('APP_DEBUG', false),
+    'debug' => env('APP_DEBUG', true),
 
     /*
     |--------------------------------------------------------------------------
index 3883b58686ae4abb54c26b7dc94578be236e6c6f..50f702e3372d3c57bca0d192f8cc6ca6a88d0af6 100644 (file)
@@ -79,9 +79,9 @@ return [
         'mysql' => [
             'driver'    => 'mysql',
             'host'      => $mysql_host,
-            'database'  => env('DB_DATABASE', 'forge'),
-            'username'  => env('DB_USERNAME', 'forge'),
-            'password'  => env('DB_PASSWORD', ''),
+            'database'  => env('DB_DATABASE', 'bookstack'),
+            'username'  => env('DB_USERNAME', 'root'),
+            'password'  => env('DB_PASSWORD', 'Change123'),
             'port'      => $mysql_port,
             'charset'   => 'utf8mb4',
             'collation' => 'utf8mb4_unicode_ci',
index a3f6ec8e540c678587133d19a05c197cde37bbf1..e5ab50c4da9b371f267c95b3ed95d578b9293f4d 100644 (file)
@@ -10,6 +10,7 @@ let vueMapping = {
     'code-editor': require('./code-editor'),
     'image-manager': require('./image-manager'),
     'tag-manager': require('./tag-manager'),
+    'page-comments': require('./page-comments')
 };
 
 window.vues = {};
index ffa75cfed227638fc72e1615c32803134994045e..24a8b3e23878012778970135c39a2a10638e681a 100644 (file)
@@ -1,18 +1,11 @@
-<script type="text/ng-template" id="comment-list-item.html">
-    @include('comments/list-item')
-</script>
-<script type="text/ng-template" id="comment-reply.html">
-    @include('comments/comment-reply', ['pageId' => $pageId])
-</script>
-<div ng-controller="CommentListController as vm" ng-init="pageId = <?= $page->id ?>" class="comments-list" ng-cloak>
-<h3>@{{vm.totalCommentsStr}}</h3>
-<hr>
-    <div class="comment-box" ng-repeat="comment in vm.comments track by comment.id">
-        <div ng-include src="'comment-list-item.html'">
-
-        </div>
-    </div>
-    <div ng-if="::vm.canComment()">
-        @include('comments/comment-reply', ['pageId' => $pageId])
-    </div>
+<div id="page-comments" page-id="<?= $page->id ?>" class="comments-list" v-cloak>
+  <h3>@{{totalCommentsStr}}</h3>
+  <hr>
+  <comment v-for="(comment, index) in comments" :initial-comment="comment" :index="index" :level=1
+     v-on:comment-added.stop="commentAdded"
+     :key="comment.id"></comment>
+  <div v-if="canComment">
+     <comment-reply v-on:comment-added.stop="commentAdded" :page-id="<?= $page->id ?>">
+     </comment-reply>
+  </div>
 </div>
\ No newline at end of file
index f274d2ed2f3c0fbf7e22792b211428995590f3f2..72984d68dd2eaa204a6fb5d20445e586f974ff89 100644 (file)
@@ -1,30 +1,33 @@
-<div class='page-comment' id="comment-@{{::pageId}}-@{{::comment.id}}">
+<div class="comment-box">
+  <div class='page-comment' id="comment-@{{::pageId}}-@{{::comment.id}}">
     <div class="user-image">
-        <img ng-src="@{{::comment.created_by.avatar_url}}" alt="user avatar">
+      <img ng-src="@{{::comment.created_by.avatar_url}}" alt="user avatar">
     </div>
     <div class="comment-container">
-        <div class="comment-header">
-            <a href="@{{::comment.created_by.profile_url}}">@{{ ::comment.created_by.name }}</a>
-        </div>
-        <div ng-bind-html="comment.html" ng-if="::comment.active" class="comment-body" ng-class="!comment.active ? 'comment-inactive' : ''">
+      <div class="comment-header">
+        <a href="@{{::comment.created_by.profile_url}}">@{{ ::comment.created_by.name }}</a>
+      </div>
+      <div ng-bind-html="comment.html" ng-if="::comment.active" class="comment-body" ng-class="!comment.active ? 'comment-inactive' : ''">
 
+      </div>
+      <div ng-if="::!comment.active" class="comment-body comment-inactive">
+        {{ trans('entities.comment_deleted') }}
+      </div>
+      <div class="comment-actions">
+        <ul ng-if="!comment.is_hidden">
+          <li ng-if="::(level < 3 && vm.canComment())"><a href="#" comment-reply-link no-comment-reply-dupe="true" comment="comment" is-reply="true">{{ trans('entities.comment_reply') }}</a></li>
+          <li ng-if="::vm.canEditDelete(comment, 'comment_update')"><a href="#" comment-reply-link no-comment-reply-dupe="true" comment="comment">{{ trans('entities.comment_edit') }}</a></li>
+          <li ng-if="::vm.canEditDelete(comment, 'comment_delete')"><a href="#" comment-delete-link comment="comment">{{ trans('entities.comment_delete') }}</a></li>
+          <li>{{ trans('entities.comment_create') }} <a title="@{{::comment.created.day_time_str}}" href="#?cm=comment-@{{::pageId}}-@{{::comment.id}}">@{{::comment.created.diff}}</a></li>
+          <li ng-if="::comment.updated"><span title="@{{::comment.updated.day_time_str}}">@{{ ::vm.trans('entities.comment_updated_text', { updateDiff: comment.updated.diff }) }}
+                          <a href="@{{::comment.updated_by.profile_url}}">@{{::comment.updated_by.name}}</a></span></li>
+        </ul>
+      </div>
+      <comment v-for="comment in comments = comment.sub_comments" v-bind:comment="comment" v-bind:index="index" v-bind:key="comment.id"></comment>
+      <div class="comment-box" ng-repeat="comment in comments = comment.sub_comments track by comment.id" ng-init="level = level + 1">
+        <div ng-include src="'comment-list-item.html'">
         </div>
-        <div ng-if="::!comment.active" class="comment-body comment-inactive">
-            {{ trans('entities.comment_deleted') }}
-        </div>
-        <div class="comment-actions">
-            <ul ng-if="!comment.is_hidden">
-                <li ng-if="::(level < 3 && vm.canComment())"><a href="#" comment-reply-link no-comment-reply-dupe="true" comment="comment" is-reply="true">{{ trans('entities.comment_reply') }}</a></li>
-                <li ng-if="::vm.canEditDelete(comment, 'comment_update')"><a href="#" comment-reply-link no-comment-reply-dupe="true" comment="comment" >{{ trans('entities.comment_edit') }}</a></li>
-                <li ng-if="::vm.canEditDelete(comment, 'comment_delete')"><a href="#" comment-delete-link comment="comment" >{{ trans('entities.comment_delete') }}</a></li>
-                <li>{{ trans('entities.comment_create') }} <a title="@{{::comment.created.day_time_str}}" href="#?cm=comment-@{{::pageId}}-@{{::comment.id}}">@{{::comment.created.diff}}</a></li>
-                <li ng-if="::comment.updated"><span title="@{{::comment.updated.day_time_str}}">@{{ ::vm.trans('entities.comment_updated_text', { updateDiff: comment.updated.diff }) }}
-                        <a href="@{{::comment.updated_by.profile_url}}">@{{::comment.updated_by.name}}</a></span></li>
-            </ul>
-        </div>
-        <div class="comment-box" ng-repeat="comment in comments = comment.sub_comments track by comment.id" ng-init="level = level + 1">
-            <div ng-include src="'comment-list-item.html'">
-            </div>
-        </div>
+      </div>
     </div>
+  </div>
 </div>
\ No newline at end of file