Refactored Angular code to instead use VueJS, left with permissions, testing and load testing.

This commit is contained in:
Abijeet 2017-08-20 20:21:27 +05:30
parent 4df3267521
commit ed375bfaf7
5 changed files with 41 additions and 44 deletions

View File

@ -18,7 +18,7 @@ return [
| |
*/ */
'debug' => env('APP_DEBUG', false), 'debug' => env('APP_DEBUG', true),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -79,9 +79,9 @@ return [
'mysql' => [ 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => $mysql_host, 'host' => $mysql_host,
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE', 'bookstack'),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', 'Change123'),
'port' => $mysql_port, 'port' => $mysql_port,
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci', 'collation' => 'utf8mb4_unicode_ci',

View File

@ -10,6 +10,7 @@ let vueMapping = {
'code-editor': require('./code-editor'), 'code-editor': require('./code-editor'),
'image-manager': require('./image-manager'), 'image-manager': require('./image-manager'),
'tag-manager': require('./tag-manager'), 'tag-manager': require('./tag-manager'),
'page-comments': require('./page-comments')
}; };
window.vues = {}; window.vues = {};

View File

@ -1,18 +1,11 @@
<script type="text/ng-template" id="comment-list-item.html"> <div id="page-comments" page-id="<?= $page->id ?>" class="comments-list" v-cloak>
@include('comments/list-item') <h3>@{{totalCommentsStr}}</h3>
</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> <hr>
<div class="comment-box" ng-repeat="comment in vm.comments track by comment.id"> <comment v-for="(comment, index) in comments" :initial-comment="comment" :index="index" :level=1
<div ng-include src="'comment-list-item.html'"> v-on:comment-added.stop="commentAdded"
:key="comment.id"></comment>
</div> <div v-if="canComment">
</div> <comment-reply v-on:comment-added.stop="commentAdded" :page-id="<?= $page->id ?>">
<div ng-if="::vm.canComment()"> </comment-reply>
@include('comments/comment-reply', ['pageId' => $pageId])
</div> </div>
</div> </div>

View File

@ -1,3 +1,4 @@
<div class="comment-box">
<div class='page-comment' id="comment-@{{::pageId}}-@{{::comment.id}}"> <div class='page-comment' id="comment-@{{::pageId}}-@{{::comment.id}}">
<div class="user-image"> <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">
@ -22,9 +23,11 @@
<a href="@{{::comment.updated_by.profile_url}}">@{{::comment.updated_by.name}}</a></span></li> <a href="@{{::comment.updated_by.profile_url}}">@{{::comment.updated_by.name}}</a></span></li>
</ul> </ul>
</div> </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 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 ng-include src="'comment-list-item.html'">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>