|
27 | 27 |
|
28 | 28 |
|
29 | 29 | angular.module('adf.widget.news', ['adf.provider']) |
30 | | - .value('newsServiceUrl', 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=JSON_CALLBACK&q=') |
| 30 | + .constant('newsServiceUrl', '') |
31 | 31 | .config(RegisterWidget); |
32 | 32 |
|
33 | 33 | function RegisterWidget(dashboardProvider){ |
@@ -59,7 +59,7 @@ function RegisterWidget(dashboardProvider){ |
59 | 59 | RegisterWidget.$inject = ["dashboardProvider"]; |
60 | 60 |
|
61 | 61 | angular.module("adf.widget.news").run(["$templateCache", function($templateCache) {$templateCache.put("{widgetsPath}/news/src/edit.html","<form role=form><div class=form-group><label for=url>Feed url</label> <input type=url class=form-control id=url ng-model=config.url placeholder=\"Enter feed url\"></div><div class=form-group><label for=num>Number of Entries</label> <input type=number class=form-control id=num ng-model=config.num></div><div class=form-group><label for=showTitle>Show Feed Title</label> <input type=checkbox class=form-control id=showTitle ng-model=config.showTitle></div><div class=form-group><label for=showTitle>Show Feed Description</label> <input type=checkbox class=form-control id=showDescription ng-model=config.showDescription></div></form>"); |
62 | | -$templateCache.put("{widgetsPath}/news/src/view.html","<div class=news><div class=\"alert alert-info\" ng-if=!vm.feed>Please insert a feed url in the widget configuration</div><div ng-if=vm.feed><h3 ng-if=config.showTitle><a ng-href={{vm.feed.link}} target=_blank>{{vm.feed.title}}</a></h3><p ng-if=config.showDescription>{{vm.feed.description}}</p><div class=media ng-repeat=\"entry in vm.feed.entries\"><div class=media-body><h4 class=media-heading><a ng-href={{entry.link}} target=_blank>{{entry.title}}</a></h4><p>{{entry.contentSnippet}}</p><small>{{entry.author}}, {{entry.publishedDate | toDate | date: \'yyyy-MM-dd HH:mm\'}}</small></div></div></div></div>");}]); |
| 62 | +$templateCache.put("{widgetsPath}/news/src/view.html","<div class=news><div class=\"alert alert-info\" ng-if=!vm.feed>Please insert a feed url in the widget configuration</div><div ng-if=vm.feed><h3 ng-if=config.showTitle><a ng-href={{vm.feed.link}} target=_blank>{{vm.feed.title}}</a></h3><p ng-if=config.showDescription>{{vm.feed.description}}</p><div class=media ng-repeat=\"entry in vm.feed.entries\"><div class=media-body><h4 class=media-heading><a ng-href={{entry.link}} target=_blank>{{entry.title}}</a></h4><p>{{entry.contentSnippet}}</p><small>{{ (entry.author) ? entry.author + \',\' : \'\' }} {{entry.pubDate | toDate | date: \'yyyy-MM-dd HH:mm\'}}</small></div></div></div></div>");}]); |
63 | 63 | /* |
64 | 64 | * The MIT License |
65 | 65 | * |
@@ -102,10 +102,10 @@ function NewsService($q, $http, newsServiceUrl){ |
102 | 102 | var deferred = $q.defer(); |
103 | 103 | $http.jsonp(createUrl(config)) |
104 | 104 | .success(function(data){ |
105 | | - if (data && data.responseData && data.responseData.feed){ |
106 | | - deferred.resolve(data.responseData.feed); |
| 105 | + if (data && data.feed){ |
| 106 | + deferred.resolve(data.feed); |
107 | 107 | } else { |
108 | | - deferred.reject('feed does not contain responseData element'); |
| 108 | + deferred.reject('response does not contain feed element'); |
109 | 109 | } |
110 | 110 | }) |
111 | 111 | .error(function(err){ |
|
0 commit comments