Separated Thesaurus and WP Categories
authorveltr
Thu, 11 Oct 2012 18:22:45 +0200
changeset 252 a46461f8a74f
parent 251 e6675a5b2195
child 253 1113c3874dd6
Separated Thesaurus and WP Categories
web/hdalab/static/hdalab/css/cattree.css
web/hdalab/static/hdalab/css/common.css
web/hdalab/static/hdalab/css/index.css
web/hdalab/static/hdalab/css/thesaurus.css
web/hdalab/static/hdalab/css/trees.css
web/hdalab/static/hdalab/img/categories-thumb.jpg
web/hdalab/static/hdalab/img/completion-thumb.jpg
web/hdalab/static/hdalab/img/facettes-preview.jpg
web/hdalab/static/hdalab/img/facettes-thumb.jpg
web/hdalab/static/hdalab/img/thesaurus-thumb.jpg
web/hdalab/static/hdalab/js/cattree.js
web/hdalab/static/hdalab/js/thesaurus.js
web/hdalab/static/hdalab/js/trees.js
web/hdalab/templates/base.html
web/hdalab/templates/categories.html
web/hdalab/templates/index.html
web/hdalab/templates/thesaurus.html
web/hdalab/urls.py
web/hdalab/views/ajax.py
--- a/web/hdalab/static/hdalab/css/cattree.css	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/static/hdalab/css/cattree.css	Thu Oct 11 18:22:45 2012 +0200
@@ -19,10 +19,6 @@
     background: #ffffff; width: 260px; font-size: 14px; font-weight: bold; margin: 5px 0;
 }
 
-.hidden {
-    display: none;
-}
-
 .results {
     margin-top: 30px;
 }
@@ -54,119 +50,3 @@
 div.cattree {
     margin: 10px 0 0 320px;
 }
-
-.cattree p.theme {
-    color: #000080;
-}
-
-.cattree .content p.title {
-    font-weight: bold; cursor: pointer;
-}
-
-.cattree .content p.title:before {
-    font-weight: normal;
-}
-
-.cattree .score_0, .cattree .score_1 {
-    color: #80d080;
-}
-
-.cattree .score_2, .cattree .score_3, .cattree .score_4 {
-    color: #409840;
-}
-
-.cattree .score_5, .cattree .score_6, .cattree .score_7 {
-    color: #006000;
-}
-
-.cattree .score_0:before, .cattree .score_1:before {
-    content: "★☆☆ ";
-}
-
-.cattree .score_2:before, .cattree .score_3:before, .cattree .score_4:before {
-    content: "★★☆ ";
-}
-
-.cattree .score_5:before, .cattree .score_6:before, .cattree .score_7:before {
-    content: "★★★ ";
-}
-
-.cattree .img-container {
-    float: left; margin: 10px 0 0; width: 60px; height: 50px; background: #dddddd;
-}
-
-.cattree .img-container img {
-    min-width: 30px; max-width: 60px; max-height: 50px; margin: 0px auto;
-}
-
-.cattree .content p.description {
-    margin: 4px 0 4px 64px; font-size: 12px; min-height: 50px;
-}
-
-.cattree li, .cattree p.theme {
-    margin: 4px 0; font-size: 13px; position: relative;
-}
-
-.cattree p.theme {
-    font-weight: bold; cursor: pointer;
-}
-
-.cattree p.theme:after {
-    content: " [-]"
-}
-
-.cattree .folded p.theme:after {
-    content: " [+]"
-}
-
-.cattree ul {
-    list-style: none; position: relative; padding: 0; margin: 0;
-}
-
-.cattree .folded ul {
-    display: none;
-}
-
-.cattree .foldedcontent {
-    height: 0px; overflow: hidden;
-}
-
-.cattree .show_more {
-    color: #800000; font-style: italic; cursor: pointer;
-}
-
-.cattree li {
-    list-style: none;
-}
-
-.cattree ul li {
-    margin-left: 38px;
-}
-
-.cattree ul li:after {
-   content: ""; position: absolute; left: -50px; top: 9px; width: 40px; bottom: 0; border-style: solid none none solid; border-width: 1px; border-color: #333;
-}
-
-.cattree ul li:before {
-    content: ""; position: absolute; left: -50px; top: -10px; height: 19px; width: 1px; background: #333;
-}
-
-.cattree ul li:last-child:after {
-    border-style: solid none none;
-}
-
-.cattree .eltype {
-    font-style: italic; display: none;
-}
-
-li.themeli {
-    list-style: square;
-}
-
-li.content {
-    list-style: disc;
-}
-
-.loading {
-    height: 128px; background: url(../img/loader.gif) no-repeat center;
-}
--- a/web/hdalab/static/hdalab/css/common.css	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/static/hdalab/css/common.css	Thu Oct 11 18:22:45 2012 +0200
@@ -105,6 +105,7 @@
 
 #nav li {
     float: left; font-size: 14px; margin-left: 15px; font-weight: bold;
