1 # -*- coding: utf-8 -*-
2 import openobject.templating
4 class ShareActionEditor(openobject.templating.TemplateEditor):
5 templates = ['/openerp/widgets/templates/sidebar.mako']
6 ADD_SHARE_SECTION = u'id="sidebar"'
8 def insert_share_link(self, output):
9 # Insert the link on the line right after the link to open the
11 share_opener_insertion = output.index(
13 output.index(self.ADD_SHARE_SECTION)) + 1
14 return output[:share_opener_insertion] + \
15 '''<div id="share-wizard" class="sideheader-a"><h2>${_("Sharing")}</h2></div>
18 <a id="sharing" href="#share">${_("Share")}</a>
21 <script type="text/javascript">
22 jQuery(document).ready(function() {
23 jQuery("#sharing").click(function() {
26 openobject.http.getURL('/share', {
27 context: jQuery("#_terp_context").val(),
28 domain: jQuery("#_terp_domain").val(),
29 view_id: jQuery("#_terp_view_id").val(),
30 action_id: jQuery("#_terp_action_id").val(),
31 search_domain: jQuery("#_terp_search_domain").val(),
37 output[share_opener_insertion:]
39 def edit(self, template, template_text):
40 return self.insert_share_link(
41 super(ShareActionEditor, self).edit(template, template_text))