--- a/web/component.py Fri May 06 08:52:09 2011 +0200
+++ b/web/component.py Fri May 06 11:07:05 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -57,8 +57,6 @@
page_link_templ = u'<span class="slice"><a href="%s" title="%s">%s</a></span>'
selected_page_link_templ = u'<span class="selectedSlice"><a href="%s" title="%s">%s</a></span>'
previous_page_link_templ = next_page_link_templ = page_link_templ
- no_previous_page_link = u'<<'
- no_next_page_link = u'>>'
def __init__(self, req, rset, **kwargs):
super(NavigationComponent, self).__init__(req, rset=rset, **kwargs)
@@ -131,7 +129,33 @@
return self.selected_page_link_templ % (url, content, content)
return self.page_link_templ % (url, content, content)
- def previous_link(self, path, params, content='<<', title=_('previous_results')):
+ @property
+ def prev_icon_url(self):
+ return xml_escape(self._cw.data_url('go_prev.png'))
+
+ @property
+ def next_icon_url(self):
+ return xml_escape(self._cw.data_url('go_next.png'))
+
+ @property
+ def no_previous_page_link(self):
+ return u'<img src="%s" class="prevnext_nogo"/>' % self.prev_icon_url
+
+ @property
+ def no_next_page_link(self):
+ return u'<img src="%s" class="prevnext_nogo"/>' % self.next_icon_url
+
+ @property
+ def no_content_prev_link(self):
+ return '<img src="%s" class="prevnext"/>' % self.prev_icon_url
+
+ @property
+ def no_content_next_link(self):
+ return '<img src="%s" class="prevnext"/>' % self.next_icon_url
+
+ def previous_link(self, path, params, content=None, title=_('previous_results')):
+ if not content:
+ content = self.no_content_prev_link
start = self.starting_from
if not start :
return self.no_previous_page_link
@@ -140,7 +164,9 @@
url = xml_escape(self.page_url(path, params, start, stop))
return self.previous_page_link_templ % (url, title, content)
- def next_link(self, path, params, content='>>', title=_('next_results')):
+ def next_link(self, path, params, content=None, title=_('next_results')):
+ if not content:
+ content = self.no_content_next_link
start = self.starting_from + self.page_size
if start >= self.total:
return self.no_next_page_link
--- a/web/data/cubicweb.css Fri May 06 08:52:09 2011 +0200
+++ b/web/data/cubicweb.css Fri May 06 11:07:05 2011 +0200
@@ -120,6 +120,19 @@
border: none;
}
+
+img.prevnext {
+ width: 22px;
+ height: 22px;
+}
+
+img.prevnext_nogo {
+ width: 22px;
+ height: 22px;
+ filter:alpha(opacity=25); /* IE */
+ opacity:.25;
+}
+
fieldset {
border: none;
}
--- a/web/data/cubicweb.old.css Fri May 06 08:52:09 2011 +0200
+++ b/web/data/cubicweb.old.css Fri May 06 11:07:05 2011 +0200
@@ -69,6 +69,18 @@
text-align: center;
}
+img.prevnext {
+ width: 22px;
+ height: 22px;
+}
+
+img.prevnext_nogo {
+ width: 22px;
+ height: 22px;
+ filter:alpha(opacity=25); /* IE */
+ opacity:.25;
+}
+
p {
margin: 0em 0px 0.2em;
padding-top: 2px;
Binary file web/data/go_next.png has changed
Binary file web/data/go_prev.png has changed
--- a/web/views/navigation.py Fri May 06 08:52:09 2011 +0200
+++ b/web/views/navigation.py Fri May 06 11:07:05 2011 +0200
@@ -40,10 +40,10 @@
self.clean_params(params)
basepath = self._cw.relative_path(includeparams=False)
self.w(u'<div class="pagination">')
- self.w(u'%s ' % self.previous_link(basepath, params))
+ self.w(self.previous_link(basepath, params))
self.w(u'[ %s ]' %
u' | '.join(self.iter_page_links(basepath, params)))
- self.w(u' %s' % self.next_link(basepath, params))
+ self.w(u'  %s' % self.next_link(basepath, params))
self.w(u'</div>')
def index_display(self, start, stop):
@@ -74,12 +74,12 @@
basepath = self._cw.relative_path(includeparams=False)
w = self.w
w(u'<div class="pagination">')
- w(u'%s ' % self.previous_link(basepath, params))
+ w(self.previous_link(basepath, params))
w(u'<select onchange="javascript: document.location=this.options[this.selectedIndex].value">')
for option in self.iter_page_links(basepath, params):
w(option)
w(u'</select>')
- w(u' %s' % self.next_link(basepath, params))
+ w(u'  %s' % self.next_link(basepath, params))
w(u'</div>')