+    color: #CCCCCC;
 }
 
 #nav a {
--- a/web/hdalab/static/hdalab/css/index.css	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/static/hdalab/css/index.css	Thu Oct 11 18:22:45 2012 +0200
@@ -49,15 +49,15 @@
 }
 
 .bloc-appli {
-    width: 475px; float: left;
+    width: 310px; float: left;
 }
 
 .separateur-applis {
-    width: 10px; height: 100px; float: left;
+    width: 15px; height: 100px; float: left;
 }
 
 .fond-bloc {
-    cursor: pointer; height: 295px; margin: 5px 0 15px; padding: 5px;
+    cursor: pointer; height: 290px; margin: 5px 0 15px; padding: 5px;
 }
 
 .overlay-bloc {
@@ -76,8 +76,8 @@
     background: url(../img/categories-thumb.jpg);
 }
 
-#bloc-completion {
-    background: url(../img/completion-thumb.jpg);
+#bloc-thesaurus {
+    background: url(../img/thesaurus-thumb.jpg);
 }
 
 .mini-table {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdalab/static/hdalab/css/thesaurus.css	Thu Oct 11 18:22:45 2012 +0200
@@ -0,0 +1,13 @@
+.column {
+    float: left; width: 449px;
+    padding-left: 20px;
+}
+
+.separator {
+    float: left; width: 1px; height: 500px; margin: 30px 10px 0; background: #666;
+}
+
+.column h3 {
+    font-size: 14px; font-weight: bold;
+    margin: 10px 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdalab/static/hdalab/css/trees.css	Thu Oct 11 18:22:45 2012 +0200
@@ -0,0 +1,121 @@
+.hidden {
+    display: none;
+}
+
+.cattree .content p.title {
+    font-weight: bold; cursor: pointer;
+}
+
+.cattree .content p.title:before {
+    font-weight: normal;
+}
+
+.cattree .score_0, .cattree .score_1 {
+    color: #80d080;
+}
+
+.cattree .score_2, .cattree .score_3, .cattree .score_4 {
+    color: #409840;
+}
+
+.cattree .score_5, .cattree .score_6, .cattree .score_7 {
+    color: #006000;
+}
+
+.cattree .score_0:before, .cattree .score_1:before {
+    content: "★☆☆ ";
+}
+
+.cattree .score_2:before, .cattree .score_3:before, .cattree .score_4:before {
+    content: "★★☆ ";
+}
+
+.cattree .score_5:before, .cattree .score_6:before, .cattree .score_7:before {
+    content: "★★★ ";
+}
+
+.cattree .img-container {
+    float: left; margin: 10px 0 0; width: 60px; height: 50px; background: #dddddd;
+}
+
+.cattree .img-container img {
+    min-width: 30px; max-width: 60px; max-height: 50px; margin: 0px auto;
+}
+
+.cattree .content p.description {
+    margin: 4px 0 4px 64px; font-size: 12px; min-height: 50px;
+}
+
+.cattree li, .cattree p.theme {
+    margin: 4px 0; font-size: 12px; position: relative;
+}
+
+.cattree p.theme {
+    color: #000080; height: 20px; cursor: pointer;
+}
+
+.cattree p.theme:after {
+    font-weight: bold;
+    content: " [-]"
+}
+
+.cattree .folded p.theme:after {
+    font-weight: bold;
+    content: " [+]"
+}
+
+.cattree .theme span {
+    font-weight: bold; line-height: 12px;
+}
+
+.cattree ul {
+    list-style: none; position: relative; padding: 0; margin: 0;
+}
+
+.cattree .folded ul {
+    display: none;
+}
+
+.cattree .foldedcontent {
+    height: 0px; overflow: hidden;
+}
+
+.cattree .show_more {
+    color: #800000; font-style: italic; cursor: pointer;
+}
+
+.cattree li {
+    list-style: none;
+}
+
+.cattree ul li {
+    margin-left: 38px;
+}
+
+.cattree ul li:after {
+   content: ""; position: absolute; left: -50px; top: 9px; width: 40px; bottom: 0; border-style: solid none none solid; border-width: 1px; border-color: #333;
+}
+
+.cattree ul li:before {
+    content: ""; position: absolute; left: -50px; top: -10px; height: 19px; width: 1px; background: #333;
+}
+
+.cattree ul li:last-child:after {
+    border-style: solid none none;
+}
+
+.cattree .eltype {
+    font-style: italic; display: none;
+}
+
+.cattree li.themeli {
+    list-style: square;
+}
+
+.cattree li.content {
+    list-style: disc;
+}
+
+.loading {
+    height: 128px; background: url(../img/loader.gif) no-repeat center;
+}
\ No newline at end of file
Binary file web/hdalab/static/hdalab/img/categories-thumb.jpg has changed
Binary file web/hdalab/static/hdalab/img/completion-thumb.jpg has changed
Binary file web/hdalab/static/hdalab/img/facettes-preview.jpg has changed
Binary file web/hdalab/static/hdalab/img/facettes-thumb.jpg has changed
Binary file web/hdalab/static/hdalab/img/thesaurus-thumb.jpg has changed
--- a/web/hdalab/static/hdalab/js/cattree.js	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/static/hdalab/js/cattree.js	Thu Oct 11 18:22:45 2012 +0200
@@ -1,235 +1,12 @@
-var trees = [
-    {
-        title: "Thésaurus de l'Architecture et de l'Urbanisme : Secteur urbain",
-        tree: {
-            label: "secteur urbain",
-            contents: [
-                {
-                    label: "banlieue",
-                    contents: [
-                        {
-                            label: "faubourg"
-                        }
-                    ]
-                },
-                {
-                    label: "îlot"
-                },
-                {
-                    label: "quartier",
-                    contents: [
-                        {
-                            label: "centre-ville"
-                        }
-                    ]
-                },
-                {
-                    label: "secteur urbain concerté",
-                    contents: [
-                        {
-                            label: "grand ensemble"
-                        },
-                        {
-                            label: "lotissement",
-                            contents: [
-                                {
-                                    label: "lotissement concerté",
-                                    contents: [
-                                        {
-                                            label: "cité-jardin"
-                                        },
-                                        {
-                                            label: "cité ouvrière"
-                                        },
-                                        {
-                                            label: "courée"
-                                        },
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                },
-            ]
-        }
-    },
-    {
-        title: "Thésaurus Garnier : Architecture d'habitation",
-        tree: {
-            label: "architecture d'habitation",
-            contents: [
-                {
-                    label: "cité-jardin"
-                },
-                {
-                    label: "édifice d'habitation",
-                    contents: [
-                        {
-                            label: "demeure",
-                            contents: [
-                                {
-                                    label: "chalet"
-                                },
-                                {
-                                    label: "château"
-                                },
-                                {
-                                    label: "château-fort",
-                                    contents: [
-                                        {
-                                            label: "chemin de ronde"
-                                        },
-                                        {
-                                            label: "donjon"
-                                        }
-                                    ]
-                                },
-                                {
-                                    label: "hôtel particulier"
-                                },
-                                {
-                                    label: "maison"
-                                },
-                                {
-                                    label: "manoir"
-                                },
-                                {
-                                    label: "palais"
-                                }
-                            ]
-                        },
-                        {
-                            label: "abri",
-                            contents: [
-                                {
-                                    label: "buron"
-                                },
-                                {
-                                    label: "cabane"
-                                },
-                                {
-                                    label: "campement",
-                                    contents: [
-                                        {
-                                            label: "tente"
-                                        },
-                                        {
-                                            label: "tipi"
-                                        },
-                                        {
-                                            label: "igloo"
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                }
-            ]
-        }
-    },
-    {
-        title: "Thésaurus Garnier : Sciences occultes",
-        tree: {
-            label: "sciences occultes",
-            contents: [
-                {
-                    label: "alchimie"
-                },
-                {
-                    label: "astrologie"
-                },
-                {
-                    label: "divination"
-                },
-                {
-                    label: "magie",
-                    contents: [
-                        {
-                            label: "sorcellerie"
-                        },
-                        {
-                            label: "sorcière"
-                        }
-                    ]
-                }
-            ]
-        }
-    }
-]
-
-function render(_data, _level) {
-    _data.theme_count =
-        (typeof _data.sub_categories == "object" && typeof _data.sub_categories.slice == "function" ? _data.sub_categories.length : 0)
-        + (typeof _data.tags == "object" && typeof _data.tags.slice == "function" ? _data.tags.length : 0);
-    _data.contents_count = (typeof _data.contents == "object" && typeof _data.contents.slice == "function" ? _data.contents.length : 0);
-    _data.level = !!_level;
-    _(_data.tags).each(function(_tag) {
-        _(_tag.contents).each(function(_content, _key) {
-            _content.trimmed_description = _content.description.trim().replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{150,200})[\s].+$/m,'$1…');
-            _content.hidden = (_key >= 5);
-        });
-        _tag.show_more = _tag.contents && _tag.contents.length > 5 ? _tag.contents.length - 5 : 0;
-    });
-    _(_data.contents).each(function(_content, _key) {
-        _content.trimmed_description = _content.description.trim().replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{150,200})[\s].+$/m,'$1…');
-        _content.hidden = (_key >= 5);
-    });
-    _data.show_more = _data.contents && _data.contents.length > 5 ? _data.contents.length - 5 : 0;
-    var _prefix = '<li class="themeli {{#level}}folded {{/level}}"><p class="theme">{{category}} &mdash; {{#theme_count}}{{theme_count}} thème(s){{#contents_count}}, {{/contents_count}}{{/theme_count}}{{#contents_count}}{{contents_count}} ressource(s){{/contents_count}}</p><ul>',
-        _contents = '{{#contents}}<li class="content{{#hidden}} hidden{{/hidden}}" id="content_{{id}}"><p class="title score_{{score}}">{{title}}</p><div class="foldedcontent"><div class="img-container"><img src="http://www.histoiredesarts.culture.fr/images/cached/images/{{hda_id}}.jpg" />'
-            + '</div><p class="description">Source: {{organization}}<br /><a href="{{url}}" target="_blank" class="content">{{trimmed_description}}</a></p></div></li>{{/contents}}{{#show_more}}<li class="show_more">Plus de contenus (<span class="show_more_count">{{show_more}}</span>)&hellip;</li>{{/show_more}}',
-        _suffix = '{{#tags}}<li class="themeli folded"><p class="theme">{{label}} &mdash; {{contents.length}} ressource(s)</p><ul>'
-            + _contents
-            + '</ul></li>{{/tags}}'
-            + _contents
-            + '</ul></li>',
-        _html = Mustache.to_html(_prefix, _data);
-    if (typeof _data.sub_categories == "object" && typeof _data.sub_categories.slice == "function") {
-        for (var _i = 0; _i < _data.sub_categories.length; _i++) {
-            _html += render(_data.sub_categories[_i], _level + 1);
-        }
-    }
-    _html += Mustache.to_html(_suffix, _data);
-    return _html;
-}
-
 function showData(_label, _data) {
-    $(".disciplist li, .theslist li").each(function() {
+    $(".disciplist li").each(function() {
         if ($(this).text().trim().toLowerCase() === _label.toLowerCase()) {
             $(this).addClass("selected");
         }
     })
     $(".label-name").html(_label);
     if (_data) {
-        $("#tree").html(render(_data, 0));
-        $(".cattree p.theme").click(function() {
-            $(this).parent().toggleClass("folded")
-            return false;
-        });
-        $("li.content").mouseenter(function() {
-            $(this).find(".foldedcontent")
-            .dequeue()
-            .animate({
-                height: 5 + $(this).find("p.description").outerHeight()
-            },
-            500);
-        }).mouseleave(function() {
-            $(this).find(".foldedcontent")
-            .dequeue()
-            .animate({
-                height: "0"
-            },
-            500);
-        });
-        $(".show_more").click(function() {
-            $(this).siblings(".hidden:lt(5)").removeClass("hidden");
-            var _l = $(this).siblings(".hidden").length;
-            $(this).find(".show_more_count").html(_l);
-            if (!_l) {
-                $(this).detach();
-            } 
-        })
+        renderData($("#tree"), _data);
         $(".results").show();
         $(".content-count").html($(".cattree a.content").length);
         $(".category-count").html(Math.max(0, $("p.category").length - 1));
@@ -241,7 +18,7 @@
 }
 
 function gettree(_label) {
-    $(".disciplist li, .theslist li").removeClass("selected");
+    $(".disciplist li").removeClass("selected");
     $("#tree").html('<div class="loading"></div>');
     $.getJSON(
         endpoints.cat_tree,
@@ -280,21 +57,4 @@
     $(".disciplist li").click(function() {
         gettree($(this).text().trim());
     });
-    _(trees).each(function(_tree) {
-        $("<li></li>")
-            .html($('<a href="#"></a>').text(_tree.title))
-            .appendTo(".theslist")
-            .click(function() {
-                $(".disciplist li, .theslist li").removeClass("selected");
-                $("#tree").html('<div class="loading"></div>');
-                $.getJSON(
-                    endpoints.fill_tree,
-                    { tree: JSON.stringify(_tree.tree) },
-                    function(_data) {
-                        showData(_tree.title, _data);
-                    }
-                );
-                return false;
-            });
-    });
 });
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdalab/static/hdalab/js/thesaurus.js	Thu Oct 11 18:22:45 2012 +0200
@@ -0,0 +1,173 @@
+var trees = [
+    {
+        title: "Thésaurus de l'Architecture et de l'Urbanisme : Secteur urbain",
+        tree: {
+            label: "secteur urbain",
+            contents: [
+                {
+                    label: "banlieue",
+                    contents: [
+                        {
+                            label: "faubourg"
+                        }
+                    ]
+                },
+                {
+                    label: "îlot"
+                },
+                {
+                    label: "quartier",
+                    contents: [
+                        {
+                            label: "centre-ville"
+                        }
+                    ]
+                },
+                {
+                    label: "secteur urbain concerté",
+                    contents: [
+                        {
+                            label: "grand ensemble"
+                        },
+                        {
+                            label: "lotissement",
+                            contents: [
+                                {
+                                    label: "lotissement concerté",
+                                    contents: [
+                                        {
+                                            label: "cité-jardin"
+                                        },
+                                        {
+                                            label: "cité ouvrière"
+                                        },
+                                        {
+                                            label: "courée"
+                                        },
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                },
+            ]
+        }
+    },
+    {
+        title: "Thésaurus Garnier : Architecture d'habitation",
+        tree: {
+            label: "architecture d'habitation",
+            contents: [
+                {
+                    label: "cité-jardin"
+                },
+                {
+                    label: "édifice d'habitation",
+                    contents: [
+                        {
+                            label: "demeure",
+                            contents: [
+                                {
+                                    label: "chalet"
+                                },
+                                {
+                                    label: "château"
+                                },
+                                {
+                                    label: "château-fort",
+                                    contents: [
+                                        {
+                                            label: "chemin de ronde"
+                                        },
+                                        {
+                                            label: "donjon"
+                                        }
+                                    ]
+                                },
+                                {
+                                    label: "hôtel particulier"
+                                },
+                                {
+                                    label: "maison"
+                                },
+                                {
+                                    label: "manoir"
+                                },
+                                {
+                                    label: "palais"
+                                }
+                            ]
+                        },
+                        {
+                            label: "abri",
+                            contents: [
+                                {
+                                    label: "buron"
+                                },
+                                {
+                                    label: "cabane"
+                                },
+                                {
+                                    label: "campement",
+                                    contents: [
+                                        {
+                                            label: "tente"
+                                        },
+                                        {
+                                            label: "tipi"
+                                        },
+                                        {
+                                            label: "igloo"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    {
+        title: "Thésaurus Garnier : Sciences occultes",
+        tree: {
+            label: "sciences occultes",
+            contents: [
+                {
+                    label: "alchimie"
+                },
+                {
+                    label: "astrologie"
+                },
+                {
+                    label: "divination"
+                },
+                {
+                    label: "magie",
+                    contents: [
+                        {
+                            label: "sorcellerie"
+                        },
+                        {
+                            label: "sorcière"
+                        }
+                    ]
+                }
+            ]
+        }
+    }
+];
+$(function() {
+    $(".column").each(function(_key) {
+        var _tree = trees[_key],
+            _el = $(this);
+        _el.find("h3").text(_tree.title);
+        $.getJSON(
+            endpoints.fill_tree,
+            { tree: JSON.stringify(_tree.tree) },
+            function(_data) {
+                renderData(_el.find(".cattree"), _data);
+            }
+        );
+    });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdalab/static/hdalab/js/trees.js	Thu Oct 11 18:22:45 2012 +0200
@@ -0,0 +1,76 @@
+
+function countContentsAndThemes(_data) {
+    _data.counts = {
+        contents: (typeof _data.contents == "object" && typeof _data.contents.slice == "function" ? _data.contents.length : 0),
+        themes: (typeof _data.themes == "object" && typeof _data.themes.slice == "function" ? _data.themes.length : 0)
+    }
+    if (typeof _data.themes == "object" && typeof _data.themes.slice == "function") {
+        for (var _i = 0; _i < _data.themes.length; _i++) {
+            countContentsAndThemes(_data.themes[_i]);
+            var _subres = _data.themes[_i].counts;
+            _data.counts.contents += _subres.contents;
+            _data.counts.themes += _subres.themes;
+        }
+    }
+}
+
+function renderTemplate(_data, _level, _scale) {
+    _data.level = !!_level;
+    _(_data.tags).each(function(_tag) {
+        _(_tag.contents).each(function(_content, _key) {
+            _content.trimmed_description = _content.description.trim().replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{150,200})[\s].+$/m,'$1&hellip;');
+            _content.hidden = (_key >= 5);
+        });
+        _tag.show_more = _tag.contents && _tag.contents.length > 5 ? _tag.contents.length - 5 : 0;
+    });
+    _(_data.contents).each(function(_content, _key) {
+        _content.trimmed_description = _content.description.trim().replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{150,200})[\s].+$/m,'$1&hellip;');
+        _content.hidden = (_key >= 5);
+    });
+    _data.show_more = _data.contents && _data.contents.length > 5 ? _data.contents.length - 5 : 0;
+    _data.font_size = (10+Math.log(_data.counts.contents)*_scale);
+    var _prefix = '<li class="themeli {{#level}}folded {{/level}}"><p class="theme"><span style="font-size: {{font_size}}px">{{label}}</span> &mdash; {{#counts.themes}}{{counts.themes}} thème(s){{#counts.contents}}, {{/counts.contents}}{{/counts.themes}}{{#counts.contents}}{{counts.contents}} notice(s){{/counts.contents}}</p><ul>',
+        _suffix = '{{#contents}}<li class="content{{#hidden}} hidden{{/hidden}}" id="content_{{id}}"><p class="title score_{{score}}">{{title}}</p><div class="foldedcontent"><div class="img-container"><img src="http://www.histoiredesarts.culture.fr/images/cached/images/{{hda_id}}.jpg" />'
+            + '</div><p class="description">Source: {{organization}}<br /><a href="{{url}}" target="_blank" class="content">{{trimmed_description}}</a></p></div></li>{{/contents}}{{#show_more}}<li class="show_more">Plus de contenus (<span class="show_more_count">{{show_more}}</span>)&hellip;</li>{{/show_more}}</ul></li>',
+        _html = Mustache.to_html(_prefix, _data);
+    if (typeof _data.themes == "object" && typeof _data.themes.slice == "function") {
+        for (var _i = 0; _i < _data.themes.length; _i++) {
+            _html += renderTemplate(_data.themes[_i], _level + 1, _scale);
+        }
+    }
+    _html += Mustache.to_html(_suffix, _data);
+    return _html;
+}
+
+function renderData(_selector, _data) {
+    countContentsAndThemes(_data);
+    var _scale = 8 / Math.max(1,Math.log(_data.counts.contents));
+    _selector.html(renderTemplate(_data, 0, _scale));
+    _selector.find("p.theme").click(function() {
+        $(this).parent().toggleClass("folded")
+        return false;
+    });
+    _selector.find("li.content").mouseenter(function() {
+        $(this).find(".foldedcontent")
+        .dequeue()
+        .animate({
+            height: 5 + $(this).find("p.description").outerHeight()
+        },
+        500);
+    }).mouseleave(function() {
+        $(this).find(".foldedcontent")
+        .dequeue()
+        .animate({
+            height: "0"
+        },
+        500);
+    });
+    _selector.find(".show_more").click(function() {
+        $(this).siblings(".hidden:lt(5)").removeClass("hidden");
+        var _l = $(this).siblings(".hidden").length;
+        $(this).find(".show_more_count").html(_l);
+        if (!_l) {
+            $(this).detach();
+        } 
+    });
+}
\ No newline at end of file
--- a/web/hdalab/templates/base.html	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/templates/base.html	Thu Oct 11 18:22:45 2012 +0200
@@ -25,10 +25,12 @@
         <div id="header">
             <ul id="nav">
                 <li><a class="{% block home_actif %}{% endblock %}" href="{% url home %}">Accueil</a></li>
-                <li><a class="{% block facettes_actif %}{% endblock %}" href="{% url facettes %}">Recherche par facettes</a></li>
-<!--
+                <li>&mdash;</li>
+                <li>Navigation par&nbsp;:</li>
+                <li><a class="{% block facettes_actif %}{% endblock %}" href="{% url facettes %}">Facettes</a></li>
                 <li><a class="{% block categories_actif %}{% endblock %}" href="{% url categories %}">Catégories de Wikipedia</a></li>
--->
+                <li><a class="{% block thesaurus_actif %}{% endblock %}" href="{% url thesaurus %}">Thésaurus</a></li>
+
             </ul>
             <h1>
                 <a href="{% url home %}">HdA Lab</a>
--- a/web/hdalab/templates/categories.html	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/templates/categories.html	Thu Oct 11 18:22:45 2012 +0200
@@ -5,6 +5,7 @@
 {% block css_import %}
 {{block.super}}
         <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css" />
+        <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/trees.css" />
         <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/cattree.css" />
 {% endblock %}
 
@@ -20,6 +21,7 @@
             fill_tree: "{% url fill_tree %}"
         };
         </script>
+        <script src="{{STATIC_URL}}hdalab/js/trees.js"></script>
         <script src="{{STATIC_URL}}hdalab/js/cattree.js"></script>
 {% endblock %}
 
@@ -48,8 +50,6 @@
         <p>
             <form id="catform"><input id="catsearch" /></form>
         </p>
-        <h3>Recherche dans d'autres thésaurus&nbsp;:</h3>
-        <ul class="theslist"></ul>
         <div class="results hidden">
             <h2>Résultats pour &laquo;&nbsp;<span class="label-name"></span>&nbsp;&raquo;&nbsp;:</h2>
             <p class="category-results"><span class="category-count"></span> sous-catégorie(s)</p>
--- a/web/hdalab/templates/index.html	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/templates/index.html	Thu Oct 11 18:22:45 2012 +0200
@@ -43,7 +43,7 @@
                 </div>
             </div>
         </div>
-<!--
+
         <div class="separateur-applis"></div>
         <div class="bloc-appli">
             <h3>Catégories de Wikipedia</h3>
@@ -55,16 +55,18 @@
                 </div>
             </div>
         </div>
+        
+        <div class="separateur-applis"></div>
         <div class="bloc-appli">
-            <h3>Recherche par liste de complétion</h3>
-            <div class="fond-bloc" id="bloc-completion">
+            <h3>Navigation par thésaurus</h3>
+            <div class="fond-bloc" id="bloc-thesaurus">
                 <div class="overlay-bloc">
-                    <p>Recherchez les contenus en choisissant parmi les tags sémantisés de la base Histoire des Arts, correspondant chacun à une page Wikipédia</p>
-                    <p class="goto"><a href="{% url completion %}">&raquo;</a></p>
+                    <p></p>
+                    <p class="goto"><a href="{% url thesaurus %}">&raquo;</a></p>
                 </div>
             </div>
         </div>
--->
+
         <div style="clear: both;"> </div>
     </div>
     <h3>À propos de HdA Lab</h3>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdalab/templates/thesaurus.html	Thu Oct 11 18:22:45 2012 +0200
@@ -0,0 +1,42 @@
+{% extends "base.html" %}
+
+{% block title %}{{block.super}} &gt; Recherche par arbre{% endblock %}
+
+{% block css_import %}
+{{block.super}}
+        <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css" />
+        <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/trees.css" />
+        <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/thesaurus.css" />
+{% endblock %}
+
+{% block js_import %}
+{{block.super}}
+        <script src="{{STATIC_URL}}hdalab/lib/underscore-min.js"></script>
+        <script src="{{STATIC_URL}}hdalab/lib/mustache.js"></script>
+        <script src="{{STATIC_URL}}hdalab/lib/jquery-ui-1.8.16.custom.min.js"></script>
+        <script type="text/javascript">
+        endpoints = {
+            fill_tree: "{% url fill_tree %}"
+        };
+        </script>
+        <script src="{{STATIC_URL}}hdalab/js/trees.js"></script>
+        <script src="{{STATIC_URL}}hdalab/js/thesaurus.js"></script>
+{% endblock %}
+
+{% block thesaurus_actif %}actif{% endblock %}
+
+{% block main_content %}
+    <div class="column leftcol">
+        <h3>Arborescence 1</h3>
+        <div class="cattree">
+        
+        </div>
+    </div>
+    <div class="separator"></div>
+    <div class="column rightcol">
+        <h3>Arborescence 2</h3>
+        <div class="cattree">
+            
+        </div>
+    </div>
+{% endblock %}
\ No newline at end of file
--- a/web/hdalab/urls.py	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/urls.py	Thu Oct 11 18:22:45 2012 +0200
@@ -25,6 +25,7 @@
     
     url(r'^facettes/', TemplateView.as_view(template_name="facettes.html"), name='facettes'),
     url(r'^categories/', TemplateView.as_view(template_name="categories.html"), name='categories'),
+    url(r'^thesaurus/', TemplateView.as_view(template_name="thesaurus.html"), name='thesaurus'),
     url(r'^$', TemplateView.as_view(template_name="index.html"), name='home'),
 
 )
--- a/web/hdalab/views/ajax.py	Thu Oct 11 15:49:57 2012 +0200
+++ b/web/hdalab/views/ajax.py	Thu Oct 11 18:22:45 2012 +0200
@@ -49,21 +49,21 @@
     tags = Tag.objects.filter(wp_categories__wp_category = category).distinct()
     taglabels = [k for k in dict([(t.label,t.label) for t in tags])]
     resobj = {
-          'category': category.label,
-          'tags': [],
+          'label': category.label,
+          'themes': [],
           'contents': []
-          }
+      }
     for label in taglabels:
         if label == catlabel:
             globtags[label] = {'level': level, 'access': resobj }
         else:
             tag_in_list = {'label' : label, 'contents': []}
-            resobj['tags'].append(tag_in_list)
+            resobj['themes'].append(tag_in_list)
             globtags[label] = {'level': (level + 1), 'access': tag_in_list }
             
     if level < max_level:
         subcats = WpCategory.objects.filter(parent_categories__parent_category = category)
-        resobj['sub_categories'] = [subcat(subcats[i], globtags, level + 1, max_level ) for i in range(len(subcats))]
+        resobj['themes'] += [subcat(subcats[i], globtags, level + 1, max_level ) for i in range(len(subcats))]
     return resobj
 
 def cleantags(category):
@@ -71,21 +71,15 @@
         del category['contents']
     if category.has_key('contents'):
         category['contents'] = sorted(category['contents'], key=lambda content: -content['score'])
-    if category.has_key('tags'):
-        category['tags'] = [cleantags(tag) for tag in category['tags'] if len(tag['contents'])]
-        if len(category['tags']) == 0:
-            del category['tags']
-        else:
-            category['tags'] = sorted(category['tags'], key=lambda tag: tag['label'])
-    if category.has_key('sub_categories'):
-        sub_cats = []
-        for sub_cat in category['sub_categories']:
-            cat = cleantags(sub_cat)
-            if cat.has_key('tags') or cat.has_key('sub_categories') or cat.has_key('contents'):
-                sub_cats.append(cat)
-        category['sub_categories'] = sorted(sub_cats, key=lambda cat: cat['category'])
-        if len(category['sub_categories']) == 0:
-            del category['sub_categories']
+    if category.has_key('themes'):
+        themes = []
+        for theme in category['themes']:
+            clean_theme = cleantags(theme)
+            if clean_theme.has_key('themes') or clean_theme.has_key('contents'):
+                themes.append(clean_theme)
+        category['themes'] = sorted(themes, key=lambda cat: cat['label'])
+        if len(category['themes']) == 0:
+            del category['themes']
     return category
 
 def cattree(request):
@@ -434,15 +428,15 @@
     
     contents = sorted(contents, key=lambda e: -e['score'])
     
-    res = { 'category': label }
+    res = { 'label': label }
     
     if len(contents):
         res['contents'] = contents
     
     if len(sub):
         subcats = [subtree(st) for st in sub]
-        subcats = [sc for sc in subcats if len(sc.get('contents',[])) or len(sc.get('sub_categories',[]))]
-        res['sub_categories'] = subcats
+        subcats = [sc for sc in subcats if len(sc.get('contents',[])) or len(sc.get('themes',[]))]
+        res['themes'] = subcats
     
     return res