[IMP]header as input box.
bzr revid: vme@tinyerp.com-20120822132805-nmesgyvh29m5gnr9
This commit is contained in:
parent
026f765107
commit
a69baa4d9c
|
@ -50,6 +50,13 @@
|
|||
content: "+";
|
||||
margin-left: 4px;
|
||||
}
|
||||
.openerp .oe_dashboard .oe_action .oe_header .oe_header_text {
|
||||
visibility: hidden;
|
||||
cursor: text;
|
||||
}
|
||||
.openerp .oe_dashboard .oe_action .oe_header span {
|
||||
cursor: pointer;
|
||||
}
|
||||
.openerp .oe_dashboard .oe_action .oe_header_empty {
|
||||
padding-top: 0;
|
||||
padding-bottom: 2px;
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
.oe_maximize:after
|
||||
content: "+"
|
||||
margin-left: 4px
|
||||
.oe_header_text
|
||||
visibility: hidden
|
||||
cursor: text
|
||||
span
|
||||
cursor: pointer
|
||||
.oe_header_empty
|
||||
padding-top: 0
|
||||
padding-bottom: 2px
|
||||
|
|
|
@ -22,12 +22,15 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
|
|||
connectWith: '.oe_dashboard_column',
|
||||
handle: '.oe_header',
|
||||
scroll: false
|
||||
}).disableSelection().bind('sortstop', self.do_save_dashboard);
|
||||
}).bind('sortstop', self.do_save_dashboard);
|
||||
|
||||
// Events
|
||||
this.$element.find('.oe_dashboard_link_reset').click(this.on_reset);
|
||||
this.$element.find('.oe_dashboard_link_change_layout').click(this.on_change_layout);
|
||||
|
||||
this.$element.find('h2.oe_header span:first').click(function(ev){
|
||||
if(ev.target === ev.currentTarget)
|
||||
self.on_header_string($(ev.target).parent());
|
||||
});
|
||||
this.$element.delegate('.oe_dashboard_column .oe_fold', 'click', this.on_fold_action);
|
||||
this.$element.delegate('.oe_dashboard_column .oe_close', 'click', this.on_close_action);
|
||||
|
||||
|
@ -46,6 +49,30 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
|
|||
});
|
||||
});
|
||||
},
|
||||
on_header_string:function(h2){
|
||||
var self = this;
|
||||
var span = h2.find('span:first').hide();
|
||||
var input = h2.find('.oe_header_text').css('visibility','visible');
|
||||
var attr = h2.closest(".oe_action").data('action_attrs');
|
||||
var change_string = function(new_name){
|
||||
attr['string'] = new_name;
|
||||
span.text(new_name).show();
|
||||
input.css('visibility','hidden');
|
||||
self.do_save_dashboard();
|
||||
}
|
||||
input.unbind()
|
||||
.val(span.text())
|
||||
.change(function(event){
|
||||
change_string($(this).val());
|
||||
})
|
||||
.keyup(function(event){
|
||||
if(event.keyCode == 27){
|
||||
//esc key to cancel changes
|
||||
input.css('visibility','hidden');
|
||||
span.show();
|
||||
}
|
||||
});
|
||||
},
|
||||
on_reset: function() {
|
||||
this.rpc('/web/view/undo_custom', {
|
||||
view_id: this.view.fields_view.view_id,
|
||||
|
|
|
@ -23,13 +23,15 @@
|
|||
<t t-name="DashBoard.action">
|
||||
<div t-att-data-id="action.attrs.name" class="oe_action">
|
||||
<h2 t-attf-class="oe_header #{action.attrs.string ? '' : 'oe_header_empty'}">
|
||||
<t t-esc="action.attrs.string"/>
|
||||
<span><t t-esc="action.attrs.string"/></span>
|
||||
<input class = "oe_header_text" type="text"/>
|
||||
<t t-if="!action.attrs.string">&nbsp;</t>
|
||||
<button t-if="action.attrs.creatable and action.attrs.creatable !== 'false'" class="oe_button oe_button_create">Create</button>
|
||||
<span class='oe_icon oe_close'></span>
|
||||
<span class='oe_icon oe_minimize oe_fold' t-if="!action.attrs.fold"></span>
|
||||
<span class='oe_icon oe_maximize oe_fold' t-if="action.attrs.fold"></span>
|
||||
</h2>
|
||||
|
||||
<div t-attf-id="#{view.element_id}_action_#{column_index}_#{action_index}" class="oe_content" t-att-style="action.attrs.fold ? 'display: none' : null"></div>
|
||||
</div>
|
||||
</t>
|
||||
|
|
Loading…
Reference in New Issue