David пре 10 година
родитељ
комит
e6af4eca18
3 измењених фајлова са 15 додато и 1 уклоњено
  1. 4 0
      db.py
  2. 4 0
      front/index.html
  3. 7 1
      front/js/app.js

+ 4 - 0
db.py

@@ -33,6 +33,10 @@ class db():
         if db_filter["scrap_date"]=={}:
             del db_filter["scrap_date"]
 
+        if "title" in filter and filter["title"] != "":
+            filter["title"]=filter["title"].replace("(","\(").replace(")","\)")
+            db_filter["title"]={"$regex":".*%s.*"%filter["title"], "$options": 'i'}
+
         if "site" in filter and filter["site"] != "":
             filter["site"]=filter["site"].replace("(","\(").replace(")","\)")
             db_filter["source_name"]={"$regex":".*%s.*"%filter["site"], "$options": 'i'}

+ 4 - 0
front/index.html

@@ -27,6 +27,10 @@
 					<li>
 						<h3><i class="fa fa-filter"></i> Filter</h3>
 					</li>
+					<li>
+						<label for="title">Article Title</label>
+						<input ng-model="title" type="text">
+					</li>
 					<li>
 						<label for="site">Site</label>
 						<input ng-model="site" type="text">

+ 7 - 1
front/js/app.js

@@ -38,7 +38,13 @@ app.controller('main', function($scope,$http,$sce) {
 	};
 	$scope.filter = function(page) {
 		var kw = $scope.selected_kw.map(function(e){return e.text});
-		$http.post("/pymnts/articles/",{"mindate":$scope.mindate,"maxdate":$scope.maxdate,"site":$scope.site,"keyword":kw,"minweight":$scope.minweight,"page":page}).then(
+		$http.post("/pymnts/articles/",{"mindate":$scope.mindate,
+										"maxdate":$scope.maxdate,
+										"site":$scope.site,
+										"keyword":kw,
+										"minweight":$scope.minweight,
+										"title":$scope.title,
+										"page":page}).then(
 			function(data) {
 				if(page==undefined)
 					$scope.curPage=1;