var $customButons = this.$buttons.find('.oe_dialog_custom_buttons').empty();
_.each(buttons, function(fn, text) {
// buttons can be object or array
+ var pre_text = fn.pre_text || "";
+ var post_text = fn.post_text || "";
var oe_link_class = fn.oe_link_class;
if (!_.isFunction(fn)) {
text = fn.text;
fn = fn.click;
}
- var $but = $(QWeb.render('WidgetButton', { widget : { string: text, node: { attrs: {'class': oe_link_class} }}}));
+ var $but = $(QWeb.render('WidgetButton', { widget : { pre_text: pre_text, post_text: post_text, string: text, node: { attrs: {'class': oe_link_class} }}}));
$customButons.append($but);
- $but.on('click', function(ev) {
+ $but.filter('button').on('click', function(ev) {
fn.call(self.$el, ev);
});
});
delete(options.buttons);
}
this.renderElement();
-
this.$dialog_box = $(QWeb.render('Dialog', options)).appendTo("body");
this.$el.modal({
'backdrop': false,
size: 'medium',
title: "Odoo " + (_.str.capitalize(error.type) || "Warning"),
buttons: [
- {text: _t("Ok"), click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}},
- {text: error.data.arguments[2],
- oe_link_class: 'oe_link',
- click: function() {
- window.location.href='#action='+error.data.arguments[1];
- self.destroy();
- }}
+ {text: error.data.arguments[2],
+ oe_link_class : 'oe_highlight',
+ post_text : _t("or"),
+ click: function() {
+ window.location.href='#action='+error.data.arguments[1]
+ self.destroy();
+ }},
+ {text: _t("Cancel"), oe_link_class: 'oe_link', click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}}
],
}, QWeb.render('CrashManager.warning', {error: error})).open();
}
}
});
},
+ on_logo_click: function(ev){
+ if (!this.has_uncommitted_changes()) {
+ return;
+ } else {
+ ev.preventDefault();
+ }
+ },
show_common: function() {
var self = this;
this.crashmanager = new instance.web.CrashManager();
self.loading = new instance.web.Loading(self);
self.loading.appendTo(self.$('.openerp_webclient_container'));
self.action_manager = new instance.web.ActionManager(self);
- self.action_manager.appendTo(self.$('.oe_application'));
+ self.action_manager.replace(self.$('.oe_application'));
},
toggle_bars: function(value) {
this.$('tr:has(td.navbar),.oe_leftbar').toggle(value);
self.logo_edit(ev);
});
+ this.$('.oe_logo img').click(function(ev) {
+ self.on_logo_click(ev);
+ });
// Menu is rendered server-side thus we don't want the widget to create any dom
self.menu = new instance.web.Menu(self);
self.menu.setElement(this.$el.parents().find('.oe_application_menu_placeholder'));