209 help = _('ctxcomponents_prevnext_description') |
209 help = _('ctxcomponents_prevnext_description') |
210 __select__ = EntityCtxComponent.__select__ & adaptable('IPrevNext') |
210 __select__ = EntityCtxComponent.__select__ & adaptable('IPrevNext') |
211 context = 'navbottom' |
211 context = 'navbottom' |
212 order = 10 |
212 order = 10 |
213 |
213 |
|
214 @property |
|
215 def prev_icon(self): |
|
216 return '<img src="%s"/>' % xml_escape(self._cw.data_url('go_prev.png')) |
|
217 |
|
218 @property |
|
219 def next_icon(self): |
|
220 return '<img src="%s"/>' % xml_escape(self._cw.data_url('go_next.png')) |
|
221 |
214 def init_rendering(self): |
222 def init_rendering(self): |
215 adapter = self.entity.cw_adapt_to('IPrevNext') |
223 adapter = self.entity.cw_adapt_to('IPrevNext') |
216 self.previous = adapter.previous_entity() |
224 self.previous = adapter.previous_entity() |
217 self.next = adapter.next_entity() |
225 self.next = adapter.next_entity() |
218 if not (self.previous or self.next): |
226 if not (self.previous or self.next): |
230 if self.next: |
238 if self.next: |
231 self.prevnext_entity(w, self.next, 'next') |
239 self.prevnext_entity(w, self.next, 'next') |
232 |
240 |
233 def prevnext_entity(self, w, entity, type): |
241 def prevnext_entity(self, w, entity, type): |
234 textsize = self._cw.property_value('navigation.short-line-size') |
242 textsize = self._cw.property_value('navigation.short-line-size') |
|
243 content = xml_escape(cut(entity.dc_title(), textsize)) |
235 if type == 'prev': |
244 if type == 'prev': |
236 title = self._cw._('i18nprevnext_previous') |
245 title = self._cw._('i18nprevnext_previous') |
237 icon = u'<< ' |
246 icon = self.prev_icon |
238 cssclass = u'previousEntity left' |
247 cssclass = u'previousEntity left' |
|
248 content = icon + content |
239 else: |
249 else: |
240 title = self._cw._('i18nprevnext_next') |
250 title = self._cw._('i18nprevnext_next') |
241 icon = u'>> ' |
251 icon = self.next_icon |
242 cssclass = u'nextEntity right' |
252 cssclass = u'nextEntity right' |
|
253 content = content + '  ' + icon |
243 self.prevnext_div(w, type, cssclass, entity.absolute_url(), |
254 self.prevnext_div(w, type, cssclass, entity.absolute_url(), |
244 title, icon + xml_escape(cut(entity.dc_title(), textsize))) |
255 title, content) |
245 |
256 |
246 def prevnext_div(self, w, type, cssclass, url, title, content): |
257 def prevnext_div(self, w, type, cssclass, url, title, content): |
247 w(u'<div class="%s">' % cssclass) |
258 w(u'<div class="%s">' % cssclass) |
248 w(u'<a href="%s" title="%s">%s</a>' % (xml_escape(url), |
259 w(u'<a href="%s" title="%s">%s</a>' % (xml_escape(url), |
249 xml_escape(title), |
260 xml_escape(title), |