diff -r 469ad9ef43e5 -r 9788eced982a src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Mon Jan 05 15:46:20 2015 +0100 +++ b/src/hdalab/views/profile.py Mon Jan 05 17:38:36 2015 +0100 @@ -31,7 +31,7 @@ from hdalab.models.renkan import HdalabRenkan from hdalab.views.ajax import filter_generic from renkanmanager.models import Renkan -from renkanmanager.utils import LineNodePlacer, renkan_copier, renkan_deleter,\ +from renkanmanager.utils import LineNodePlacer, HorLineNodePlacer, renkan_copier, renkan_deleter,\ CircleNodePlacer from renkanmanager.views import RenkanGetPut import json @@ -142,6 +142,7 @@ template_name="renkan_edit.html" def get_context_data(self, **kwargs): + switch_shape_url= {} context = super(RenkanEdit, self).get_context_data(**kwargs) # If a renkan id is set rk_id = self.request.GET.get("rk_id", "") @@ -153,10 +154,16 @@ form = AuthenticationForm(self.request) context["form"] = form current_url = self.request.get_full_path() - if "shape=circle" in current_url: - switch_shape_url = current_url.replace("&shape=circle", "") + switch_shape_url["current"] = current_url + if "shape=horiz" in current_url: + switch_shape_url["vert"] = current_url.replace("&shape=horiz", "&shape=vert") + switch_shape_url["circle"] = current_url.replace("&shape=horiz", "") + elif "shape=vert" in current_url: + switch_shape_url["horiz"] = current_url.replace("&shape=vert", "&shape=horiz") + switch_shape_url["circle"] = current_url.replace("&shape=vert", "") else: - switch_shape_url = current_url + "&shape=circle" + switch_shape_url["horiz"] = current_url + "&shape=horiz" + switch_shape_url["vert"] = current_url + "&shape=vert" context["switch_shape_url"] = switch_shape_url return context @@ -218,9 +225,12 @@ # We get the ORDERED tags if we display one sheet ordered_tags = TaggedSheet.objects.filter(datasheet=notice).select_related("tag", "tag__dbpedia_fields", "tag__category").order_by('order')[:15] # Prepare Node placer : - np = LineNodePlacer() - if shape=="circle": - np = CircleNodePlacer() + np = CircleNodePlacer() + if shape=="horiz": + np = HorLineNodePlacer() + elif shape=="vert": + np = LineNodePlacer() + np.init({"datasheet": (1, 1), "tags": (2, len(ordered_tags))}) # Place notice : content["nodes"].append({