# HG changeset patch # User veltr # Date 1346250193 -7200 # Node ID b41f0b200940314a29d323e199d541ff2657d0fb # Parent 568f351565732bc1397bf57fd729a0469b1178da Added autocomplete diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/de/LC_MESSAGES/django.mo Binary file web/hdalab/locale/de/LC_MESSAGES/django.mo has changed diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/de/LC_MESSAGES/django.po --- a/web/hdalab/locale/de/LC_MESSAGES/django.po Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/locale/de/LC_MESSAGES/django.po Wed Aug 29 16:23:13 2012 +0200 @@ -124,3 +124,7 @@ #: templates/facettes.html:152 msgid "Resultats de recherche" msgstr "Suchergebnisse" + +#: templates/completion.html:37 +msgid "Recherche par liste de completion" +msgstr "Autovervollständigen Suche" diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/en/LC_MESSAGES/django.mo Binary file web/hdalab/locale/en/LC_MESSAGES/django.mo has changed diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/en/LC_MESSAGES/django.po --- a/web/hdalab/locale/en/LC_MESSAGES/django.po Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/locale/en/LC_MESSAGES/django.po Wed Aug 29 16:23:13 2012 +0200 @@ -71,7 +71,7 @@ #: templates/facettes.html:73 msgid "Creer une vue sur des resultats de recherche" -msgstr "Create a view on research results" +msgstr "Create a view on search results" #: templates/facettes.html:74 msgid "Creer une liste de notices" @@ -124,3 +124,7 @@ #: templates/facettes.html:152 msgid "Resultats de recherche" msgstr "Search results" + +#: templates/completion.html:37 +msgid "Recherche par liste de completion" +msgstr "Autocomplete Search" diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/es/LC_MESSAGES/django.mo Binary file web/hdalab/locale/es/LC_MESSAGES/django.mo has changed diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/es/LC_MESSAGES/django.po --- a/web/hdalab/locale/es/LC_MESSAGES/django.po Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/locale/es/LC_MESSAGES/django.po Wed Aug 29 16:23:13 2012 +0200 @@ -124,3 +124,7 @@ #: templates/facettes.html:152 msgid "Resultats de recherche" msgstr "Resultados de búsqueda" + +#: templates/completion.html:37 +msgid "Recherche par liste de completion" +msgstr "Busqueda con autocompletar" diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/it/LC_MESSAGES/django.mo Binary file web/hdalab/locale/it/LC_MESSAGES/django.mo has changed diff -r 568f35156573 -r b41f0b200940 web/hdalab/locale/it/LC_MESSAGES/django.po --- a/web/hdalab/locale/it/LC_MESSAGES/django.po Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/locale/it/LC_MESSAGES/django.po Wed Aug 29 16:23:13 2012 +0200 @@ -124,3 +124,7 @@ #: templates/facettes.html:152 msgid "Resultats de recherche" msgstr "Risultati della ricerca" + +#: templates/completion.html:37 +msgid "Recherche par liste de completion" +msgstr "Ricerca con autocompletamento" diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/css/common.css --- a/web/hdalab/static/hdalab/css/common.css Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/static/hdalab/css/common.css Wed Aug 29 16:23:13 2012 +0200 @@ -104,7 +104,7 @@ } #nav li { - float: left; font-size: 14px; margin-left: 10px; font-weight: bold; + float: left; font-size: 14px; margin-left: 15px; font-weight: bold; } #nav a { diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/css/completion.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/hdalab/static/hdalab/css/completion.css Wed Aug 29 16:23:13 2012 +0200 @@ -0,0 +1,179 @@ +#titlebar, #columns { + width: 100%; + clear: both; +} + +.langbutton { + width: 19px; height: 13px; margin: 2px; padding: 0; border: none; text-indent: -999px; background-position: 0 -26px; cursor: pointer; +} + +.langbutton:hover { + background-position: 0 -13px; +} + +.langbutton.selected { + background-position: 0 0; cursor: default; +} + +.barrebloc { + float: left; width: 473px; border: 1px solid #b0b0b0; + background-image: url(../img/bgdhdalab.png); background-position: 0 -22px; background-repeat: repeat-x; cursor: pointer; cursor: hand; + border-top-left-radius: 4px; border-top-right-radius: 4px +} + +.barrebloc h2 { + margin: 4px 0; font-size: 16px; text-align: center; color: #ffffff; font-weight: bold; +} + +.bloc { + float: left; width: 475px; margin-bottom: 10px; +} + +#bloc_translationinfo { + color: #666; + font-style: italic; +} + +.corpsbloc { + float: left; width: 465px; border: 1px solid #b0b0b0; padding: 8px 4px; border-top-style: none; + background-color: #ffffff; background-image: url(../img/bgdhdalab.png); background-position: 0 -62px; background-repeat: repeat-x; + border-bottom-left-radius: 4px; border-bottom-right-radius: 4px +} + +#hdatitle { + float: left; width: 475px; margin: 5px 0; font-size: 20px; +} + +#titleleft { + float: left; +} + +#titleright { + float: right; +} + +#langselect { + float: right; +} + +#leftcol { + float: left; width: 475px; margin-right: 5px; +} + +#rightcol { + float: left; width: 475px; margin-left: 5px; +} + +#contentlist { + list-style: none; +} + +li.content-item { + margin: 2px 0 12px; +} + +.content-item h3 { + font-size: 18px; margin: 3px 0; clear: both; +} + +.content-item h4 { + font-size: 11px; margin: 3px 0; +} + +.content-item h4 a { + color: #000066; +} + +.maplet { + float: right; +} + +.content-item p { + font-size: 12px; margin: 3px 0; +} + +.content-annotation ul { + list-style : disc; margin: 2px 0; padding-left: 1.5em; font-size: 12px; + cursor: pointer; cursor: hand; +} + +.content-annotation li { + margin: 2px 0; +} + +.content-annotation textarea { + width: 99%; margin: 0; padding: 0; font-size: 12px; +} + +ul.content-tags { + list-style: none; +} + +li.content-tag-item { + display: inline-block; margin: 2px; padding: 2px; font-size: 13px; background: #666666; +} + +.content-tag-item a { + color: #ffffff; +} + +.content-tag-item a:hover { + color: #ff8080; +} + +.content-tag-item a.tagmatch { + color: #ffff00; font-weight: bold; +} + +#taginfo p, h2, h3 { + margin: 5px 0; +} + +#taginfo h3 { + font-size: 14px; +} + +#taginfo p { + font-size: 11px; +} + +#img_wikipedia { + float: left; max-width: 160px; max-height: 120px; margin: 2px 2px 2px 0; +} + +#tagsearch { + width: 100%; font-size: 16px; font-weight: bold; border-style: none; border-bottom: 1px solid #000; +} + +#tagsearch.grise { + color: #666; font-style: italic; font-weight: normal; +} + +ul.ui-autocomplete { + width: 180px; font-family: "Open Sans"; + max-height: 600px; overflow-y: auto; overflow-x: hidden; padding-right: 20px; +} + +h4.actitle { + font-size: 14px; font-weight: bold; +} + +.acimgwrap { + float: left; width: 80px; text-align: center; +} + +img.acimg { + max-width: 80px; max-height: 60px; +} + +p.acabstract { + margin-left: 82px; +} + +.clear { + clear: both; +} + +.actitle strong { + color: #c000c0; +} \ No newline at end of file diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/css/facettes.css --- a/web/hdalab/static/hdalab/css/facettes.css Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/static/hdalab/css/facettes.css Wed Aug 29 16:23:13 2012 +0200 @@ -269,31 +269,6 @@ color: #800000; } - -#tagsearchwrap { - width: 200px; -} - -#tagsearch { - width: 100%; font-size: 16px; font-weight: bold; border-style: none; border-bottom: 1px solid #000; -} - -#tagsearch.grise { - color: #666; font-style: italic; font-weight: normal; -} - -ul.ui-autocomplete { - width: 200px; font-family: "Open Sans"; -} - -.ui-autocomplete strong { - font-weight: bold; -} - -#tagdata { - float: right; width: 465px; -} - #rightcol { float: left; width: 475px; margin-left: 5px; } diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/css/index.css --- a/web/hdalab/static/hdalab/css/index.css Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/static/hdalab/css/index.css Wed Aug 29 16:23:13 2012 +0200 @@ -76,6 +76,10 @@ background: url(../img/categories-thumb.jpg); } +#bloc-completion { + background: url(../img/completion-thumb.jpg); +} + .mini-table { float: left; width: 960px; clear: both; margin: 5px 0; } diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/img/completion-thumb.jpg Binary file web/hdalab/static/hdalab/img/completion-thumb.jpg has changed diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/js/completion.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/hdalab/static/hdalab/js/completion.js Wed Aug 29 16:23:13 2012 +0200 @@ -0,0 +1,117 @@ +var gomNs = { + languageCode: 'fr' +} + +function showResults(data) { + $("#contentcount").html(''+data.count+' ' + ngettext('notice', 'notices', data.count)); + var contentdata = data.contents; + if (contentdata && contentdata.length) { + var _htmlCl = ''; + $("#contents").html(_htmlCl).scrollTop(0); + } + else { + $("#contents").html(""); + } +} + +function getContents(label) { + $.getJSON( + gomNs.urls['filter'], + { + label: label, + tagcount: 0, + contentcount: 30 + }, + showResults + ); +} + +$(document).ready(function() { + $(" #tagform ").submit(function() { + return false; + }); + $( "#tagsearch" ).autocomplete({ + source: gomNs.urls['tag_search'], + minLength: 2, + select: function( event, ui ) { + getContents(ui.item.original_label); + } + }) + .addClass("grise") + .focusin(function() { + $(this).removeClass("grise"); + }) + .focusout(function() { + if (!$(this).val()) { + $(this).addClass("grise"); + } + }) + .data("autocomplete")._renderItem = function(ul, item) { + var _contents = $(''), + _title = $('

