public static void PendingChangesConfirmation(jQueryObject element,
            Func<bool> hasPendingChanges)
        {
            element.Bind("dialogbeforeclose", e =>
            {
                if (!e.HasOriginalEvent() || !hasPendingChanges())
                    return;

                e.PreventDefault();

                Q.Confirm("You have pending changes. Save them?", () =>
                {
                    element.Find("div.save-and-close-button").Click();
                }, new ConfirmOptions
                {
                    OnNo = () =>
                    {
                        element.Dialog().Close();
                    }
                });
            });
        }
Esempio n. 2
0
        public static void PendingChangesConfirmation(jQueryObject element,
                                                      Func <bool> hasPendingChanges)
        {
            element.Bind("dialogbeforeclose", e =>
            {
                if (!e.HasOriginalEvent() || !hasPendingChanges())
                {
                    return;
                }

                e.PreventDefault();

                Q.Confirm("You have pending changes. Save them?", () =>
                {
                    element.Find("div.save-and-close-button").Click();
                }, new ConfirmOptions
                {
                    OnNo = () =>
                    {
                        element.Dialog().Close();
                    }
                });
            });
        }
Esempio n. 3
0
        public static jQueryObject DialogResizable(this jQueryObject dialog,
                                                   int?w = null, int?h = null, int?mw = null, int?mh = null)
        {
            var dlg = dialog.Dialog();

            dlg.Resizable = true;
            if (mw != null)
            {
                dlg.MinWidth = mw.Value;
            }
            if (w != null)
            {
                dlg.Width = w.Value;
            }
            if (mh != null)
            {
                dlg.MinHeight = mh.Value;
            }
            if (h != null)
            {
                dlg.Height = h.Value;
            }
            return(dialog);
        }