mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-23 21:57:44 -06:00
[MIG] attachment_edit to 10.0
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
.openerp .oe_sidebar .oe_dropdown_menu li .oe-sidebar-attachment-edit
|
||||
{
|
||||
position: absolute;
|
||||
right: 32px;
|
||||
top: 0px;
|
||||
display: none;
|
||||
}
|
||||
.openerp .oe_sidebar .oe_dropdown_menu li:hover .oe-sidebar-attachment-edit
|
||||
{
|
||||
display: inherit;
|
||||
}
|
||||
.openerp .oe_sidebar .oe_dropdown_menu li .oe-sidebar-attachment-edit:hover
|
||||
{
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background: #8786b7;
|
||||
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
@@ -1,45 +1,22 @@
|
||||
//-*- coding: utf-8 -*-
|
||||
//############################################################################
|
||||
//
|
||||
// OpenERP, Open Source Management Solution
|
||||
// This module copyright (C) 2015 Therp BV <http://therp.nl>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
//############################################################################
|
||||
// (c) 2015-2018 Therp BV <http://therp.nl>
|
||||
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
odoo.define('attachment_edit', function(require) {
|
||||
var Sidebar = require('web.Sidebar');
|
||||
|
||||
openerp.attachment_edit = function(instance)
|
||||
{
|
||||
instance.web.Sidebar.include(
|
||||
{
|
||||
on_attachments_loaded: function(attachments)
|
||||
{
|
||||
var result = this._super.apply(this, arguments);
|
||||
this.$el.find('.oe-sidebar-attachment-edit')
|
||||
.click(this.on_attachment_edit);
|
||||
return result;
|
||||
Sidebar.include({
|
||||
on_attachments_loaded: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.$('.o_sidebar_edit_attachment')
|
||||
.click(this.proxy('on_attachment_edit'));
|
||||
},
|
||||
on_attachment_edit: function(e)
|
||||
{
|
||||
on_attachment_edit: function(e) {
|
||||
var $target = jQuery(e.currentTarget),
|
||||
attachment_id = parseInt($target.attr('data-id')),
|
||||
title = $target.attr('title');
|
||||
attachment_id = parseInt($target.attr('data-id'), 10);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.do_action({
|
||||
return this.do_action({
|
||||
type: 'ir_actions.act_window',
|
||||
name: title,
|
||||
views: [[false, 'form']],
|
||||
res_model: 'ir.attachment',
|
||||
res_id: attachment_id,
|
||||
@@ -48,5 +25,5 @@ openerp.attachment_edit = function(instance)
|
||||
},
|
||||
});
|
||||
},
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-extend="Sidebar">
|
||||
<t t-jquery="a.oe_sidebar_delete_item" t-operation="before">
|
||||
<a t-if="section.name == 'files' and !item.callback and item.url" href="#" class="oe-sidebar-attachment-edit" t-att-data-id="item.id" t-attf-title="Edit #{item.name}">
|
||||
<img t-att-src='_s + "/web/static/src/img/pencil.gif"' width="12" height="12" border="0"/>
|
||||
</a>
|
||||
<t t-jquery="span.o_sidebar_delete_attachment" t-operation="before">
|
||||
<span t-if="section.name == 'files' and widget.options.editable and !item.callback" class="fa fa-pencil o_sidebar_edit_attachment" t-att-data-id="item.id" t-attf-title="Edit #{item.name}" />
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user