[FIX]use bootstrap modal windows. refactor and cleaned from trunk-ui-to-boostrap-modal

bzr revid: csn@openerp.com-20140410155022-3cqys3zc55idc4vg
This commit is contained in:
Cedric Snauwaert 2014-04-10 17:50:22 +02:00
parent 3ba23748bc
commit 3a4e264978
5 changed files with 20 additions and 28 deletions

View File

@ -86,10 +86,10 @@ openerp.account = function (instance) {
var self = this; var self = this;
var ids = this.get_selected_ids(); var ids = this.get_selected_ids();
if (ids.length === 0) { if (ids.length === 0) {
instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), { new instance.web.Dialog(this, {
title: _t("Warning"), title: _t("Warning"),
modal: true modal_size: 'medium',
}); }, $("<div />").text(_t("You must choose at least one record."))).open();
return false; return false;
} }

View File

@ -88,15 +88,12 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var qdict = { var qdict = {
current_layout : this.$el.find('.oe_dashboard').attr('data-layout') current_layout : this.$el.find('.oe_dashboard').attr('data-layout')
}; };
var $dialog = instance.web.dialog($('<div>'), { var $dialog = instance.web.Dialog(this, {
modal: true,
title: _t("Edit Layout"), title: _t("Edit Layout"),
width: 'auto', }, QWeb.render('DashBoard.layouts', qdict)).open();
height: 'auto'
}).html(QWeb.render('DashBoard.layouts', qdict));
$dialog.find('li').click(function() { $dialog.find('li').click(function() {
var layout = $(this).attr('data-layout'); var layout = $(this).attr('data-layout');
$dialog.dialog('destroy'); $dialog.modal('hide');
self.do_change_layout(layout); self.do_change_layout(layout);
}); });
}, },

View File

@ -664,13 +664,9 @@
.openerp .oe_followers .oe_partner .oe_hidden{ .openerp .oe_followers .oe_partner .oe_hidden{
display: none; display: none;
} }
.openerp.ui-dialog .ui-dialog-titlebar .ui-dialog-title{
padding-right: 20px;
}
.openerp .oe_followers .oe_show_more{ .openerp .oe_followers .oe_show_more{
cursor: pointer; cursor: pointer;
} }
/* ---------------- MESSAGES BODY ------------------ */ /* ---------------- MESSAGES BODY ------------------ */
.openerp .oe_mail .oe_msg_content .oe_blockquote, .openerp .oe_mail .oe_msg_content .oe_blockquote,
.openerp .oe_mail .oe_msg_content blockquote { .openerp .oe_mail .oe_msg_content blockquote {

View File

@ -94,19 +94,18 @@ openerp_mail_followers = function(session, mail) {
var $currentTarget = $(event.currentTarget); var $currentTarget = $(event.currentTarget);
var user_pid = $currentTarget.data('id'); var user_pid = $currentTarget.data('id');
$('div.oe_edit_actions').remove(); $('div.oe_edit_actions').remove();
self.$dialog = new session.web.dialog($('<div class="oe_edit_actions">'), { self.$dialog = new session.web.Dialog(this, {
modal: true, destroy_on_close: false,
width: 'auto', modal_size: 'small',
height: 'auto',
title: _t('Edit Subscription of ') + $currentTarget.siblings('a').text(), title: _t('Edit Subscription of ') + $currentTarget.siblings('a').text(),
buttons: [ buttons: [
{ text: _t("Apply"), click: function() { { text: _t("Apply"), click: function() {
self.do_update_subscription(event, user_pid); self.do_update_subscription(event, user_pid);
$(this).dialog("close"); this.parents('.modal').modal('hide');
}}, }},
{ text: _t("Cancel"), click: function() { $(this).dialog("close"); }} { text: _t("Cancel"), click: function() { this.parents('.modal').modal('hide'); }}
], ],
}); }, "<div class='oe_edit_actions'>").open();
return self.fetch_subtypes(user_pid); return self.fetch_subtypes(user_pid);
}, },
@ -272,7 +271,7 @@ openerp_mail_followers = function(session, mail) {
display_subtypes:function (data, id, dialog) { display_subtypes:function (data, id, dialog) {
var self = this; var self = this;
if (dialog) { if (dialog) {
var $list = self.$dialog; var $list = self.$dialog.$el;
} }
else { else {
var $list = this.$('.oe_subtype_list ul'); var $list = this.$('.oe_subtype_list ul');

View File

@ -56,12 +56,12 @@ openerp.web_linkedin = function(instance) {
this.linkedin_def.reject(); this.linkedin_def.reject();
this.auth_def.reject(); this.auth_def.reject();
IN = false; IN = false;
instance.web.dialog($(QWeb.render("LinkedIn.DisabledWarning", {'error': error})), { var dialog = new instance.web.Dialog(this, {
title: _t("LinkedIn is not enabled"), title: _t("LinkedIn is not enabled"),
buttons: [ buttons: [
{text: _t("Ok"), click: function() { $(this).dialog("close"); }} {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
] ],
}); }, QWeb.render('LinkedIn.DisabledWarning', {error: error})).open();
}, },
test_linkedin: function() { test_linkedin: function() {
var self = this; var self = this;
@ -369,11 +369,11 @@ openerp.web_linkedin = function(instance) {
}, },
bind_event: function() { bind_event: function() {
var self = this; var self = this;
this.$el.parent().on("click", ".oe_linkedin_logout", function () { this.$el.parents('.modal').on("click", ".oe_linkedin_logout", function () {
IN.User.logout(); IN.User.logout();
self.destroy(); self.destroy();
}); });
this.$search = this.$el.parent().find(".oe_linkedin_advanced_search" ); this.$search = this.$el.parents('.modal').find(".oe_linkedin_advanced_search" );
this.$url = this.$search.find("input[name='search']" ); this.$url = this.$search.find("input[name='search']" );
this.$button = this.$search.find("button"); this.$button = this.$search.find("button");
@ -396,7 +396,7 @@ openerp.web_linkedin = function(instance) {
IN.API.Profile("me") IN.API.Profile("me")
.fields(["firstName", "lastName"]) .fields(["firstName", "lastName"])
.result(function (result) { .result(function (result) {
$(QWeb.render('LinkedIn.loginInformation', result.values[0])).appendTo(self.$el.parent().find(".ui-dialog-buttonpane")); $(QWeb.render('LinkedIn.loginInformation', result.values[0])).appendTo(self.$el.parents('.modal').find(".oe_dialog_custom_buttons"));
}) })
}, },
do_search: function(url) { do_search: function(url) {