link to change renkan shape to circle
authorcavaliet
Wed, 24 Sep 2014 13:07:08 +0200
changeset 336 aec074085a81
parent 335 51225e522007
child 337 46cd7ba5bbec
link to change renkan shape to circle
src/hdalab/static/hdalab/css/additionnal_renkan.css
src/hdalab/static/hdalab/js/renkan-manual-save.js
src/hdalab/templates/renkan_edit.html
src/hdalab/views/profile.py
--- a/src/hdalab/static/hdalab/css/additionnal_renkan.css	Tue Sep 23 15:51:35 2014 +0200
+++ b/src/hdalab/static/hdalab/css/additionnal_renkan.css	Wed Sep 24 13:07:08 2014 +0200
@@ -12,10 +12,11 @@
     width: 100%;
 }
 .rnk-wrapper{
-    height: 100%;
+    height: 755px;
     -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
     box-sizing: border-box;
+    position: relative;
 }
 .Rk-HdaNotices-Title-Icon {
     background: url("../img/page_icon.png") no-repeat -3px -5px;
@@ -30,4 +31,14 @@
 }
 .Rk-HdaTags-Search-Icon {
     background: url("../img/tag_purple.png") no-repeat 5px 2px;
+}
+/* help */
+.renkan_help{
+    font-size: 12px;
+    height: 15px;
+    margin-bottom: 10px;
+    width: 100%;
+}
+#toggle-help{
+    float: right;
 }
\ No newline at end of file
--- a/src/hdalab/static/hdalab/js/renkan-manual-save.js	Tue Sep 23 15:51:35 2014 +0200
+++ b/src/hdalab/static/hdalab/js/renkan-manual-save.js	Wed Sep 24 13:07:08 2014 +0200
@@ -5,7 +5,9 @@
         _saveWarn = false,
         _onLeave = function() {
             return "Project not saved";
-        };
+        },
+        canRemoveChangeShape = false,
+        changeShapeRemoved = false;
     if (typeof _opts.http_method === "undefined") {
         _opts.http_method = 'POST';
     }
@@ -26,6 +28,7 @@
             	if(_opts.user_authenticated==true){
             	    $(".Rk-Save-Button").addClass("Rk-Save-Online");
             	}
+            	canRemoveChangeShape = true;
             }
         });
     };
@@ -66,8 +69,16 @@
     _proj.on("add:nodes add:edges add:users change", function(_model) {
         _model.on("change remove", function(_model) {
             _checkLeave();
+            if(canRemoveChangeShape && !changeShapeRemoved){
+                $("#circle-shape").html("");
+                changeShapeRemoved = true;
+            }
         });
         _checkLeave();
+        if(canRemoveChangeShape && !changeShapeRemoved){
+            $("#circle-shape").html("");
+            changeShapeRemoved = true;
+        }
     });
     _renkan.renderer.save = function() {
         //console.log("manual save _opts.user_authenticated = ", _opts.user_authenticated);
--- a/src/hdalab/templates/renkan_edit.html	Tue Sep 23 15:51:35 2014 +0200
+++ b/src/hdalab/templates/renkan_edit.html	Wed Sep 24 13:07:08 2014 +0200
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load static %}
+{% load i18n %}
 
 {% block title %}{{block.super}} > {{datasheet.title}}{% endblock %}
 
@@ -127,6 +128,10 @@
 <div id="dialog-form" title="Identification">
 	{% include 'ajax_identification/ajax_login.html' %}
 </div>
+<div class="renkan_help">
+  <span id="circle-shape"><a href="{{ switch_shape_url }}">{% if 'shape=circle' in switch_shape_url %}{% trans 'See the graph in circle' %}{% else %}{% trans 'See the graph in lines' %}{% endif %}</a></span>
+  <span id="toggle-help">{% trans 'Need help ?' %}</span>
+</div>
 <div class="rnk-wrapper">
   <div class="rnk-container">
     <div id="renkan"></div>
--- a/src/hdalab/views/profile.py	Tue Sep 23 15:51:35 2014 +0200
+++ b/src/hdalab/views/profile.py	Wed Sep 24 13:07:08 2014 +0200
@@ -121,6 +121,12 @@
         
         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", "")
+        else:
+            switch_shape_url = current_url + "&shape=circle"
+        context["switch_shape_url"] = switch_shape_url
         
         return context