public ActionResult ListPost(ThemeListModel model, FormCollection form) { var themeSettings = Services.Settings.LoadSetting <ThemeSettings>(model.StoreId); var themeSwitched = themeSettings.DefaultTheme.IsCaseInsensitiveEqual(model.DefaultTheme); if (themeSwitched) { Services.EventPublisher.Publish(new ThemeSwitchedEvent { OldTheme = themeSettings.DefaultTheme, NewTheme = model.DefaultTheme }); } var bundlingOnNow = themeSettings.BundleOptimizationEnabled == 2 || (themeSettings.BundleOptimizationEnabled == 0 && !HttpContext.IsDebuggingEnabled); var bundlingOnFuture = model.BundleOptimizationEnabled == 2 || (model.BundleOptimizationEnabled == 0 && !HttpContext.IsDebuggingEnabled); if (bundlingOnNow != bundlingOnFuture) { // Clear asset cache, otherwise we get problems with postprocessing, minification etc. _assetCache.Clear(); } themeSettings = model.ToEntity(themeSettings); Services.Settings.SaveSetting(themeSettings, model.StoreId); Services.EventPublisher.Publish(new ModelBoundEvent(model, themeSettings, form)); NotifySuccess(T("Admin.Configuration.Updated")); return(RedirectToAction("List", new { storeId = model.StoreId })); }
public ActionResult ListPost(ThemeListModel model) { if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageThemes)) { return(AccessDeniedView()); } var themeSettings = _settingService.LoadSetting <ThemeSettings>(model.StoreId); bool themeSwitched = themeSettings.DefaultTheme.IsCaseInsensitiveEqual(model.DefaultTheme); if (themeSwitched) { _services.EventPublisher.Publish <ThemeSwitchedEvent>(new ThemeSwitchedEvent { OldTheme = themeSettings.DefaultTheme, NewTheme = model.DefaultTheme }); } themeSettings = model.ToEntity(themeSettings); _settingService.SaveSetting(themeSettings, model.StoreId); // activity log _services.CustomerActivity.InsertActivity("EditSettings", T("ActivityLog.EditSettings")); NotifySuccess(T("Admin.Configuration.Updated")); return(RedirectToAction("List", new { storeId = model.StoreId })); }
public ActionResult ListPost(ThemeListModel model) { if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageThemes)) { return(AccessDeniedView()); } var themeSettings = _settingService.LoadSetting <ThemeSettings>(model.SiteId); bool showRestartNote = model.MobileDevicesSupported != themeSettings.MobileDevicesSupported; bool mobileThemeSwitched = false; bool themeSwitched = themeSettings.DefaultDesktopTheme.IsCaseInsensitiveEqual(model.DefaultDesktopTheme); if (!themeSwitched) { themeSwitched = themeSettings.DefaultMobileTheme.IsCaseInsensitiveEqual(model.DefaultMobileTheme); mobileThemeSwitched = themeSwitched; } if (themeSwitched) { _services.EventPublisher.Publish <ThemeSwitchedEvent>(new ThemeSwitchedEvent { IsMobile = mobileThemeSwitched, OldTheme = mobileThemeSwitched ? themeSettings.DefaultMobileTheme : themeSettings.DefaultDesktopTheme, NewTheme = mobileThemeSwitched ? model.DefaultMobileTheme : model.DefaultDesktopTheme }); } themeSettings = model.ToEntity(themeSettings); _settingService.SaveSetting(themeSettings, model.SiteId); // activity log _services.UserActivity.InsertActivity("EditSettings", T("ActivityLog.EditSettings")); NotifySuccess(T("Admin.Configuration.Updated")); if (showRestartNote) { NotifyInfo(T("Admin.Common.RestartAppRequest")); } return(RedirectToAction("List", new { siteId = model.SiteId })); }
public ActionResult ListPost(ThemeListModel model, FormCollection form) { if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageThemes)) { return(AccessDeniedView()); } var themeSettings = _settingService.LoadSetting <ThemeSettings>(model.StoreId); bool themeSwitched = themeSettings.DefaultTheme.IsCaseInsensitiveEqual(model.DefaultTheme); if (themeSwitched) { _services.EventPublisher.Publish <ThemeSwitchedEvent>(new ThemeSwitchedEvent { OldTheme = themeSettings.DefaultTheme, NewTheme = model.DefaultTheme }); } var bundlingOnNow = themeSettings.BundleOptimizationEnabled == 2 || (themeSettings.BundleOptimizationEnabled == 0 && !HttpContext.IsDebuggingEnabled); var bundlingOnFuture = model.BundleOptimizationEnabled == 2 || (model.BundleOptimizationEnabled == 0 && !HttpContext.IsDebuggingEnabled); if (bundlingOnNow != bundlingOnFuture) { // Clear asset cache, otherwise we get problems with postprocessing, minification etc. _assetCache.Clear(); } themeSettings = model.ToEntity(themeSettings); _settingService.SaveSetting(themeSettings, model.StoreId); _services.CustomerActivity.InsertActivity("EditSettings", T("ActivityLog.EditSettings")); _services.EventPublisher.Publish(new ModelBoundEvent(model, themeSettings, form)); NotifySuccess(T("Admin.Configuration.Updated")); return(RedirectToAction("List", new { storeId = model.StoreId })); }