# HG changeset patch # User cavaliet # Date 1393262527 -3600 # Node ID f4b443fcddc7a2f0dccb7b45a71c57c18cebda73 # Parent f7c857ef0133200ebf74f14c550d1edebb057282 wikipedia fr for fragment tags diff -r f7c857ef0133 -r f4b443fcddc7 src/egonomy/models.py --- a/src/egonomy/models.py Thu Dec 05 17:11:24 2013 +0100 +++ b/src/egonomy/models.py Mon Feb 24 18:22:07 2014 +0100 @@ -105,7 +105,28 @@ @property def tag_list(self): # tags in list - return self.tags.split(",") + a = self.tags.split(",") + tl = [] + # Some tags are http://fr.wikipedia(...) urls, so we have to extract the label + for t in a: + if t[:29] == "http://fr.wikipedia.org/wiki/": + t = t[29:].replace("_"," ") + tl.append(t) + return tl + + @property + def tag_list_linked(self): + # tags in list + a = self.tags.split(",") + tl = [] + # Some tags are http://fr.wikipedia(...) urls, so we have to extract the label + for t in a: + u = "" + if t[:29] == "http://fr.wikipedia.org/wiki/": + u = t + t = t[29:].replace("_"," ") + tl.append({"label": t, "url": u}) + return tl def get_viewbox_info(self): diff -r f7c857ef0133 -r f4b443fcddc7 src/egonomy/static/egonomy/css/images/wikipedia_fr_logo.png Binary file src/egonomy/static/egonomy/css/images/wikipedia_fr_logo.png has changed diff -r f7c857ef0133 -r f4b443fcddc7 src/egonomy/static/egonomy/css/style.css --- a/src/egonomy/static/egonomy/css/style.css Thu Dec 05 17:11:24 2013 +0100 +++ b/src/egonomy/static/egonomy/css/style.css Mon Feb 24 18:22:07 2014 +0100 @@ -373,6 +373,43 @@ #info_fragment h3{ font-size: 1.4em; } #info_fragment .desc{ font-size: 0.8em; } +/* wikipedia logo */ +.logo_wikipedia{ + width: 18px; height: 12px; background: url(images/wikipedia_fr_logo.png); float: right; opacity: 0.6; +} +.clean-linked-list .logo_wikipedia{ + margin-left: 3px; + margin-top: 7px; +} +.clean-linked-list{ + background-color: #FFFFFF; + background-position: right 4px center; + background-repeat: no-repeat; + color: #7F7F7F !important; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + font-family: 'Lato'; + font-size: 12px; + height: 28px; + line-height: 28px; + padding: 0 30px 0 6px; + background-image: url("../img/icon-search.png"); +} +.clean-linked-list a{ + height: 28px; + line-height: 28px; + /*padding: 0 30px 0 6px; + background-image: url("../img/icon-search.png");*/ +} +.clean-linked-list:hover{ + box-shadow: none; +} +.clean-linked-list a{ + background: none; + padding: 0; +} + /* tests */ .svg_over_image{ opacity: 0; diff -r f7c857ef0133 -r f4b443fcddc7 src/egonomy/static/egonomy/js/main.js --- a/src/egonomy/static/egonomy/js/main.js Thu Dec 05 17:11:24 2013 +0100 +++ b/src/egonomy/static/egonomy/js/main.js Mon Feb 24 18:22:07 2014 +0100 @@ -38,7 +38,38 @@ //tag it if($('.tag-it').length){ var keywordsTagIt = $('.tag-it').tagit({ - allowSpaces : true + allowSpaces : true, + tagSource: function(search, showChoices){ + $.ajax({ + url : "http://fr.wikipedia.org/w/api.php", + dataType: "jsonp", + data : { + action: "opensearch", + search: search.term, + format: "json", + limit: 10 + }, + success:function(data){ + var datas = data[1]; + var n = datas.length; + var choices = []; + for(var i=0;i '); + } + } + } }); $('.list-key-add a').bind('click', function(e){ e.preventDefault(); diff -r f7c857ef0133 -r f4b443fcddc7 src/egonomy/templates/egonomy_view_fragment.html --- a/src/egonomy/templates/egonomy_view_fragment.html Thu Dec 05 17:11:24 2013 +0100 +++ b/src/egonomy/templates/egonomy_view_fragment.html Mon Feb 24 18:22:07 2014 +0100 @@ -154,8 +154,19 @@ {% trans "Fragment's keywords" %} :