merge stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 08 Jul 2009 10:45:31 +0200
branchstable
changeset 2326 05ae71d9a069
parent 2325 363b66a15668 (diff)
parent 2321 0b363cd5ef76 (current diff)
child 2327 2aa28ac13d64
child 2339 00b704535984
merge
web/views/facets.py
--- a/web/data/cubicweb.formfilter.js	Wed Jul 08 07:45:59 2009 +0200
+++ b/web/data/cubicweb.formfilter.js	Wed Jul 08 10:45:31 2009 +0200
@@ -131,9 +131,11 @@
 			$this.find('img').each(function (i){
 			if (this.getAttribute('cubicweb:unselimg')){
 			       this.setAttribute('src', UNSELECTED_BORDER_IMG);
+			       this.setAttribute('alt', (_('not selected')));
 			    }
 			    else{
 			       this.setAttribute('src', UNSELECTED_IMG);
+			       this.setAttribute('alt', (_('not selected')));
 			    }
 			});
 			var index = parseInt($this.attr('cubicweb:idx'));
@@ -144,7 +146,7 @@
 			index += shift;
 			var parent = this.parentNode;
 			var $insertAfter = jQuery(parent).find('.facetCheckBox:nth('+index+')');
-			if ( ! ($insertAfter.length == 1 && index == 0) ) {
+			if ( ! ($insertAfter.length == 1 && shift == 0) ) {
 			    // only rearrange element if necessary
 			    $insertAfter.after(this);
 			}
@@ -157,7 +159,8 @@
 			    jQuery(parent).prepend(this);
 			}
 			jQuery(this).addClass('facetValueSelected');
-			jQuery(this).find('img').attr('src', SELECTED_IMG);
+			var $img = jQuery(this).find('img');
+			$img.attr('src', SELECTED_IMG).attr('alt', (_('selected')));
 		    }
 		    buildRQL.apply(null, evalJSON(form.attr('cubicweb:facetargs')));
 		    facet.find('.facetBody').animate({scrollTop: 0}, '');
--- a/web/views/facets.py	Wed Jul 08 07:45:59 2009 +0200
+++ b/web/views/facets.py	Wed Jul 08 10:45:31 2009 +0200
@@ -41,7 +41,7 @@
     needs_css = 'cubicweb.facets.css'
     needs_js = ('cubicweb.ajax.js', 'cubicweb.formfilter.js')
 
-    bkLinkBox_template = u'<div class="facetTitle">%s</div>'
+    bk_linkbox_template = u'<div class="facetTitle">%s</div>'
 
     def facetargs(self):
         """this method returns the list of extra arguments that should
@@ -82,7 +82,8 @@
                         widgets.append(wdg)
             if not widgets:
                 return
-            self.displayBookmarkLink(rset)
+            if self.bk_linkbox_template:
+                self.display_bookmark_link(rset)
             w = self.w
             w(u'<form method="post" id="%sForm" cubicweb:facetargs="%s" action="">'  % (
                 divid, xml_escape(dumps([divid, vid, paginate, self.facetargs()]))))
@@ -101,7 +102,7 @@
             import cubicweb
             cubicweb.info('after facets with rql: %s' % repr(rqlst))
 
-    def displayBookmarkLink(self, rset):
+    def display_bookmark_link(self, rset):
         eschema = self.schema.eschema('Bookmark')
         if eschema.has_perm(self.req, 'add'):
             bk_path = 'view?rql=%s' % rset.printable_rql()
@@ -113,7 +114,7 @@
                     xml_escape(bk_base_url),
                     xml_escape(bk_add_url),
                     self.req._('bookmark this search'))
-            self.w(self.bkLinkBox_template % bk_link)
+            self.w(self.bk_linkbox_template % bk_link)
 
     def get_facets(self, rset, mainvar):
         return self.vreg.possible_vobjects('facets', self.req, rset,