Close #40 - get only 8 ressources in the renkan and send the 10 next to the bins for further use
authorrougeronj
Mon, 02 Feb 2015 12:40:31 +0100
changeset 437 8269c74d9aa0
parent 436 deb24a52827f
child 438 e9d8f42cd664
Close #40 - get only 8 ressources in the renkan and send the 10 next to the bins for further use
src/hdalab/static/hdalab/js/renkan-manual-save.js
src/hdalab/views/profile.py
--- a/src/hdalab/static/hdalab/js/renkan-manual-save.js	Fri Jan 30 12:14:38 2015 +0100
+++ b/src/hdalab/static/hdalab/js/renkan-manual-save.js	Mon Feb 02 12:40:31 2015 +0100
@@ -28,6 +28,9 @@
                 _proj.set(_data, {validate: true});
 				_proj.set({loading_status:false});
                 _proj.set({save_status:0});
+                if (typeof(_data.bins) != 'undefined'){
+	                _renkan.tabs.push(new Rkns[_data.bins.type].Bin(_renkan, _data.bins));
+                }
             	_renkan.renderer.autoScale();
             	
             	// Green color when user is authenticated
--- a/src/hdalab/views/profile.py	Fri Jan 30 12:14:38 2015 +0100
+++ b/src/hdalab/views/profile.py	Mon Feb 02 12:40:31 2015 +0100
@@ -394,13 +394,24 @@
         country_list = [c for c in countries if c!=""]
         all_tags = Tag.objects.filter( Q(label__in=label_list) | Q(dbpedia_uri__in=country_list) ).select_related("dbpedia_fields", "category")
         
+        # Get datasheets from ajax filter search
+        temp_fitler = filter_generic(lang, period, ",".join(label_list), ",".join(country_list), content_count=18)
+        filter_output = json.loads(temp_fitler)
+        filter_output_to_bin = json.loads(temp_fitler)
         
-        # Get datasheets from ajax filter search
-        filter_output = filter_generic(lang, period, ",".join(label_list), ",".join(country_list), content_count=10)
-        filter_output = json.loads(filter_output)
-        #logger.debug("COUCOU")
-        #logger.debug(json.dumps(filter_output, indent=2))
-        #return HttpResponse(json.dumps(filter_output, indent=2), content_type="application/json")
+        #Keep only the 8 first ressources to create the graph
+        #the 10 next are sent to the bins
+        for i in range(len(filter_output["contents"])):
+            if (i < 8):
+                del filter_output_to_bin["contents"][0]
+            else:
+                del filter_output["contents"][8]
+
+        content["bins"] = {
+          "type": "ResourceList",
+          "title": "Plus de Ressources",
+          "list": filter_output_to_bin["contents"]
+        }
         
         # Prepare other tags
         related_tags = []