8000 blog title link hyphenated · causecode/static-content@60cd978 · GitHub
[go: up one dir, main page]

Skip to content

Commit 60cd978

Browse files
committed
blog title link hyphenated
1 parent fc38d59 commit 60cd978

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

web-app/ng/app/scripts/blog/blog.controller.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'use strict';
44

55
controllers.controller('BlogController', ['$scope', '$state', 'BlogModel', 'appService', '$modal', 'PageModel', '$timeout',
6-
'$location', '$window', '$http', 'fileService', '$rootScope', function($scope, $state, BlogModel, appService, $modal, PageModel, $timeout, $location, $window, $http, fileService, $rootScope) {
6+
'$location', '$window', '$http', 'fileService', '$rootScope', 'SecurityService', function($scope, $state, BlogModel, appService, $modal, PageModel, $timeout, $location, $window, $http, fileService, $rootScope, securityService) {
77
console.info('BlogController executing.', $scope);
88

99
$scope.commentData = {};
@@ -88,6 +88,9 @@ controllers.controller('BlogController', ['$scope', '$state', 'BlogModel', 'appS
8888
$scope.initializeGetListResponse = function(data) {
8989
if (data) {
9090
$scope.instanceList = data.instanceList;
91+
$scope.instanceList.forEach(function(instance) {
92+
instance.encodedTitle = instance.title.replace(/\s+/g, '-').toLowerCase();
93+
});
9194
$scope.monthFilterList = data.monthFilterList;
9295
$scope.tagList = data.tagList;
9396
}
@@ -144,6 +147,11 @@ controllers.controller('BlogController', ['$scope', '$state', 'BlogModel', 'appS
144147
});
145148
};
146149

150+
$scope.isBlogEditable = function() {
151+
return ($scope.userInstance && (securityService.ifAnyGranted($scope.userRoles, 'ROLE_CONTENT_MANAGER,ROLE_ADMIN') ||
152+
$scope.blogInstance.author === $scope.userInstance.username))
153+
}
154+
147155
function addComment(comments) {
148156
if ($scope.commentData.commentId) {
149157
if (comments && comments.length === 0) { return []; }

web-app/ng/app/views/blog/_tabled-list.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<article class="post" ng-repeat="blog in instanceList | filter: queryText">
33
<div class="content">
44
<h3 class="post-title">
5-
<a ui-sref="blogView({resource: blog.id, title: blog.title})">
5+
<a ui-sref="blogView({resource: blog.id, title: blog.encodedTitle})">
66
{{blog.title}} {{queryText}}
77
</a>
88
</h3>
@@ -12,7 +12,7 @@ <h3 class="post-title">
1212
<li class="post-time post_date date updated" ng-if="blog.publishedDate">{{blog.publishedDate | date: MM/dd/yyyy}}</li>
1313
<li class="post-author"> by {{blog.author}}</li>
1414
<li class="post-comments-link">
15-
<a ui-sref="blogView({resource: blog.id, title: blog.title})">
15+
<a ui-sref="blogView({resource: blog.id, title: blog.encodedTitle})">
1616
<i class="fa fa-comments"></i>{{blog.numberOfComments}} Comments
1717
</a>
1818
</li>
@@ -23,14 +23,14 @@ <h3 class="post-title">
2323
</div>
2424
<div class="post-entry">
2525
<p ng-bind-html="blog.body | htmlToText: 30"></p>
26-
<a class="read-more" ui-sref="blogView({resource: blog.id, title: blog.title})">
26+
<a class="read-more" ui-sref="blogView({resource: blog.id, title: blog.encodedTitle})">
2727
Read more <i class="fa fa-long-arrow-right"></i>
2828
</a>
2929
</div>
3030
</div>
3131
</article>
3232
<div ng-if="!instanceList">
33-
<span>Blogs not found.</span>
33+
<span>Loading Blogs</span>
3434
</div>
3535
<pagination total-items="totalCount" ng-model="elementModels.currentPage" max-size="paginationSize"
3636
ng-change="changePage()" items-per-page="itemsPerPage" ng-show="totalCount && totalCount > itemsPerPage">

web-app/ng/app/views/blog/show.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h2 class="title">Comments</h2>
4343
</article>
4444
</div>
4545
<div class="blog-entry section col-md-8 col-sm-8 col-xs-12" ng-if="!blogInstance">
46-
<span>Blog not found.</span>
46+
<span>Loading Blog</span>
4747
</div>
4848
<div ng-include src="'views/blog/_filter.html'"></div>
4949
</div>

0 commit comments

Comments
 (0)
0