Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
[#102] - Faz aparecerem imagem de destaque, tags e categorias
Browse files Browse the repository at this point in the history
  • Loading branch information
teles committed Dec 19, 2016
1 parent da8aa5b commit 9ca67bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/js/components/full-post/models/full-post.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function FullPostModel(PostsApi, TagsApi, CategoriesApi, $q, MediaApi, $FrontPre
var categoryByIdPromise = CategoriesApi.getCategoryById(categoriesIds[i]);

categoryByIdPromise.then(function(categoryResult){
categoryResult = categoryResult.data;
var category = {};
category.name = categoryResult.name;
model.addCategory(category);
Expand All @@ -104,6 +105,7 @@ function FullPostModel(PostsApi, TagsApi, CategoriesApi, $q, MediaApi, $FrontPre
var tagByIdpromise = TagsApi.getTagById(tagsIds[j]);

tagByIdpromise.then(function(tagResult){
tagResult = tagResult.data;
var tag = {};
tag.name = tagResult.name;
model.addTag(tag);
Expand All @@ -117,8 +119,9 @@ function FullPostModel(PostsApi, TagsApi, CategoriesApi, $q, MediaApi, $FrontPre

var featuredImagesPromise = MediaApi.getMediaById(result.featured_media);

featuredImagesPromise.then(function(result){
model.setFeaturedImage(result.source_url);
featuredImagesPromise.then(function(featuredImageResult){
featuredImageResult = featuredImageResult.data;
model.setFeaturedImage(featuredImageResult.source_url);
});

featuredImagesPromise.catch(function(error){
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/list-posts/models/list-posts.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function ListPostsModel(PostsApi, MediaApi, $q, SlugsMapModel, ApiManager){
var featuredImagesPromise = MediaApi.getMediaById(featuredMediaId);

featuredImagesPromise.then(function(result){
defer.resolve(result);
defer.resolve(result.data);
});

featuredImagesPromise.catch(function(error){
Expand Down

0 comments on commit 9ca67bc

Please sign in to comment.