diff --git a/designs/logo-inverted.psd b/designs/logo-inverted.psd new file mode 100644 index 00000000..c3bd309f Binary files /dev/null and b/designs/logo-inverted.psd differ diff --git a/docs/developer/overrides.md b/docs/developer/overrides.md index 5b20e779..b61c3473 100644 --- a/docs/developer/overrides.md +++ b/docs/developer/overrides.md @@ -1,19 +1,31 @@ # Overrides -Frapid searches for overridden views on the instance directory and loads them if found. +Frapid searches for overridden views on the theme and instance directories and loads them if found: -For example: the view: +For: -`~/Areas/Frapid.Account/Views/SignUp/Index.cshtml` +* **Domain Name**: fizbuzz.com +* **Area Name** : Frapid.Account +* **Controller Name** : SignUp +* **Action Name** : Index +* **Current Theme** : frapid + +When you request the view: + +```cs +var view = View(GetRazorView("SignUp/Index.cshtml")); +``` -would be overridden by: +it will be searched on the current theme directory (~/Catalogs/fizzbuzz_com/Areas/Frapid.WebsiteBuilder/Themes/frapid/): -`~/Catalogs/foo_com/Areas/Frapid.Account/Views/SignUp/Index.cshtml` +`~/Catalogs/fizzbuzz_com/Areas/Frapid.WebsiteBuilder/Themes/frapid/Areas/Frapid.Account/Views/SignUp/Index.cshtml` -for foo.com and +if not found then -`~/Catalogs/bar_com/Areas/Frapid.Account/Views/SignUp/Index.cshtml` +`~/Catalogs/fizzbuzz_com/Areas/Frapid.Account/Views/SignUp/Index.cshtml` -for bar.com. +if not found then + +`~/Areas/Frapid.Account/Views/SignUp/Index.cshtml` [Back to Developer Documentation](README.md) diff --git a/src/Frapid.Web/Areas/Frapid.Account/Controllers/BaseAuthenticationController.cs b/src/Frapid.Web/Areas/Frapid.Account/Controllers/BaseAuthenticationController.cs index 5735180a..b21abf4e 100644 --- a/src/Frapid.Web/Areas/Frapid.Account/Controllers/BaseAuthenticationController.cs +++ b/src/Frapid.Web/Areas/Frapid.Account/Controllers/BaseAuthenticationController.cs @@ -9,10 +9,11 @@ using Frapid.Areas; using Frapid.Configuration; using Frapid.TokenManager; +using Frapid.WebsiteBuilder.Controllers; namespace Frapid.Account.Controllers { - public class BaseAuthenticationController : FrapidController + public class BaseAuthenticationController : WebsiteBuilderController { protected ActionResult OnAuthenticated(LoginResult result, SignInInfo model = null) { diff --git a/src/Frapid.Web/Areas/Frapid.Account/Views/ConfigurationProfile/Index.cshtml b/src/Frapid.Web/Areas/Frapid.Account/Views/ConfigurationProfile/Index.cshtml index dd40ede1..4680e645 100644 --- a/src/Frapid.Web/Areas/Frapid.Account/Views/ConfigurationProfile/Index.cshtml +++ b/src/Frapid.Web/Areas/Frapid.Account/Views/ConfigurationProfile/Index.cshtml @@ -30,7 +30,7 @@ scrudFactory.keys = [ { property: "RegistrationOfficeId", - url: '/api/config/office/display-fields', + url: '/api/core/office/display-fields', data: null, valueField: "Key", textField: "Value" diff --git a/src/Frapid.Web/Areas/Frapid.Account/Views/User/Index.cshtml b/src/Frapid.Web/Areas/Frapid.Account/Views/User/Index.cshtml index 41352c76..3343c5ff 100644 --- a/src/Frapid.Web/Areas/Frapid.Account/Views/User/Index.cshtml +++ b/src/Frapid.Web/Areas/Frapid.Account/Views/User/Index.cshtml @@ -42,7 +42,7 @@ scrudFactory.keys = [ { property: "OfficeId", - url: '/api/config/office/display-fields', + url: '/api/core/office/display-fields', data: null, valueField: "Key", textField: "Value" diff --git a/src/Frapid.Web/Areas/Frapid.Config/Views/Office/Index.cshtml b/src/Frapid.Web/Areas/Frapid.Config/Views/Office/Index.cshtml index 42c779e4..8ea120e6 100644 --- a/src/Frapid.Web/Areas/Frapid.Config/Views/Office/Index.cshtml +++ b/src/Frapid.Web/Areas/Frapid.Config/Views/Office/Index.cshtml @@ -10,11 +10,11 @@ scrudFactory.title = "Offices"; - scrudFactory.viewAPI = "/api/config/office"; - scrudFactory.viewTableName = "config.offices"; + scrudFactory.viewAPI = "/api/core/office"; + scrudFactory.viewTableName = "core.offices"; - scrudFactory.formAPI = "/api/config/office"; - scrudFactory.formTableName = "config.offices"; + scrudFactory.formAPI = "/api/core/office"; + scrudFactory.formTableName = "core.offices"; scrudFactory.disabledOnEdit = ["AuthorId"]; scrudFactory.excludedColumns = ["AuditUserId", "AuditTs"]; @@ -37,7 +37,7 @@ scrudFactory.keys = [ { property: "ParentOfficeId", - url: '/api/config/office/display-fields', + url: '/api/core/office/display-fields', data: null, valueField: "Key", textField: "Value" diff --git a/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/0.menu.sql b/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/0.menu.sql index 84392c34..e976d9fd 100644 --- a/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/0.menu.sql +++ b/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/0.menu.sql @@ -1,5 +1,4 @@ SELECT * FROM core.create_app('Frapid.Config', 'Config', '1.0', 'MixERP Inc.', 'December 1, 2015', 'orange configure', '/dashboard/config/offices', null); - -SELECT * FROM core.create_menu('Frapid.Config', 'Office', '/dashboard/config/offices', 'building outline', ''); +SELECT * FROM core.create_menu('Frapid.Config', 'Offices', '/dashboard/config/offices', 'building outline', ''); SELECT * FROM core.create_menu('Frapid.Config', 'Flags', '/dashboard/config/flags', 'flag', ''); SELECT * FROM core.create_menu('Frapid.Config', 'SMTP', '/dashboard/config/smtp', 'at', ''); \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/1.menu-policy.sql b/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/1.menu-policy.sql index d5d4eeba..1c49e1af 100644 --- a/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/1.menu-policy.sql +++ b/src/Frapid.Web/Areas/Frapid.Config/db/1.x/1.0/src/09.menus/1.menu-policy.sql @@ -3,7 +3,7 @@ SELECT * FROM auth.create_app_menu_policy 'User', core.get_office_id_by_office_name('Default'), 'Frapid.Config', - '{Office, Flags}'::text[] + '{Offices, Flags}'::text[] ); SELECT * FROM auth.create_app_menu_policy diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Configuration.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Configuration.cs new file mode 100644 index 00000000..1f43a3b9 --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Configuration.cs @@ -0,0 +1,43 @@ +using System.Globalization; +using System.Web.Hosting; +using Frapid.ApplicationState.Cache; +using Frapid.Configuration; +using static System.String; + +namespace Frapid.Dashboard +{ + public class Configuration + { + private const string Path = "~/Catalogs/{0}/Areas/Frapid.Dashboard/"; + private const string ConfigFile = "Dashboard.config"; + private const string DefaultThemeKey = "DefaultTheme"; + + public static string GetCurrentThemePath() + { + string catalog = AppUsers.GetCatalog(); + string path = Path + "Themes/{1}/"; + string theme = GetDefaultTheme(); + + return Format(CultureInfo.InvariantCulture, path, catalog, theme); + } + + public static string GetDashboardPath() + { + string catalog = AppUsers.GetCatalog(); + string path = HostingEnvironment.MapPath(Format(CultureInfo.InvariantCulture, Path, catalog)); + + return path != null && !System.IO.Directory.Exists(path) ? Empty : path; + } + + public static string GetDefaultTheme() + { + return Get(DefaultThemeKey); + } + + public static string Get(string key) + { + string path = GetDashboardPath() + "/" + ConfigFile; + return ConfigurationManager.ReadConfigurationValue(path, key); + } + } +} \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/AppController.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/AppController.cs index f5c83778..729b168d 100644 --- a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/AppController.cs +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/AppController.cs @@ -1,5 +1,9 @@ -using System.Web.Mvc; +using System.Collections.Generic; +using System.IO; +using System.Web.Hosting; +using System.Web.Mvc; using Frapid.Areas; +using Frapid.Configuration; using Frapid.Dashboard.DAL; namespace Frapid.Dashboard.Controllers diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DashboardController.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DashboardController.cs index 2445372e..38e6eac8 100644 --- a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DashboardController.cs +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DashboardController.cs @@ -2,31 +2,45 @@ using System.IO; using System.Web.Hosting; using System.Web.Mvc; -using Frapid.ApplicationState.Cache; using Frapid.Areas; +using Frapid.Configuration; namespace Frapid.Dashboard.Controllers { public class DashboardController : FrapidController { - private static readonly string BasePath = "~/Areas/Frapid.Dashboard/Views"; - private static readonly string LandingPage = BasePath + "/Default/LandingPage.cshtml"; - private static readonly string LayoutByConvention = "~/Catalogs/{0}/Areas/Frapid.Dashboard/Views/Layouts/"; - private static readonly string FallbackLayout = "~/Areas/Frapid.Dashboard/Views/Layouts/"; - private static readonly string LayoutFile = "Dashboard.cshtml"; + private static readonly string LandingPage = "~/Areas/Frapid.Dashboard/Views/Default/LandingPage.cshtml"; public DashboardController() { - ViewBag.ViewPath = GetViewPath(); - ViewBag.LayoutPath = GetLayoutPath(); - ViewBag.LayoutFile = LayoutFile; + ViewBag.LayoutPath = this.GetLayoutPath(); + ViewBag.LayoutFile = this.GetLayoutFile(); + } + + private string GetLayoutFile() + { + string theme = Configuration.GetDefaultTheme(); + return ThemeConfiguration.GetLayout(theme); + } + + private string GetLayoutPath() + { + string layout = Configuration.GetCurrentThemePath(); + string layoutDirectory = HostingEnvironment.MapPath(layout); + + if (layoutDirectory != null && Directory.Exists(layoutDirectory)) + { + return layout; + } + + return null; } protected override void OnActionExecuting(ActionExecutingContext filterContext) { if (!filterContext.HttpContext.Request.IsAjaxRequest()) { - ViewBag.Layout = GetLayoutPath() + LayoutFile; + ViewBag.Layout = GetLayoutPath() + this.GetLayoutFile(); } } @@ -35,25 +49,53 @@ protected ViewResultBase FrapidView(string path, object model = null) return View(this.HttpContext.Request.IsAjaxRequest() ? path : LandingPage, model); } - protected string GetViewPath(string view = "") + protected string GetRazorView(string areaName, string path) { - return BasePath + view; - } + string catalog = DbConvention.GetCatalog(); + string theme = Configuration.GetDefaultTheme(); - protected string GetLayoutPath() - { - string layout = LayoutByConvention; - string catalog = AppUsers.GetCatalog(); - layout = string.Format(CultureInfo.InvariantCulture, layout, catalog); - string layoutDirectory = HostingEnvironment.MapPath(layout); + string overridePath = "~/Catalogs/{0}/Areas/Frapid.Dashboard/Themes/{1}/Areas/{2}/Views/" + path; + overridePath = string.Format(CultureInfo.InvariantCulture, overridePath, catalog, theme, areaName); - if (layoutDirectory != null && Directory.Exists(layoutDirectory)) + if (System.IO.File.Exists(HostingEnvironment.MapPath(overridePath))) { - return layout; + return overridePath; + } + + + overridePath = "~/Catalogs/{0}/Areas/{1}/Themes/{2}/Views/" + path; + overridePath = string.Format(CultureInfo.InvariantCulture, overridePath, catalog, areaName, theme); + + if (System.IO.File.Exists(HostingEnvironment.MapPath(overridePath))) + { + return overridePath; } - return FallbackLayout; + string defaultPath = "~/Areas/{0}/Views/{1}"; + defaultPath = string.Format(CultureInfo.InvariantCulture, defaultPath, areaName, path); + + return defaultPath; + } + + protected string GetRazorView(string areaName, string controllerName, string actionName) + { + string path = controllerName.ToLower() + "/" + actionName.ToLower() + ".cshtml"; + return this.GetRazorView(areaName, path); + } + + protected string GetRazorView(string path) where T : FrapidAreaRegistration, new() + { + FrapidAreaRegistration registration = new T(); + return this.GetRazorView(registration.AreaName, path); + } + + protected string GetRazorView(string controllerName, string actionName) + where T : FrapidAreaRegistration, new() + { + FrapidAreaRegistration registration = new T(); + string path = controllerName.ToLower() + "/" + actionName.ToLower() + ".cshtml"; + return this.GetRazorView(registration.AreaName, path); } } } \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DefaultController.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DefaultController.cs index 60523e6d..5add0e06 100644 --- a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DefaultController.cs +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/DefaultController.cs @@ -19,6 +19,8 @@ public ActionResult Index() [RestrictAnonymous] public ActionResult GetMeta() { + var curent = AppUsers.GetCurrent(); + return Json(new ViewModels.Dashboard { Culture = CultureManager.GetCurrent().Name, @@ -26,10 +28,10 @@ public ActionResult GetMeta() JqueryUIi18NPath = "/Scripts/jquery-ui/i18n/", Today = DateTime.Now.ToShortDateString(), Now = DateTime.Now.ToString(CultureManager.GetCurrent()), - UserId = AppUsers.GetCurrent().UserId, - User = AppUsers.GetCurrent().Email, - Office = AppUsers.GetCurrent().Office, - MetaView = AppUsers.GetCurrent(), + UserId = curent.UserId, + User = curent.Email, + Office = curent.Office, + MetaView = curent, ShortDateFormat = CultureManager.GetShortDateFormat(), LongDateFormat = CultureManager.GetLongDateFormat(), ThousandSeparator = CultureManager.GetThousandSeparator(), @@ -42,12 +44,5 @@ public ActionResult GetMeta() DatepickerNumberOfMonths = "[2, 3]" }, JsonRequestBehavior.AllowGet); } - - [Route("dashboard/apps")] - [RestrictAnonymous] - public ActionResult GetApps() - { - return View(GetRazorView("Default/Apps.cshtml")); - } } } \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/MyTemplateController.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/MyTemplateController.cs new file mode 100644 index 00000000..dd14fc6e --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/MyTemplateController.cs @@ -0,0 +1,61 @@ +using System.EnterpriseServices; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.Hosting; +using System.Web.Mvc; +using Frapid.Configuration; + +namespace Frapid.Dashboard.Controllers +{ + public class MyTemplateController : Controller + { + [Route("dashboard/my/template/{*resource}")] + public ActionResult Get(string resource = "") + { + string configFile = + HostingEnvironment.MapPath($"~/Catalogs/{DbConvention.GetCatalog()}/Configs/Frapid.config"); + + if (!System.IO.File.Exists(configFile)) + { + return this.HttpNotFound(); + } + + var allowed = ConfigurationManager.ReadConfigurationValue(configFile, "MyAllowedResources").Split(','); + + if (string.IsNullOrWhiteSpace(resource) || allowed.Count().Equals(0)) + { + return this.HttpNotFound(); + } + + string directory = HostingEnvironment.MapPath(Configuration.GetCurrentThemePath()); + + if (directory == null) + { + return this.HttpNotFound(); + } + + string path = Path.Combine(directory, resource); + + if (!System.IO.File.Exists(path)) + { + return this.HttpNotFound(); + } + + string extension = Path.GetExtension(path); + + if (!allowed.Contains(extension)) + { + return this.HttpNotFound(); + } + + string mimeType = this.GetMimeType(path); + return this.File(path, mimeType); + } + + private string GetMimeType(string fileName) + { + return MimeMapping.GetMimeMapping(fileName); + } + } +} \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/ThemeController.cs b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/ThemeController.cs new file mode 100644 index 00000000..e7dee63d --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Controllers/ThemeController.cs @@ -0,0 +1,65 @@ +using System.IO; +using System.Linq; +using System.Net; +using System.Web.Hosting; +using System.Web.Mvc; +using Frapid.Areas; +using Frapid.Configuration; + +namespace Frapid.Dashboard.Controllers +{ + [AntiForgery] + public class ThemeController : FrapidController + { + [Route("dashboard/my/themes")] + [RestrictAnonymous] + public ActionResult GetThemes() + { + string catalog = DbConvention.GetCatalog(); + string path = $"~/Catalogs/{catalog}/Areas/Frapid.Dashboard/Themes"; + path = HostingEnvironment.MapPath(path); + + if (path == null || !Directory.Exists(path)) + { + return new HttpStatusCodeResult(HttpStatusCode.NotFound); + } + + var directories = Directory.GetDirectories(path); + var templates = directories.Select(directory => new DirectoryInfo(directory).Name).ToList(); + + return Json(templates, JsonRequestBehavior.AllowGet); + } + + [Route("dashboard/my/themes/set-default/{themeName}")] + [RestrictAnonymous] + [HttpPost] + public ActionResult SetAsDefault(string themeName) + { + if (string.IsNullOrEmpty(themeName)) + { + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + } + + string catalog = DbConvention.GetCatalog(); + string path = $"~/Catalogs/{catalog}/Areas/Frapid.Dashboard/Themes/{themeName}"; + path = HostingEnvironment.MapPath(path); + + if (path == null || !Directory.Exists(path)) + { + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + } + + path = $"~/Catalogs/{catalog}/Areas/Frapid.Dashboard/Dashboard.config"; + path = HostingEnvironment.MapPath(path); + + if (path == null || !System.IO.File.Exists(path)) + { + return new HttpStatusCodeResult(HttpStatusCode.InternalServerError); + } + + + ConfigurationManager.SetConfigurationValue(path, "DefaultTheme", themeName); + return Json("OK", JsonRequestBehavior.AllowGet); + } + } +} \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Frapid.Dashboard.csproj b/src/Frapid.Web/Areas/Frapid.Dashboard/Frapid.Dashboard.csproj index eee49966..63df2753 100644 --- a/src/Frapid.Web/Areas/Frapid.Dashboard/Frapid.Dashboard.csproj +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Frapid.Dashboard.csproj @@ -122,17 +122,21 @@ + + + + @@ -140,7 +144,6 @@ - diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Dashboard.config b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Dashboard.config new file mode 100644 index 00000000..51ecf631 --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Dashboard.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.html b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.html new file mode 100644 index 00000000..926d8688 --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.html @@ -0,0 +1,22 @@ +
+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Views/Default/Apps.cshtml b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.js similarity index 60% rename from src/Frapid.Web/Areas/Frapid.Dashboard/Views/Default/Apps.cshtml rename to src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.js index 30eda347..7b8d65ac 100644 --- a/src/Frapid.Web/Areas/Frapid.Dashboard/Views/Default/Apps.cshtml +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/apps.js @@ -1,34 +1,3 @@ -@using Frapid.ApplicationState.Cache -@model dynamic - -@{ - ViewBag.Title = "Frapid Dashboard"; - Layout = @ViewBag.Layout; -} -
-
-
-
-
-
-
-
- - - - - + }); \ No newline at end of file diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.css b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.css new file mode 100644 index 00000000..06b17c9f --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.css @@ -0,0 +1,104 @@ +#PhoneMenu a { + display: block !important; + text-align: center !important; + padding: 8px 0; + font-weight: bold; + color: #1B1C1D; +} + +#PhoneMenu a { + font-size: 12px; +} + + #PhoneMenu a span { + display: block; + margin: 12px !important; + } + + #PhoneMenu a:hover, #PhoneMenu a:active, #PhoneMenu a:focus { + color: #0556B3; + box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.3); + outline: none; + } + +.large.icon { + font-size: 34px !important; + text-align: center !important; +} + +.ui.link span.text { + padding: 8px 0 !important; + display: block !important; + text-align: center !important; +} + +#Search input { + text-align: center; +} + + #Search input:focus { + min-width: 30vw; + } + +.hidden, .initially.hidden { + display: none; +} + +html, body, div, p, table, td, th { + font-size: 12px; +} + +label, .ui.toggle.checkbox label { + cursor: pointer; +} + +.dashboard.menu { + height: 32px; +} + +input[readonly], input[disabled], textarea[readonly], textarea[disabled], select[readonly], select[disabled], .dropdown.disabled { + background-color: #f0f0f0 !important; + cursor: not-allowed; +} + +[data-ng-view], [ng-view] { + height: 100%; +} + +.vpad8 { + padding: 8px 0; +} + +.error { + color: brown; +} + +.background.slider { + position: fixed; + top: 0; + left: 0; + background-color: #e3e3e3; + height: 100%; + width: 100%; + z-index: -2; +} + +.dashboard.menu { + background-color: transparent; + border-style: none !important; + background-image: url('/Static/images/transparent50.png') !important; + background-repeat: repeat; +} + + .dashboard.menu .item { + color: #f0f0f0 !important; + } + +#PhoneMenu { + padding: 48px; + border-radius: 12px; + background-color: transparent; + background-image: url('/Static/images/70white.png') !important; + background-repeat: repeat; + border: 1px dotted #e3e3e3; +} diff --git a/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.js b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.js new file mode 100644 index 00000000..2519df33 --- /dev/null +++ b/src/Frapid.Web/Areas/Frapid.Dashboard/Override/Frapid.Dashboard/Themes/frapid/Contents/dashboard.js @@ -0,0 +1,255 @@ +$.getJSON("/dashboard/meta", function (response) { + window.meta = response; + window.culture = meta.Culture; + window.language = meta.Language; + window.jqueryUIi18nPath = meta.JqueryUIi18NPath; + window.today = meta.Today; + window.now = meta.Now; + window.date = today; + window.userId = meta.UserId; + window.user = meta.User; + window.office = meta.Office; + window.metaView = meta.MetaView; + window.shortDateFormat = meta.ShortDateFormat; + window.longDateFormat = meta.LongDateFormat; + window.thousandSeparator = meta.ThousandSeparator; + window.decimalSeparator = meta.DecimalSeparator; + window.currencyDecimalPlaces = meta.CurrencyDecimalPlaces; + window.currencySymbol = meta.CurrencySymbol; + window.datepickerFormat = window.convertNetDateFormat(meta.DatepickerFormat); + window.datepickerShowWeekNumber = meta.DatepickerShowWeekNumber; + window.datepickerWeekStartDay = meta.DatepickerWeekStartDay; + window.datepickerNumberOfMonths = meta.DatepickerNumberOfMonths; +}); + +var lastPage; +var frapidApp = angular.module('FrapidApp', ['ngRoute']); + + +frapidApp.config(function ($routeProvider, $locationProvider, $httpProvider) { + $httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest'; + + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + + + $routeProvider. + when('/dashboard', { + templateUrl: "/dashboard/my/template/Contents/apps.html" + }). + when('/dashboard/:url*', { + templateUrl: function (url) { + var path = '/dashboard/' + url.url; + + + var qs = []; + + for (var q in url) { + if (url.hasOwnProperty(q)) { + if (q === "url") { + continue;; + }; + + if (url.hasOwnProperty(q)) { + qs.push(q + "=" + url[q]); + }; + } + }; + + if (qs.length) { + path = path + "?" + qs.join("&"); + }; + + return path; + } + }); +}); + +frapidApp.run(function ($rootScope, $location) { + $rootScope.$on('$locationChangeStart', function (e, n, o) { + window.overridePath = null; + }); + + $rootScope.$on('$routeChangeStart', function () { + $("#dashboard-container").addClass("loading"); + }); + + $rootScope.$on('$routeChangeSuccess', function () { + $("#dashboard-container").removeClass("loading"); + buildMenus(); + }); + + $rootScope.toogleDashboard = function () { + if (window.location.pathname !== "/dashboard") { + lastPage = window.location.pathname; + $location.path("/dashboard"); + } else { + if (lastPage) { + $location.path(lastPage); + }; + }; + + }; +}); +var menuBuilder = { + build: function (app, container, menuId) { + var myMenus = window.Enumerable.From(window.appMenus) + .Where(function (x) { return x.AppName === app; }) + .Where(function (x) { return x.ParentMenuId === menuId; }) + .OrderBy(function (x) { return x.Sort; }) + .ToArray(); + + var isSubMenu = menuId != null && myMenus.length > 0; + + if (isSubMenu) { + if (container.hasClass("item")) { + container.addClass("ui dropdown"); + container.append(''); + container.append("