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

Commit db232ee

Browse files
committed
Closes #88 - Remove defiant.js das dependencias
1 parent fbb0143 commit db232ee

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

bower.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"dependencies": {
1818
"angular": "^1.5.7",
1919
"ngInfiniteScroll": "^1.2.2",
20-
"defiant": "defiantjs#^1.3.9",
2120
"angular-disqus": "^1.1.0"
2221
},
2322
"devDependencies": {

src/js/frontpress.run.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ function frontpressRun(SlugsMapModel){
6060
}
6161
}
6262

63+
if(!Array.prototype.getObjectByValue){
64+
Array.prototype.getObjectByValue = function(propertyName, propertyValue){
65+
return this.find(function (objectsArrayElement) {
66+
return objectsArrayElement[propertyName] == propertyValue;
67+
});
68+
}
69+
}
70+
6371
if (!Array.prototype.filterToProperties) {
6472
Array.prototype.filterToProperties = function() {
6573

src/js/views/post/controllers/post-directive.controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function PostDirectiveController(FullPostModel, $stateParams, PageHeadModel, Slu
2222
postId = $stateParams.postId;
2323
}
2424
else {
25-
postId = JSON.search(cachedSlugs, "//*[slug='{0}']/{1}".format(postSlug, idProperty))[0];
25+
var slugItem = cachedSlugs.getObjectByValue("slug", postSlug);
26+
postId = slugItem[idProperty];
2627
}
2728

2829
var fullPostPromise = FullPostModel.loadFullPostById(postId);

0 commit comments

Comments
 (0)