[FIX]Minor changes

bzr revid: vja@tinyerp.com-20121116091804-3lalobfufyp6yyx4
This commit is contained in:
Vishmita
2012-11-16 14:48:04 +05:30
parent f3b0459705
commit e3ca4012bc
3 changed files with 34 additions and 15 deletions
+1 -1
View File
@@ -471,7 +471,7 @@
.openerp .oe_form_buttons [accesskey] > p {
display:inline;
}
.openerp .oe_form_buttons .accessactive {
.openerp .oe_form_buttons span.access ,.oe_form_button span.access{
text-decoration:underline;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
font-weight:bold;
+29 -10
View File
@@ -227,17 +227,36 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
},
widgetAccesskey:function(){
var self = this;
self.$buttons.find("[accesskey]").html(function(i, html){
return html.replace(/^[^a-zA-Z]*([a-zA-Z])/g, '<p>$1</p>');
$(document).bind('keydown',function(e){
var list = $(document).find('.oe_form_buttons span button,.oe_form_buttons span a,.oe_application .oe_form_button, oe_list_content.oe_form_field_one2many_list_row_add a');
list = _.reject(list,function(r){ return $(r).hasClass('oe_form_invisible')})
var accesskey = _.map(list,function(r){ return $(r).attr('accesskey') });
_.each(list,function(el,i){
if (!$(el).attr("accesskey")) {
var text = $(el).text().trim().substr(0,1);
if (_.contains(accesskey.slice(0, i),text)){
var index = $(el).text().trim().indexOf(text);
var str = $(el).text().trim().substr(index + 1, index + 1);
$(el).attr('accesskey',str);
accesskey[i] = str;
}else {
$(el).attr('accesskey',text);
accesskey[i] = text ;
}
}
})
if (e.keyCode === e.which) {
_.each(list,function(rl,i){
$(rl).html(function(i, html){
return $(rl).text().replace($(rl).attr('accesskey'), '<span class ="access">' + $(rl).attr('accesskey') + '</span>');
})
})
}}).keyup(function(){
var accesskey_list = $(document).find('.oe_form_buttons span button,.oe_form_buttons span a,.oe_application .oe_form_button, oe_list_content.oe_form_field_one2many_list_row_add a');
accesskey_list.each(function(){
$(this).find('span.access').removeClass('access');
})
});
$(document).keydown(function(e){
self.$buttons.find("[accesskey] >p").removeClass("accessactive");
if (e.keyCode === $.ui.keyCode.ALT || e.keyCode === $.ui.keyCode.SHIFT && e.altKey) {
self.$buttons.find("[accesskey] >p").addClass("accessactive");
}
}).keyup(function(){
self.$buttons.find("[accesskey] > p").removeClass("accessactive");
})
},
widgetFocused: function() {
// Clear click flag if used to focus a widget
+4 -4
View File
@@ -776,15 +776,15 @@
<span class="oe_form_buttons_view">
<!-- required for the bounce effect on button -->
<div t-if="widget.is_action_enabled('edit')" style="display: inline-block;">
<button type="button" class="oe_button oe_form_button_edit" accesskey="E">Edit</button>
<button type="button" class="oe_button oe_form_button_edit">Edit</button>
</div>
<button t-if="widget.is_action_enabled('create')"
type="button" class="oe_button oe_form_button_create" accesskey="C">Create</button>
type="button" class="oe_button oe_form_button_create">Create</button>
</span>
<span class="oe_form_buttons_edit">
<button type="button" class="oe_button oe_form_button_save oe_highlight" accesskey="S">Save</button>
<button type="button" class="oe_button oe_form_button_save oe_highlight">Save</button>
<span class="oe_fade">or</span>
<a href="#" class="oe_bold oe_form_button_cancel" accesskey="D">Discard</a>
<a href="#" class="oe_bold oe_form_button_cancel">Discard</a>
</span>
</t>
</div>