Commit 720037781a1ba788464681bfde853c9f381b7157
1 parent
dbaeccc0
Exists in
master
and in
8 other branches
Service: add getTerms
Showing
2 changed files
with
15 additions
and
1 deletions
Show diff stats
src/app/components/article-service/article.service.js
@@ -124,7 +124,7 @@ | @@ -124,7 +124,7 @@ | ||
124 | 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count'], | 124 | 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count'], |
125 | 'limit':'20', | 125 | 'limit':'20', |
126 | 'page':'1', | 126 | 'page':'1', |
127 | - 'content_type':'ProposalsDiscussionPlugin::Proposals' | 127 | + 'content_type':'ProposalsDiscussionPlugin::Proposal' |
128 | }, params); | 128 | }, params); |
129 | 129 | ||
130 | UtilService.get(url, {params: paramsExtended}).then(function(data){ | 130 | UtilService.get(url, {params: paramsExtended}).then(function(data){ |
src/app/components/dialoga-service/dialoga.service.js
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | extendedService.serviceDialoga = $rootScope.basePath + '/api/v1/dialoga_plugin/'; | 14 | extendedService.serviceDialoga = $rootScope.basePath + '/api/v1/dialoga_plugin/'; |
15 | extendedService.getHome = getHome; | 15 | extendedService.getHome = getHome; |
16 | extendedService.getAbout = getAbout; | 16 | extendedService.getAbout = getAbout; |
17 | + extendedService.getTerms = getTerms; | ||
17 | extendedService.getThemes = getThemes; | 18 | extendedService.getThemes = getThemes; |
18 | extendedService.getPrograms = getPrograms; | 19 | extendedService.getPrograms = getPrograms; |
19 | extendedService.getProgramBySlug = getProgramBySlug; | 20 | extendedService.getProgramBySlug = getProgramBySlug; |
@@ -61,6 +62,19 @@ | @@ -61,6 +62,19 @@ | ||
61 | } | 62 | } |
62 | } | 63 | } |
63 | 64 | ||
65 | + function getTerms (cbSuccess, cbError) { | ||
66 | + if( !!CACHE.terms ){ | ||
67 | + cbSuccess(CACHE.terms); | ||
68 | + }else{ | ||
69 | + // load article content | ||
70 | + ArticleService.getArticleById(API.articleId.terms, {}, function (article){ | ||
71 | + CACHE.terms = article; | ||
72 | + | ||
73 | + cbSuccess(CACHE.terms); | ||
74 | + }, cbError); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
64 | function getThemes (cbSuccess, cbError) { | 78 | function getThemes (cbSuccess, cbError) { |
65 | if( !!CACHE.themes ){ | 79 | if( !!CACHE.themes ){ |
66 | cbSuccess(CACHE.themes); | 80 | cbSuccess(CACHE.themes); |