mirror of
https://github.com/OCA/knowledge.git
synced 2025-12-23 05:42:13 -06:00
[ADD] attachment_edit
This commit is contained in:
BIN
attachment_edit/static/description/icon.png
Normal file
BIN
attachment_edit/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
22
attachment_edit/static/src/css/attachment_edit.css
Normal file
22
attachment_edit/static/src/css/attachment_edit.css
Normal file
@@ -0,0 +1,22 @@
|
||||
.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;
|
||||
}
|
||||
|
||||
52
attachment_edit/static/src/js/attachment_edit.js
Normal file
52
attachment_edit/static/src/js/attachment_edit.js
Normal file
@@ -0,0 +1,52 @@
|
||||
//-*- 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/>.
|
||||
//
|
||||
//############################################################################
|
||||
|
||||
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;
|
||||
},
|
||||
on_attachment_edit: function(e)
|
||||
{
|
||||
var $target = jQuery(e.currentTarget),
|
||||
attachment_id = parseInt($target.attr('data-id')),
|
||||
title = $target.attr('title');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.do_action({
|
||||
type: 'ir_actions.act_window',
|
||||
name: title,
|
||||
views: [[false, 'form']],
|
||||
res_model: 'ir.attachment',
|
||||
res_id: attachment_id,
|
||||
flags: {
|
||||
initial_mode: 'edit',
|
||||
},
|
||||
});
|
||||
},
|
||||
})
|
||||
}
|
||||
10
attachment_edit/static/src/xml/attachment_edit.xml
Normal file
10
attachment_edit/static/src/xml/attachment_edit.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user