~openerp-dev/openerp-web/trunk-jq-111

« back to all changes in this revision

Viewing changes to addons/web/static/src/js/view_form.js

  • Committer: Cedric Snauwaert
  • Date: 2014-04-11 13:29:34 UTC
  • mfrom: (3968.1.5 trunk-bootstrap-modal)
  • Revision ID: csn@openerp.com-20140411132934-iodyidypjxb7v9ug
[MERGE]change modal windows to only use bootstrap3

Show diffs side-by-side

added added

removed removed

Lines of Context:
586
586
            this._internal_set_values(result.value, processed);
587
587
        }
588
588
        if (!_.isEmpty(result.warning)) {
589
 
            instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), {
 
589
            new instance.web.Dialog(this, {
 
590
                size: 'medium',
590
591
                title:result.warning.title,
591
 
                modal: true,
592
592
                buttons: [
593
 
                    {text: _t("Ok"), click: function() { $(this).dialog("close"); }}
 
593
                    {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
594
594
                ]
595
 
            });
 
595
            }, QWeb.render("CrashManager.warning", result.warning)).open();
596
596
        }
597
597
 
598
598
        return $.Deferred().resolve();
1080
1080
                };
1081
1081
            })
1082
1082
            .value();
1083
 
 
1084
1083
        var d = new instance.web.Dialog(this, {
1085
1084
            title: _t("Set Default"),
1086
1085
            args: {
1956
1955
        var exec_action = function() {
1957
1956
            if (self.node.attrs.confirm) {
1958
1957
                var def = $.Deferred();
1959
 
                var dialog = instance.web.dialog($('<div/>').text(self.node.attrs.confirm), {
 
1958
                var dialog = instance.web.Dialog(this, {
1960
1959
                    title: _t('Confirm'),
1961
 
                    modal: true,
1962
1960
                    buttons: [
1963
1961
                        {text: _t("Cancel"), click: function() {
1964
 
                                $(this).dialog("close");
 
1962
                                this.parents('.modal').modal('hide');
1965
1963
                            }
1966
1964
                        },
1967
1965
                        {text: _t("Ok"), click: function() {
1968
1966
                                var self2 = this;
1969
1967
                                self.on_confirmed().always(function() {
1970
 
                                    $(self2).dialog("close");
 
1968
                                    self2.parents('.modal').modal('hide');
1971
1969
                                });
1972
1970
                            }
1973
1971
                        }
1974
1972
                    ],
1975
 
                    beforeClose: function() {
1976
 
                        def.resolve();
1977
 
                    },
1978
 
                });
 
1973
                }, $('<div/>').text(self.node.attrs.confirm)).open();
 
1974
                dialog.on("closing", null, function() {def.resolve();});
1979
1975
                return def.promise();
1980
1976
            } else {
1981
1977
                return self.on_confirmed();
3234
3230
    init: function(parent) {
3235
3231
        this._super(parent, {
3236
3232
            title: _.str.sprintf(_t("Add %s"), parent.string),
3237
 
            width: 312,
 
3233
            size: 'medium',
3238
3234
        });
3239
3235
    },
3240
3236
    start: function() {
3302
3298
            delete this.$drop_down;
3303
3299
        }
3304
3300
        if (this.$input) {
3305
 
            this.$input.closest(".ui-dialog .ui-dialog-content").off('scroll');
 
3301
            this.$input.closest(".modal .modal-content").off('scroll');
3306
3302
            this.$input.off('keyup blur autocompleteclose autocompleteopen ' +
3307
3303
                            'focus focusout change keydown');
3308
3304
            delete this.$input;
3395
3391
                self.$input.autocomplete("close");
3396
3392
            }
3397
3393
        }, 50);
3398
 
        this.$input.closest(".ui-dialog .ui-dialog-content").on('scroll', this, close_autocomplete);
 
3394
        this.$input.closest(".modal .modal-content").on('scroll', this, close_autocomplete);
3399
3395
 
3400
3396
        self.ed_def = $.Deferred();
3401
3397
        self.uned_def = $.Deferred();
4921
4917
        var self = this;
4922
4918
        this.renderElement();
4923
4919
        var dialog = new instance.web.Dialog(this, {
4924
 
            min_width: '800px',
4925
4920
            dialogClass: 'oe_act_window',
4926
 
            close: function() {
4927
 
                self.check_exit(true);
4928
 
            },
4929
4921
            title: this.options.title || "",
4930
4922
        }, this.$el).open();
 
4923
        dialog.on('closing', this, function (e){
 
4924
            self.check_exit(true);
 
4925
        });
4931
4926
        this.$buttonpane = dialog.$buttons;
4932
4927
        this.start();
4933
4928
    },
4994
4989
    },
4995
4990
    destroy: function () {
4996
4991
        this.trigger('closed');
4997
 
        if (this.$el.is(":data(dialog)")) {
4998
 
            this.$el.dialog('close');
 
4992
        if (this.$el.is(":data(bs.modal)")) {
 
4993
            this.$el.parents('.modal').modal('hide');
4999
4994
        }
5000
4995
        this._super();
5001
4996
    },