debug remove tags and 0.8.4 V00.08.04
authorcavaliet
Tue, 25 Feb 2014 16:23:35 +0100
changeset 258 bfa951bac3e3
parent 257 47dd76d18891
child 259 3d524eac1231
debug remove tags and 0.8.4
src/egonomy/__init__.py
src/egonomy/static/egonomy/js/main.js
--- a/src/egonomy/__init__.py	Tue Feb 25 15:37:36 2014 +0100
+++ b/src/egonomy/__init__.py	Tue Feb 25 16:23:35 2014 +0100
@@ -1,4 +1,4 @@
-VERSION = (0, 8, 3, "final", 1)
+VERSION = (0, 8, 4, "final", 1)
 
 VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2])))
 
--- a/src/egonomy/static/egonomy/js/main.js	Tue Feb 25 15:37:36 2014 +0100
+++ b/src/egonomy/static/egonomy/js/main.js	Tue Feb 25 16:23:35 2014 +0100
@@ -244,6 +244,9 @@
 	            focus: function(e, ui) {
                     showDbpediaBox(ui.item.dbpedia_uri);
                     setDbpediaBoxAnchor({type: "dom", selector: $(e.target).autocomplete("widget"), positioning: "side"});
+	            },
+	            close: function(e, ui){
+	            	hideDbpediaBox();
 	            }
 	        },
             beforeTagAdded: function(event, ui) {
@@ -254,6 +257,17 @@
                 		$(ui.tag.children()[0]).html(label + ' <a href="' + tagit_label + '" target="_blank"><span class="logo_wikipedia f-right">&nbsp;</span></a>');
                 	}
                 }
+                hideDbpediaBox();
+            },
+            beforeTagRemoved: function(event, ui) {
+                // test if tag label is wikipedia url
+                if($(ui.tag.children()[0]).children().length>0){
+                	var $a_tag = $($(ui.tag.children()[0]).children()[0]);
+                	if($a_tag.attr("href").substr(0, 29) == 'http://fr.wikipedia.org/wiki/'){
+                		// Before removing, turn label into url
+                		$(ui.tag.children()[0]).html($a_tag.attr("href").replace(new RegExp(" ","g"),"_"));
+                	}
+                }
             }
 		});
 		$('.list-key-add a').bind('click', function(e){