# HG changeset patch # User cavaliet # Date 1411574039 -7200 # Node ID 2df551ebddefa1aaf1be50a835fc3519c9d9c8c1 # Parent 46cd7ba5bbec19f5919842884bddc725a0f406a2 renkan now has period filter diff -r 46cd7ba5bbec -r 2df551ebddef src/hdalab/static/hdalab/js/gomina.js --- a/src/hdalab/static/hdalab/js/gomina.js Wed Sep 24 16:03:14 2014 +0200 +++ b/src/hdalab/static/hdalab/js/gomina.js Wed Sep 24 17:53:59 2014 +0200 @@ -203,6 +203,10 @@ if (_curView.type != 'filter') { return; } + // Prepare renkan link + var url_renkan = $("#renkan-link").attr("href"); + url_renkan = ((url_renkan.lastIndexOf("?")>=0) ? (url_renkan.substr(0, url_renkan.lastIndexOf("?"))) : url_renkan) + "?"; + // Filter var _htmFilters = '', _fl = _curView.tag.length, _cl = _curView.country.length; @@ -214,6 +218,7 @@ + ' ' + gettext('a')+' ' + _curView.period[1] + '[x]'; + url_renkan += "period=" + _curView.period[0] + "," + _curView.period[1] } $("#handle_0").css({ "left" : yearToPx(_curView.period[0])+"px", @@ -229,11 +234,8 @@ .css({ "margin-left" : "0" }); - // modif renkan - var url_renkan = $("#renkan-link").attr("href"); - url_renkan = ((url_renkan.lastIndexOf("?")>=0) ? (url_renkan.substr(0, url_renkan.lastIndexOf("?"))) : url_renkan) + "?"; if (_cl) { - url_renkan += "country="; + url_renkan += "&country="; _htmFilters += _(_curView.country).map(function(_t, _i) { // dbpedia uri for renkan url url_renkan += "," + ( (typeof gomNs.countries == "object" && typeof gomNs.countries[_t] == "object") ? _t : decodeURIComponent(_t.match('[^/]+$')[0]).replace('_',' ')); diff -r 46cd7ba5bbec -r 2df551ebddef src/hdalab/templates/renkan_edit.html --- a/src/hdalab/templates/renkan_edit.html Wed Sep 24 16:03:14 2014 +0200 +++ b/src/hdalab/templates/renkan_edit.html Wed Sep 24 17:53:59 2014 +0200 @@ -131,7 +131,8 @@ nexttext: "{% trans 'Next' %}", prevtext: "{% trans 'Previous' %}", showmarkers : true, - centermarkers : true + centermarkers : true, + automatic: false }); $("#toggle-help").click(function(){ $('#help-container').toggle(); diff -r 46cd7ba5bbec -r 2df551ebddef src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Wed Sep 24 16:03:14 2014 +0200 +++ b/src/hdalab/views/profile.py Wed Sep 24 17:53:59 2014 +0200 @@ -21,6 +21,7 @@ from django.template.response import TemplateResponse from django.templatetags.static import static from django.utils.http import is_safe_url +from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt, csrf_protect from django.views.decorators.debug import sensitive_post_parameters @@ -325,6 +326,7 @@ # Get tags and countries labels = request.GET.get("label", "").split(",") countries = request.GET.get("country", "").split(",") + period = request.GET.get("period", None) # Tags arrive with french label, countries with dbpedia uri label_list = [t for t in labels if t!=""] country_list = [c for c in countries if c!=""] @@ -332,7 +334,7 @@ # Get datasheets from ajax filter search - filter_output = filter_generic(lang, None, ",".join(label_list), ",".join(country_list), content_count=10) + 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)) @@ -378,7 +380,10 @@ np = LineNodePlacer() if shape=="circle": np = CircleNodePlacer() - np.init({"tags": (1, len(all_tags)), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags))}) + len_tags = len(all_tags) + if period: + len_tags += 1 + np.init({"tags": (1, len_tags), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags))}) for t in all_tags: img_url = t.dbpedia_fields.thumbnail if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields and t.dbpedia_fields.thumbnail else None @@ -398,6 +403,20 @@ #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7", "shape": shapes["tag1"] }) + if period: + content["nodes"].append({ + "id": unicode(uuid.uuid1()), + "title": _("Period") + " : " + period, + "description": "", + "uri": "", + "position": np.get_place("tags"), + "image": cat_dict[u"Datation"], + "size": 0, + "project_id": project_id, + "color": None, + #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7", + "shape": shapes["tag1"] + }) for c in filter_output["contents"]: content["nodes"].append({