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

Commit

Permalink
Closes #88 - Remove defiant.js das dependencias
Browse files Browse the repository at this point in the history
  • Loading branch information
teles committed Dec 2, 2016
1 parent fbb0143 commit db232ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"dependencies": {
"angular": "^1.5.7",
"ngInfiniteScroll": "^1.2.2",
"defiant": "defiantjs#^1.3.9",
"angular-disqus": "^1.1.0"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions src/js/frontpress.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ function frontpressRun(SlugsMapModel){
}
}

if(!Array.prototype.getObjectByValue){
Array.prototype.getObjectByValue = function(propertyName, propertyValue){
return this.find(function (objectsArrayElement) {
return objectsArrayElement[propertyName] == propertyValue;
});
}
}

if (!Array.prototype.filterToProperties) {
Array.prototype.filterToProperties = function() {

Expand Down
3 changes: 2 additions & 1 deletion src/js/views/post/controllers/post-directive.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function PostDirectiveController(FullPostModel, $stateParams, PageHeadModel, Slu
postId = $stateParams.postId;
}
else {
postId = JSON.search(cachedSlugs, "//*[slug='{0}']/{1}".format(postSlug, idProperty))[0];
var slugItem = cachedSlugs.getObjectByValue("slug", postSlug);
postId = slugItem[idProperty];
}

var fullPostPromise = FullPostModel.loadFullPostById(postId);
Expand Down

0 comments on commit db232ee

Please sign in to comment.