[facets] fix bug w/ vid in facet's js introduced in 3.9, improve navigation component so that show all link use ajax when called from ajax.
--- a/web/component.py Tue Jul 06 17:15:25 2010 +0200
+++ b/web/component.py Tue Jul 06 17:19:30 2010 +0200
@@ -133,10 +133,12 @@
if self.stop_param in params:
del params[self.stop_param]
- def page_url(self, path, params, start, stop):
+ def page_url(self, path, params, start=None, stop=None):
params = dict(params)
- params.update({self.start_param : start,
- self.stop_param : stop,})
+ if start is not None:
+ params[self.start_param] = start
+ if stop is not None:
+ params[self.stop_param] = stop
view = self.cw_extra_kwargs.get('view')
if view is not None and hasattr(view, 'page_navigation_url'):
url = view.page_navigation_url(self, path, params)
@@ -145,7 +147,8 @@
# latest 'true' used for 'swap' mode
url = 'javascript: replacePageChunk(%s, %s, %s, %s, true)' % (
json.dumps(params.get('divid', 'pageContent')),
- json.dumps(rql), json.dumps(params.pop('vid', None)), json.dumps(params))
+ json.dumps(rql), json.dumps(params.pop('vid', None)),
+ json.dumps(params))
else:
url = self._cw.build_url(path, **params)
return url
--- a/web/data/cubicweb.facets.css Tue Jul 06 17:15:25 2010 +0200
+++ b/web/data/cubicweb.facets.css Tue Jul 06 17:19:30 2010 +0200
@@ -91,6 +91,7 @@
.facetValueDisabled {
font-style: italic;
+ text-decoration: line-through;
}
--- a/web/data/cubicweb.facets.js Tue Jul 06 17:15:25 2010 +0200
+++ b/web/data/cubicweb.facets.js Tue Jul 06 17:19:30 2010 +0200
@@ -53,7 +53,7 @@
}
var toupdate = result[1];
var extraparams = vidargs;
- if (paginate) { extraparams['paginate'] = '1'; } // XXX in vidargs
+ if (paginate) { extraparams['paginate'] = '1'; } // XXX in vidargs
// copy some parameters
// XXX cleanup vid/divid mess
// if vid argument is specified , the one specified in form params will
@@ -67,8 +67,11 @@
// want to reload action box to match current selection (we don't want
// this from a table filter)
extraparams['rql'] = rql;
- extraparams['vid'] = vid;
- d = $('#' + divid).loadxhtml('json', ajaxFuncArgs('view', extraparams));
+ if (vid) { // XXX see copyParam above. Need cleanup
+ extraparams['vid'] = vid;
+ }
+ d = $('#' + divid).loadxhtml('json', ajaxFuncArgs('view', extraparams),
+ null, 'swap');
d.addCallback(function() {
// XXX rql/vid in extraparams
jQuery(CubicWeb).trigger('facets-content-loaded', [divid, rql, vid, extraparams]);
--- a/web/views/navigation.py Tue Jul 06 17:15:25 2010 +0200
+++ b/web/views/navigation.py Tue Jul 06 17:19:30 2010 +0200
@@ -268,9 +268,11 @@
nav.clean_params(params)
# make a link to see them all
if show_all_option:
- url = xml_escape(req.build_url(__force_display=1, **params))
+ basepath = req.relative_path(includeparams=False)
+ params['__force_display'] = 1
+ url = nav.page_url(basepath, params)
w(u'<div><a href="%s">%s</a></div>\n'
- % (url, req._('show %s results') % len(rset)))
+ % (xml_escape(url), req._('show %s results') % len(rset)))
rset.limit(offset=start, limit=stop-start, inplace=True)