public static void RegisterControlPresenter(this HtmlHelper helper, Models.IClientControl model, string clientType, string instanceName, Dictionary <string, object> properties = null) { properties = properties == null ? new Dictionary <string, object>() : properties; RegisterCoreScripts(helper); if (!string.IsNullOrEmpty(model.ScriptPath)) { HtmlExtensions.RegisterScript(helper, model.ScriptPath + clientType + ".js", true); } properties["id"] = model.ClientId; //todo: not necessary now... same as ns? properties["ns"] = model.ClientId; //Properties["user"] = Services.Account.GetClientUser(); //var ser = new System.Web.Script.Serialization.JavaScriptSerializer(); //no binders for date conversions... HtmlExtensions.RegisterDocumentReadyScript(helper, model.ClientId + "Presenter", string.Format("videre.widgets.register('{0}', {1}, {2});", model.ClientId, clientType, properties.ToJson(ignoreType: "client"))); }
public static void RegisterTheme(this HtmlHelper helper, Models.PageTemplate template) { var theme = Services.UI.PortalTheme; if (template != null && template.Layout != null && template.Layout.Theme != null) { theme = template.Layout.Theme; } if (template != null && template != null && template.Theme != null) { theme = template.Theme; } if (theme != null) { foreach (var file in theme.Files) { if (file.Type == Models.ReferenceFileType.Css) { HtmlExtensions.RegisterStylesheet(helper, file.Path, true, new Dictionary <string, string>() { { "type", "theme" } }); } if (file.Type == Models.ReferenceFileType.Script) { HtmlExtensions.RegisterScript(helper, file.Path, true, new Dictionary <string, string>() { { "type", "theme" } }); } } } else { HtmlExtensions.RegisterStylesheet(helper, "~/scripts/bootstrap-2.1.0/css/bootstrap.css", true, new Dictionary <string, string>() { { "type", "theme" } }); } }