Skip to content

Commit

Permalink
Add post type to post detail and list pages Refs T1383
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmackay committed Mar 12, 2015
1 parent cd6b412 commit bd29b27
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/common/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
"geometry_test" : "Geometry Test",
"view_on_map" : "View on map",
"status" : "Status",
"type": "Type",
"links" : "Links",
"respond" : "Respond",
"send" : "Send",
Expand Down
7 changes: 7 additions & 0 deletions app/post/controllers/post-detail-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = [
'UserEndpoint',
'TagEndpoint',
'FormAttributeEndpoint',
'FormEndpoint',
'Leaflet',
'leafletData',
function(
Expand All @@ -22,6 +23,7 @@ function(
UserEndpoint,
TagEndpoint,
FormAttributeEndpoint,
FormEndpoint,
L,
leafletData
) {
Expand Down Expand Up @@ -49,6 +51,11 @@ function(
// Load the post form
if ($scope.post.form && $scope.post.form.id) {
$scope.form_attributes = [];

FormEndpoint.get({formId: $scope.post.form.id}, function(form) {
$scope.form_name = form.name;
});

FormAttributeEndpoint.query({formId: $scope.post.form.id}, function(attributes) {
angular.forEach(attributes, function(attr) {
this[attr.key] = attr;
Expand Down
8 changes: 7 additions & 1 deletion app/post/directives/post-preview-directive.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module.exports = [
'TagEndpoint',
'UserEndpoint',
'FormEndpoint',
function(
TagEndpoint,
UserEndpoint
UserEndpoint,
FormEndpoint
) {

return {
Expand All @@ -18,6 +20,10 @@ function(
scope.post.tags = scope.post.tags.map(function (tag) {
return TagEndpoint.get({id: tag.id});
});

FormEndpoint.get({formId: scope.post.form.id}, function(form) {
scope.form_name = form.name;
});
}
};

Expand Down
7 changes: 7 additions & 0 deletions server/www/templates/posts/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ <h4 translate>post.posted_by</h4>
<p><i class="fa fa-user"></i><a ng-href="/users/{{user.id}}"></a> {{user.realname || post.user.id}}</p>
</div>

<div ng-show="form_name">
<h4 translate>post.type</h4>
<p>
{{form_name}}
</p>
</div>

<h4 translate>post.status</h4>
<p>
<span ng-show="post.status == 'published'"><i class="fa fa-check-circle"></i> <span translate>post.published</span></span>
Expand Down
5 changes: 4 additions & 1 deletion server/www/templates/posts/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
</span>
</small>
<h4><a ng-href="/posts/{{post.id}}">{{post.title}}</a></h4>
<div>Thumnail image</div>
<!--<div>Thumnail image</div>-->
<p>
{{post.content}}
</p>
</div>
<div class="col-md-3">
<p ng-show="form_name">
<b translate>post.type</b> {{form_name}}
</p>
<p ng-if="post.allowed_privileges.indexOf('update') !== -1">
<a class="btn btn-default btn-large" href="/posts/{{post.id}}/edit">
<i class="fa fa-edit"></i> <span translate>post.post_actions.edit</span>
Expand Down

0 comments on commit bd29b27

Please sign in to comment.