') + .addClass("actitle") + .html( + item.value.replace( + new RegExp('(' + + $("#tagsearch").val().replace(/(\W)/g, '\\$1') + + ')','gi') , + '$1') + ), + _clear = $('
').addClass('clear'); + _contents.append(_title); + if (item.thumbnail) { + var _img = $('') + .addClass("acimg") + .attr("src",item.thumbnail), + _imgwrap = $('
') + .addClass("acimgwrap") + .append(_img); + _contents.append(_imgwrap); + } + if (item.abstract) { + var _abstract = $('

') + .addClass("acabstract") + .text( item.abstract.replace(/(^.{0,240})([\s]|$)(.*)/,'$1…') ); + _contents.append(_abstract); + } + _contents.append(_clear); + return $( "

  • " ) + .data( "item.autocomplete", item ) + .append( _contents ) + .appendTo( ul ); + }; +}); diff -r 568f35156573 -r b41f0b200940 web/hdalab/static/hdalab/js/gomina.js --- a/web/hdalab/static/hdalab/js/gomina.js Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/static/hdalab/js/gomina.js Wed Aug 29 16:23:13 2012 +0200 @@ -112,54 +112,6 @@ gomNs.map.addLayer(gJ); } - -function tagInfo(_taglabel, _filter) { - var _urlParam = { "label": _taglabel }; - $.getJSON(gomNs.urls['tag_info'], - _urlParam, - function(data) { - $("#tagsearch").val(data.translated_label).removeClass("grise"); - $("#tagcount").html(data.content_count - + ' ' + ngettext("contenu", "contenus", data.content_count) + ' '+gettext("pour ce tag")); - var _html = ''; - if (data.wikipedia_url) { - _html += '

    Wikipedia: ' - + decodeURI(data.wikipedia_url.match(/[^\/]+$/)[0]).replace("_"," ") - + '

    ' - } - if (data.thumbnail) { - _html += ''; - } - if (data.translated_abstract) { - _html += '

    ' + _(data.translated_abstract).escape().replace(/(^.{0,240})([\s]|$)(.*)/,'$1…') + '

    '; - } -/* if (data.links) { - var _lC = data.requested_label.toLowerCase(); - var _t = data.links.map(function(d) { - return (d.subject.toLowerCase() == _lC) ? d.object : d.subject; - }); - _t.sort(); - _t = _(_t).uniq(true); - _html += '

    Tags liés (dbpedia)

    '; - } */ - $("#tagdata").html(_html); - }); - if (typeof _filter !== "undefined" && _filter) { - addFilter('tag', _taglabel); - } - $("#showlist").removeClass("actif"); -} - function addFilter(_type, _label) { var _curView = gomNs.sessiondata.views[gomNs.sessiondata.view]; if (_curView.type == 'filter') { @@ -254,9 +206,6 @@ var _htmFilters = '', _fl = _curView.tag.length, _cl = _curView.country.length; -/* if (!_curView.period && !_fl && !_cl) { - _htmFilters = '
  • Aucun filtre
  • '; -} */ if (_curView.period[0] == gomNs.minYear && _curView.period[1] == gomNs.maxYear) { _htmFilters += '
  • '+gettext("Toutes periodes")+'
  • '; } else { @@ -326,7 +275,7 @@ + _d.description.replace(/(^.{0,160})([\s]|$)(.*)/,'$1…') + '

    + +{% endblock %} diff -r 568f35156573 -r b41f0b200940 web/hdalab/templates/facettes.html --- a/web/hdalab/templates/facettes.html Tue Aug 28 15:56:38 2012 +0200 +++ b/web/hdalab/templates/facettes.html Wed Aug 29 16:23:13 2012 +0200 @@ -20,15 +20,13 @@ - +