web/views/bookmark.py
changeset 6582 8eb7883b4223
parent 6548 fd36c1049eed
child 6684 b8bd0ecced2e
equal deleted inserted replaced
6581:4a3b264589dc 6582:8eb7883b4223
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """Primary view for bookmarks + user's bookmarks box"""
    18 """Primary view for bookmarks + user's bookmarks box"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
       
    21 _ = unicode
    21 
    22 
    22 from logilab.mtconverter import xml_escape
    23 from logilab.mtconverter import xml_escape
    23 
    24 
    24 from cubicweb import Unauthorized
    25 from cubicweb import Unauthorized
    25 from cubicweb.selectors import is_instance, one_line_rset
    26 from cubicweb.selectors import is_instance, one_line_rset
    98             req.add_js('cubicweb.ajax.js')
    99             req.add_js('cubicweb.ajax.js')
    99         for bookmark in self.bookmarks_rset.entities():
   100         for bookmark in self.bookmarks_rset.entities():
   100             label = self.build_link(bookmark.title, bookmark.action_url())
   101             label = self.build_link(bookmark.title, bookmark.action_url())
   101             if self.can_delete:
   102             if self.can_delete:
   102                 dlink = u'[<a class="action" href="javascript:removeBookmark(%s)" title="%s">-</a>]' % (
   103                 dlink = u'[<a class="action" href="javascript:removeBookmark(%s)" title="%s">-</a>]' % (
   103                     bookmark.eid, _('delete this bookmark'))
   104                     bookmark.eid, req._('delete this bookmark'))
   104                 label = '<div>%s %s</div>' % (dlink, label)
   105                 label = '<div>%s %s</div>' % (dlink, label)
   105             self.append(label)
   106             self.append(label)
   106         if self.can_edit:
   107         if self.can_edit:
   107             menu = BoxMenu(req._('manage bookmarks'))
   108             menu = BoxMenu(req._('manage bookmarks'))
   108             linkto = 'bookmarked_by:%s:subject' % ueid
   109             linkto = 'bookmarked_by:%s:subject' % ueid