private IScriptView Register(ScriptView view) { var form = view.GetElement <FormSE>("registerForm"); var data = form.Data; var result = SignUp(data); if (result.Success) { view.WriteCode("SnippetLogin.displaySignInForm();"); view.WriteCode(string.Format("$$('#loginForm').show('{0}');", Strings.OperationSucceededPleaseLogin)); } else { view.WriteCode(string.Format("registerForm.proxy().showError('{0}');", result.Message)); } return(view); }
public static void BootboxConfirm(this ScriptView view, string message, Action ifTrue, Action ifFalse = null) { view.WriteCode(string.Format("bootbox.confirm({0}, function (r) ", JSON.GetCode(message))); view.WriteCode("{"); view.WriteCode(" if (r) {"); ifTrue(); view.WriteCode(" }"); if (ifFalse != null) { view.WriteCode(" else{"); ifFalse(); view.WriteCode(" }"); } view.WriteCode(" });"); }
protected virtual IScriptView Login(ScriptView view) { var form = view.GetElement <FormSE>("loginForm"); var data = form.Data; data["ip"] = HttpContext.Current.Request.UserHostAddress; var success = SignIn(data); if (success) { view.Redirect(this.SuccessUrl); } else { view.WriteCode(string.Format("loginForm.proxy().showError('{0}');", Strings.WrongUserNamePassword)); } return(view); }
public static void SweetAlertConfirm(this ScriptView view, string title, string text, Action ifTrue, Action ifFalse = null) { view.WriteCode(string.Format("$$metronic.sweetAlert.confirm({0},{1},function()", JSON.GetCode(title), JSON.GetCode(text))); view.WriteCode("{"); ifTrue(); view.WriteCode("}"); if (ifFalse != null) { view.WriteCode(",function(){"); ifFalse(); view.WriteCode("}"); } view.WriteCode(");"); }
public static void PageBarTitle(this ScriptView view, string title) { view.WriteCode(string.Format("$$.page.bar.title({0});", JSON.GetCode(title))); }
public static void SweetAlertSucess(this ScriptView view, string title, string text) { view.WriteCode(string.Format("$$metronic.sweetAlert.success({0},{1});", JSON.GetCode(title), JSON.GetCode(text))); }
public static void BootboxAlert(this ScriptView view, string message) { view.WriteCode("bootbox.alert({buttons:{ok:{label: '确定',}},"); view.WriteCode(string.Format(" message: {0}", JSON.GetCode(message))); view.WriteCode("});"); }
/// <summary> /// 追加一个站点路径 /// </summary> /// <param name="text"></param> /// <param name="url"></param> public void AddSitePath(string text, string url) { var code = string.Join(string.Empty, "$$(\"#sitePath\").push({ text: \"", text, "\", url: \"", url, "\" });"); _view.WriteCode(code); }