Skip to content
Snippets Groups Projects
Commit dfa9d2d8218e authored by Sandrine Ribeau's avatar Sandrine Ribeau
Browse files

[views] add login an register link next to the reply action

parent 0868384716ed
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,14 @@ ...@@ -36,6 +36,14 @@
uicfg.primaryview_section.tag_subject_of(('*', 'comments', '*'), 'hidden') uicfg.primaryview_section.tag_subject_of(('*', 'comments', '*'), 'hidden')
uicfg.primaryview_section.tag_object_of(('*', 'comments', '*'), 'hidden') uicfg.primaryview_section.tag_object_of(('*', 'comments', '*'), 'hidden')
def _login_register_link(appobj):
link = u''
if appobj.req.cnx.anonymous_connection:
if 'registration' in appobj.vreg.config.cubes():
link += u' <a href="/register">%s</a> or' % appobj.req._(u'register')
link += u' <a href="/login">%s</a> %s' % (appobj.req._(u'login'), appobj.req._(u'to'))
return link
# comment views ############################################################### # comment views ###############################################################
class CommentPrimaryView(primary.PrimaryView): class CommentPrimaryView(primary.PrimaryView):
...@@ -109,8 +117,9 @@ ...@@ -109,8 +117,9 @@
url = self.req.build_ajax_replace_url( url = self.req.build_ajax_replace_url(
'comment%sHolder' % entity.eid, rql_for_eid(entity.eid), 'comment%sHolder' % entity.eid, rql_for_eid(entity.eid),
'inlinecomment') 'inlinecomment')
reply = ' | <a href="%s">%s</a>' % (html_escape(url), reply = ' | %s <a href="%s"> %s </a>' % ( _login_register_link(self),
_(action.title)) html_escape(url),
_(action.title))
if editaction is None: if editaction is None:
edit = u'' edit = u''
else: else:
...@@ -231,7 +240,7 @@ ...@@ -231,7 +240,7 @@
rset = req.execute(rql, {'x': eid}, 'x') rset = req.execute(rql, {'x': eid}, 'x')
if rset.rowcount: if rset.rowcount:
self.w(u'<h4>%s</h4>%s' % (req._('Comment_plural'), reply)) self.w(u'<h4>%s</h4>%s' % (req._('Comment_plural'), reply))
self._login_register_link() self.w(u'%s %s' % (_login_register_link(self), self.req._(u'comment')))
self.w(u'<div id="comment%sHolder"></div>' % eid) self.w(u'<div id="comment%sHolder"></div>' % eid)
self.w(u'<ul class="comment">') self.w(u'<ul class="comment">')
...@@ -240,8 +249,8 @@ ...@@ -240,8 +249,8 @@
self.w(u'</ul>') self.w(u'</ul>')
elif reply: elif reply:
self.w(reply) self.w(reply)
self._login_register_link() self.w(u'%s %s' % (_login_register_link(self), self.req._(u'to comment')))
self.w(u'<div id="comment%sHolder"></div>' % eid) self.w(u'<div id="comment%sHolder"></div>' % eid)
self.w(u'</div>') self.w(u'</div>')
...@@ -244,13 +253,7 @@ ...@@ -244,13 +253,7 @@
self.w(u'<div id="comment%sHolder"></div>' % eid) self.w(u'<div id="comment%sHolder"></div>' % eid)
self.w(u'</div>') self.w(u'</div>')
def _login_register_link(self):
if self.req.cnx.anonymous_connection:
if 'registration' in self.vreg.config.cubes():
self.w(u' <a href="/register">%s</a> or' % self.req._(u'register'))
self.w(u' <a href="/login">%s</a> %s' % (self.req._(u'login'), self.req._(u'to comment')))
# comment actions ############################################################# # comment actions #############################################################
class ReplyCommentAction(LinkToEntityAction): class ReplyCommentAction(LinkToEntityAction):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment