|
|
@@ -21,19 +21,25 @@ app.config(function($routeProvider, $locationProvider) {
|
|
|
app.controller('sources', function($scope,$http) {
|
|
|
$scope.sources=[];
|
|
|
$scope.parsed_articles=[];
|
|
|
+ $scope.sourceCategory=1;
|
|
|
+ var categories = ["PR","News"];
|
|
|
$http.get("/pymnts/sources").then(
|
|
|
function(data){
|
|
|
- $scope.sources=data.data.sources;
|
|
|
+ $scope.sources=data.data.sources.map(
|
|
|
+ function(e){
|
|
|
+ e.category=categories[e.category];
|
|
|
+ return e;
|
|
|
+ });
|
|
|
},
|
|
|
function(data){
|
|
|
}
|
|
|
);
|
|
|
- $scope.parseSource = function(source,name,sel,rss,add) {
|
|
|
+ $scope.parseSource = function(source,name,sel,rss,category, add) {
|
|
|
url="/pymnts/source/test/";
|
|
|
if(add==1)
|
|
|
url="/pymnts/source/add/";
|
|
|
|
|
|
- $http.post(url, { "source": source, "selector":sel, "rss":rss, "name":name }).then(
|
|
|
+ $http.post(url, { "source": source, "selector":sel, "rss":rss, "name":name, "category": category }).then(
|
|
|
function(data) {
|
|
|
if(!add)
|
|
|
$scope.parsed_articles=data.data.links;
|
|
|
@@ -45,6 +51,7 @@ app.controller('sources', function($scope,$http) {
|
|
|
|
|
|
});
|
|
|
app.controller('main', function($scope,$http,$sce) {
|
|
|
+ $scope.category="-1";
|
|
|
$scope.news=[];
|
|
|
$scope.newsArticle="";
|
|
|
$scope.curPage=1;
|
|
|
@@ -88,6 +95,7 @@ app.controller('main', function($scope,$http,$sce) {
|
|
|
"keyword":kw,
|
|
|
"minweight":$scope.minweight,
|
|
|
"title":$scope.title,
|
|
|
+ "category":$scope.category,
|
|
|
"page":page}).then(
|
|
|
function(data) {
|
|
|
if(page==undefined)
|