diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 000000000..1d5d3ccc7 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,7 @@ +import templates from './templates/index.js'; + +let mod = angular.module('wordpress-hybrid-client.overwriteModule', [ + templates +]); + +export default mod = mod.name; diff --git a/dist/templates/customPost-example.html b/dist/templates/customPost-example.html new file mode 100644 index 000000000..012c0ef8b --- /dev/null +++ b/dist/templates/customPost-example.html @@ -0,0 +1,3 @@ +
+

+
diff --git a/dist/templates/customPosts-example.html b/dist/templates/customPosts-example.html new file mode 100644 index 000000000..e05ec0e73 --- /dev/null +++ b/dist/templates/customPosts-example.html @@ -0,0 +1,7 @@ +
+
+ + {{item.id}} + +
+
diff --git a/dist/templates/index.js b/dist/templates/index.js new file mode 100644 index 000000000..f87299c22 --- /dev/null +++ b/dist/templates/index.js @@ -0,0 +1,8 @@ +let mod = angular.module('wordpress-hybrid-client.overwriteTemplates', []); + +mod.run(($templateCache) => { + $templateCache.put('customPost/example.html', require('!html!./customPost-example.html')); + $templateCache.put('customPosts/example.html', require('!html!./customPosts-example.html')) +}); + +export default mod = mod.name; diff --git a/lib/abstract/AbstractItem.js b/lib/abstract/AbstractItem.js index 63b5698bf..ece19219d 100644 --- a/lib/abstract/AbstractItem.js +++ b/lib/abstract/AbstractItem.js @@ -29,6 +29,7 @@ export default class { if (!this.$stateParams.id){ return this.$q.reject(); } + console.log('this.service', this.service) return this.service.get(this.$stateParams.id, angular.merge(this.getQuery(), _.get(this.config, `[${this.type}].query`) || {})).then((response) => { self.item = response.data; }); diff --git a/lib/abstract/AbstractItemService.js b/lib/abstract/AbstractItemService.js index 450dd334e..3a31b109e 100644 --- a/lib/abstract/AbstractItemService.js +++ b/lib/abstract/AbstractItemService.js @@ -8,19 +8,20 @@ export default class extends AbstractList { super($injector); } - getHttpPromise(id) { - return this.service.get(id); + getHttpPromise(id, query) { + return this.service.get(id, query); } - get(id) { + get(id, query) { + let queryString = JSON.stringify(query); let deferred = this.$q.defer(); - let hash = md5(this.config.api.baseUrl + id); - let itemCache = this.getCache().get('item-' + hash); + let hash = md5(`this.config.api.baseUrl${id}${queryString}`); + let itemCache = this.getCache().get(`item-${hash}`); if (itemCache) { deferred.resolve(itemCache); } else { - this.getHttpPromise(id).then((response) => { - this.getCache().put('item-' + hash, response); + this.getHttpPromise(id, query).then((response) => { + this.getCache().put(`item-${hash}`, response); deferred.resolve(response); }) .catch((error) => { diff --git a/lib/abstract/AbstractListService.js b/lib/abstract/AbstractListService.js index 070be1749..303bc5761 100644 --- a/lib/abstract/AbstractListService.js +++ b/lib/abstract/AbstractListService.js @@ -41,13 +41,13 @@ export default class { get(query) { let queryString = JSON.stringify(query); let deferred = this.$q.defer(); - let hash = md5(this.config.api.baseUrl + queryString); - let listCache = this.getCache().get('list-' + hash); + let hash = md5(`this.config.api.baseUrl${queryString}`); + let listCache = this.getCache().get(`list-${hash}`); if (listCache) { deferred.resolve(listCache); } else { this.getHttpPromise(query).then((response) => { - this.getCache().put('list-' + hash, response); + this.getCache().put(`list-${hash}`, response); deferred.resolve(response); }) .catch((error) => { diff --git a/lib/bookmark/bookmark.html b/lib/bookmark/bookmark.html index 6cdc82265..eea1f8529 100644 --- a/lib/bookmark/bookmark.html +++ b/lib/bookmark/bookmark.html @@ -4,7 +4,7 @@
-
+

{{post.bookmarked | amTimeAgo}}