Files
meanTorrent/modules/articles/client/views/view-article.client.view.html
mleanos 69b8a05ea2 fix(articles): Article edit/delete validation
Adds a custom field named `isCurrentUserOwner` to the Article document before
it's returned to the client. This field is used to determine if the current
User should is the "owner", and should see the edit/delete controls on the
client-side when viewing a single article. This custom (ad-hoc) field is NOT
persisted to the database; it's merely attached to the document.

Added server-side route tests for verifying the ad-hoc
"isCurrentUserOwner" field is properly set on the a single Article document.

Fixes #1146
2016-02-07 21:29:18 -08:00

24 lines
774 B
HTML

<section>
<div class="page-header">
<h1 ng-bind="vm.article.title"></h1>
</div>
<div class="pull-right" ng-show="vm.article.isCurrentUserOwner">
<a class="btn btn-primary" ui-sref="articles.edit({ articleId: vm.article._id })">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a class="btn btn-primary" ng-click="vm.remove()">
<i class="glyphicon glyphicon-trash"></i>
</a>
</div>
<small>
<em class="text-muted">
Posted on
<span ng-bind="vm.article.created | date:'mediumDate'"></span>
by
<span ng-if="vm.article.user" ng-bind="vm.article.user.displayName"></span>
<span ng-if="!vm.article.user">Deleted User</span>
</em>
</small>
<p class="lead" ng-bind="vm.article.content"></p>
</section>