コード例 #1
0
        public static bool AsyncSubmit(jQueryObject form, Func <bool> validateBeforeSave, Action submitHandler)
        {
            var validator = form.As <jQueryValidationObject>().Validate();

            dynamic valSettings = validator.As <dynamic>().settings;

            if (valSettings.abortHandler != null)
            {
                return(false);
            }

            if (validateBeforeSave != null &&
                validateBeforeSave() == false)
            {
                return(false);
            }

            valSettings["abortHandler"]  = new Action <jQueryValidator>(Q.Externals.ValidatorAbortHandler);
            valSettings["submitHandler"] = new Func <bool>(delegate()
            {
                if (submitHandler != null)
                {
                    submitHandler();
                }
                return(false);
            });

            form.Trigger("submit");
            return(true);
        }
コード例 #2
0
        public static bool Submit(jQueryObject form, Func <bool> validateBeforeSave, Action submitHandler)
        {
            var validator = form.As <jQueryValidationObject>().Validate();

            dynamic valSettings = validator.As <dynamic>().settings;

            if (valSettings.abortHandler != null)
            {
                return(false);
            }

            if (validateBeforeSave != null &&
                validateBeforeSave() == false)
            {
                return(false);
            }

            if (!validator.ValidateForm())
            {
                return(false);
            }

            if (submitHandler != null)
            {
                submitHandler();
            }

            return(true);
        }
コード例 #3
0
        public static object GetWidget(this jQueryObject element, Type widgetType)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (element.Length == 0)
            {
                throw new Exception(String.Format("Searching for widget of type '{0}' on a non-existent element! ({1})",
                                                  widgetType.FullName, element.Selector));
            }

            var widget = element.As <dynamic>().tryGetWidget(widgetType);

            if (widget == null)
            {
                var message = String.Format("Element has no widget of type '{0}'! If you have recently changed editor type of a property in " +
                                            "a form class, or changed data type in row (which also changes editor type) your script side Form definition might be out of date. " +
                                            "Make sure your project builds successfully and transform T4 templates", widgetType.FullName);

                Q.NotifyError(message);
                throw new Exception(message);
            }

            return(widget);
        }
コード例 #4
0
 public static void ColorBox(jQueryObject link, dynamic options)
 {
     link.As <dynamic>().colorbox(new
     {
         current  = "resim {current} / {total}",
         previous = "önceki",
         next     = "sonraki",
         close    = "kapat"
     });
 }
コード例 #5
0
 public static void ColorBox(jQueryObject link, dynamic options)
 {
     link.As <dynamic>().colorbox(new
     {
         current  = Q.Text("Controls.ImageUpload.ColorboxCurrent"),
         previous = Q.Text("Controls.ImageUpload.ColorboxPrior"),
         next     = Q.Text("Controls.ImageUpload.ColorboxNext"),
         close    = Q.Text("Controls.ImageUpload.ColorboxClose")
     });
 }
コード例 #6
0
        public static jQueryObject DialogMaximizable(this jQueryObject dialog)
        {
            dialog.As <dynamic>().dialogExtend(new
            {
                closable    = true,
                maximizable = true,
                dblclick    = "maximize",
                icons       = new
                {
                    maximize = "ui-icon-maximize-window"
                }
            });

            return(dialog);
        }
コード例 #7
0
ファイル: Validator.cs プロジェクト: CodeFork/Serenity
        public static bool Submit(jQueryObject form, Func<bool> validateBeforeSave, Action submitHandler)
        {
            var validator = form.As<jQueryValidationObject>().Validate();

            dynamic valSettings = validator.As<dynamic>().settings;
            if (valSettings.abortHandler != null)
                return false;

            if (validateBeforeSave != null &&
                validateBeforeSave() == false)
                return false;

            if (!validator.ValidateForm())
                return false;

            if (submitHandler != null)
                submitHandler();

            return true;
        }
コード例 #8
0
ファイル: Validator.cs プロジェクト: CodeFork/Serenity
        public static bool AsyncSubmit(jQueryObject form, Func<bool> validateBeforeSave, Action submitHandler)
        {
            var validator = form.As<jQueryValidationObject>().Validate();

            dynamic valSettings = validator.As<dynamic>().settings;
            if (valSettings.abortHandler != null)
                return false;

            if (validateBeforeSave != null &&
                validateBeforeSave() == false)
                return false;

            valSettings["abortHandler"] = new Action<jQueryValidator>(Q.Externals.ValidatorAbortHandler);
            valSettings["submitHandler"] = new Func<bool>(delegate()
            {
                if (submitHandler != null)
                    submitHandler();
                return false;
            });

            form.Trigger("submit");
            return true;
        }
コード例 #9
0
 public static void ColorBox(jQueryObject link, dynamic options)
 {
     link.As<dynamic>().colorbox(new
     {
         current = "resim {current} / {total}",
         previous = "önceki",
         next = "sonraki",
         close = "kapat"
     });
 }
コード例 #10
0
 public static void ColorBox(jQueryObject link, dynamic options)
 {
     link.As<dynamic>().colorbox(new
     {
         current = Q.Text("Controls.ImageUpload.ColorboxCurrent"),
         previous = Q.Text("Controls.ImageUpload.ColorboxPrior"),
         next = Q.Text("Controls.ImageUpload.ColorboxNext"),
         close = Q.Text("Controls.ImageUpload.ColorboxClose")
     });
 }