[facets] add link 'focus on selection' (closes #525277)
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Mon, 17 Sep 2012 17:48:02 +0200
changeset 8551 6cf9e4da54a9
parent 8549 0740ffe73df1
child 8555 c747242d22a6
[facets] add link 'focus on selection' (closes #525277)
i18n/de.po
i18n/en.po
i18n/es.po
i18n/fr.po
web/data/cubicweb.facets.js
web/views/facets.py
--- a/i18n/de.po	Mon Sep 10 13:59:25 2012 +0200
+++ b/i18n/de.po	Mon Sep 17 17:48:02 2012 +0200
@@ -2561,6 +2561,9 @@
 msgid "foaf"
 msgstr "FOAF"
 
+msgid "focus on this selection"
+msgstr ""
+
 msgid "follow"
 msgstr "dem Link folgen"
 
--- a/i18n/en.po	Mon Sep 10 13:59:25 2012 +0200
+++ b/i18n/en.po	Mon Sep 17 17:48:02 2012 +0200
@@ -2508,6 +2508,9 @@
 msgid "foaf"
 msgstr ""
 
+msgid "focus on this selection"
+msgstr ""
+
 msgid "follow"
 msgstr ""
 
--- a/i18n/es.po	Mon Sep 10 13:59:25 2012 +0200
+++ b/i18n/es.po	Mon Sep 17 17:48:02 2012 +0200
@@ -2603,6 +2603,9 @@
 msgid "foaf"
 msgstr "Amigo de un Amigo, FOAF"
 
+msgid "focus on this selection"
+msgstr ""
+
 msgid "follow"
 msgstr "Seguir la liga"
 
--- a/i18n/fr.po	Mon Sep 10 13:59:25 2012 +0200
+++ b/i18n/fr.po	Mon Sep 17 17:48:02 2012 +0200
@@ -2611,6 +2611,9 @@
 msgid "foaf"
 msgstr "foaf"
 
+msgid "focus on this selection"
+msgstr "afficher cette sélection"
+
 msgid "follow"
 msgstr "suivre le lien"
 
@@ -4137,10 +4140,6 @@
 msgid "there is no transaction #%s"
 msgstr "Il n'y a pas de transaction #%s"
 
-#, python-format
-msgid "there is no transaction #%s"
-msgstr ""
-
 msgid "this action is not reversible!"
 msgstr ""
 "Attention ! Cette opération va détruire les données de façon irréversible."
@@ -4696,6 +4695,9 @@
 #~ msgid "day"
 #~ msgstr "jour"
 
+#~ msgid "jump to selection"
+#~ msgstr "afficher cette sélection"
+
 #~ msgid "log out first"
 #~ msgstr "déconnecter vous d'abord"
 
--- a/web/data/cubicweb.facets.js	Mon Sep 10 13:59:25 2012 +0200
+++ b/web/data/cubicweb.facets.js	Mon Sep 17 17:48:02 2012 +0200
@@ -68,6 +68,14 @@
             var bkUrl = $bkLink.attr('cubicweb:target') + '&path=' + encodeURIComponent(bkPath);
             $bkLink.attr('href', bkUrl);
         }
+        var $focusLink = jQuery('#focusLink');
+        if ($focusLink.length) {
+            var url = baseuri()+ 'view?rql=' + encodeURIComponent(rql);
+            if (vid) {
+                url += '&vid=' + encodeURIComponent(vid);
+            }
+            $focusLink.attr('href', url);
+        }
         var toupdate = result[1];
         var extraparams = vidargs;
         if (paginate) { extraparams['paginate'] = '1'; } // XXX in vidargs
--- a/web/views/facets.py	Mon Sep 10 13:59:25 2012 +0200
+++ b/web/views/facets.py	Mon Sep 17 17:48:02 2012 +0200
@@ -26,6 +26,7 @@
 from logilab.common.decorators import cachedproperty
 from logilab.common.registry import objectify_predicate, yes
 
+from cubicweb import tags
 from cubicweb.predicates import (non_final_entity, multi_lines_rset,
                                  match_context_prop, relation_possible)
 from cubicweb.utils import json_dumps
@@ -234,6 +235,7 @@
             vid = req.form.get('vid')
         if self.bk_linkbox_template and req.vreg.schema['Bookmark'].has_perm(req, 'add'):
             w(self.bookmark_link(rset))
+        w(self.focus_link(rset))
         hiddens = {}
         for param in ('subvid', 'vtitle'):
             if param in req.form:
@@ -269,6 +271,9 @@
                 req._('bookmark this search'))
         return self.bk_linkbox_template % bk_link
 
+    def focus_link(self, rset):
+        return self.bk_linkbox_template % tags.a(self._cw._('focus on this selection'),
+                                                 href=self._cw.url(), id='focusLink')
 
 class FilterTable(FacetFilterMixIn, AnyRsetView):
     __regid__ = 'facet.filtertable'