Skip to content

Commit

Permalink
Merge branch 'master' into 0.4.0
Browse files Browse the repository at this point in the history
Conflicts:
	include/service/entities/template_service.js
	plugins/pencilblue/controllers/index.js
  • Loading branch information
brianhyder committed Mar 23, 2015
2 parents bb147eb + 7450203 commit 61e9005
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
17 changes: 8 additions & 9 deletions include/service/entities/template_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ module.exports = function(pb) {
};

/**
*
* The default handler for unregistered flags. It outputs the flag back out.
* @property unregisteredFlagHandler
* @type {Function}
*/
TemplateService.unregisteredFlagHandler = function(flag) {
return '^'+flag+'^';
TemplateService.unregisteredFlagHandler = function(flag, cb) {
cb(null, '^'+flag+'^');
};

/**
Expand Down Expand Up @@ -389,20 +389,19 @@ module.exports = function(pb) {
return;
}
else {
//the flag was not registered. Hand it off to a handler for any
//catch-all processing.


//log result
if (pb.log.isSilly()) {
pb.log.silly("TemplateService: Failed to process flag [%s]", flag);
}

if (util.isFunction(self.unregisteredFlagHandler)) {
cb(null, self.unregisteredFlagHandler(flag));
//the flag was not registered. Hand it off to a handler for any
//catch-all processing.
if (pb.utils.isFunction(self.unregisteredFlagHandler)) {
self.unregisteredFlagHandler(flag, cb);
}
else {
cb(null, TemplateService.unregisteredFlagHandler(flag));
TemplateService.unregisteredFlagHandler(flag, cb);
}
}
};
Expand Down
7 changes: 3 additions & 4 deletions plugins/pencilblue/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,9 @@ module.exports = function IndexModule(pb) {
ats.registerLocal('author_position', content.author_position ? content.author_position : '');
ats.registerLocal('media_body_style', content.media_body_style ? content.media_body_style : '');
ats.registerLocal('comments', function(flag, cb) {
if (isPage || !contentSettings.allow_comments) {
cb(null, '');
return;
}
if (isPage || !contentSettings.allow_comments || !content.allow_comments === false) {
return cb(null, '');
}

self.renderComments(content, ats, function(err, comments) {
cb(err, new pb.TemplateValue(comments, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
</div>
<div class="form_error" ng-if="!isFieldValid(articleForm.publish_date)">^loc_REQUIRED_FIELD^</div>
</div>
<div class="form-group">
<label>^loc_ALLOW_COMMENTS^?</label><br/>
<div class="btn-group">
<button type="button" class="btn btn-default" ng-class="{'active': article.allow_comments}" ng-click="setCommentState(true)">^loc_YES^</button>
<button type="button" class="btn btn-default" ng-class="{'active': !article.allow_comments}" ng-click="setCommentState(false)">^loc_NO^</button>
</div>
</div>
<div class="form-group">
<label>^loc_CONTENT^&nbsp;<span ng-bind="columnInches"></span></label>
<div id="article_wysiwyg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
$scope.editingObject = $scope.article;
$scope.variablePrefix = 'article';

$scope.setCommentState = function(state) {
$scope.article.allow_comments = state;
};

$scope.setPublishDateToNow = function() {
$scope.article.publish_date = $filter('date')(new Date(), 'MM-dd-yyyy HH:mm');
};
Expand Down
3 changes: 2 additions & 1 deletion public/localization/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ var loc =
INACTIVE_SECTIONS: 'Drag unassociated sections here',
PUBLISHED: 'Published',
UNPUBLISHED: 'Unpublished',
DRAFT: 'Draft'
DRAFT: 'Draft',
ALLOW_COMMENTS: 'Allow comments'
},
wysiwyg: {
NORMAL_TEXT: 'Normal text',
Expand Down

0 comments on commit 61e9005

Please sign in to comment.