[ADD] Rename feature in dashboards
bzr revid: fme@openerp.com-20110606142927-lkg4badlh5u18vgd
This commit is contained in:
@@ -14,6 +14,17 @@
|
||||
padding-bottom: 4px;
|
||||
padding-left: 0.2em
|
||||
}
|
||||
.openerp a.oe-dashboard-action-rename {
|
||||
float: left;
|
||||
padding-right: 4px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.openerp .oe-dashboard-action-input {
|
||||
height: 16px;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.openerp .oe-dashboard-action .oe-dashboard-action-header:hover {
|
||||
cursor: move;
|
||||
|
||||
@@ -38,6 +38,8 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
}, self.on_load_action);
|
||||
});
|
||||
});
|
||||
|
||||
this.$element.find('a.oe-dashboard-action-rename').live('click', this.on_rename);
|
||||
},
|
||||
on_undo: function() {
|
||||
this.rpc('/base/view/undo_custom', {
|
||||
@@ -114,6 +116,30 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
on_rename : function(e) {
|
||||
var self = this,
|
||||
id = $(e.currentTarget).parents('.oe-dashboard-action:first').attr('data-id'),
|
||||
$header = $(e.currentTarget).parents('.oe-dashboard-action-header:first'),
|
||||
$rename = $header.find('a.oe-dashboard-action-rename').hide(),
|
||||
$title = $header.find('span.oe-dashboard-action-title').hide(),
|
||||
$input = $header.find('input[name=title]');
|
||||
$input.val($title.text()).show().focus().bind('keydown', function(e) {
|
||||
if (e.which == 13 || e.which == 27) {
|
||||
if (e.which == 13) { //enter
|
||||
var val = $input.val();
|
||||
if (!val) {
|
||||
return false;
|
||||
}
|
||||
$title.text(val);
|
||||
self.actions_attrs[id].string = val;
|
||||
self.do_save_dashboard();
|
||||
}
|
||||
$input.unbind('keydown').hide();
|
||||
$rename.show();
|
||||
$title.show();
|
||||
}
|
||||
});
|
||||
},
|
||||
on_change_layout: function() {
|
||||
var self = this;
|
||||
var qdict = {
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
<t t-name="DashBoard.action">
|
||||
<div t-att-data-id="action.attrs.name" class="oe-dashboard-action ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
|
||||
<div class="oe-dashboard-action-header ui-widget-header ui-corner-all">
|
||||
<t t-esc="action.attrs.string"/>
|
||||
<a href="#" class="oe-dashboard-action-rename"><img src="/base/static/src/img/icons/gtk-edit.png" width="16" height="16"/></a>
|
||||
<span class="oe-dashboard-action-title"><t t-esc="action.attrs.string"/></span>
|
||||
<input class="oe-dashboard-action-input" type="text" name="title" value="" style="display: none"/>
|
||||
<span class='ui-icon ui-icon-closethick'></span>
|
||||
<span class='ui-icon ui-icon-minusthick'></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user