Example #1
0
        public ActionResult SyntaxHighlighterOptions(string Theme, CheckBoxListViewModel selectedBrushes)
        {
            if (!User.IsInRole("SuperAdmin") && !User.IsInRole("Admin"))
            {
                return RedirectToAction("Index", "Home", new { Area = "" });
            }

            var userId = GetUserId();
            var updatedTheme = userId == 1 ? Theme : SettingsRepository.BlogSyntaxTheme;
            SettingsRepository.BlogSyntaxScripts = string.Join("~", selectedBrushes.GetSelectedItems());
            SettingsRepository.BlogSyntaxTheme = updatedTheme;

            var model = new SyntaxHighlighterViewModel
            {
                Brushes = selectedBrushes,
                AvailableThemes = GetAvailableSyntaxThemes(updatedTheme),
                EditThemeAttributes = GetAttributes(userId),
                Title = SettingsRepository.BlogName,
                IsEnabled = SettingsRepository.BlogSyntaxHighlighting,
                UpdateStatus = true,
                CanEnable = GetUserId() == 1
            };

            return View(model);
        }
Example #2
0
        public ActionResult SyntaxHighlighterOptions(string Theme, CheckBoxListViewModel selectedBrushes)
        {
            var userId = GetUserId();
            var updatedTheme = userId == 1 ? Theme : SettingsRepository.BlogSyntaxTheme;
            SettingsRepository.BlogSyntaxScripts = string.Join("~", selectedBrushes.GetSelectedItems());
            SettingsRepository.BlogSyntaxTheme = updatedTheme;

            var model = new SyntaxHighlighterViewModel
                            {
                                Brushes = selectedBrushes,
                                AvailableThemes = GetAvailableSyntaxThemes(updatedTheme),
                                EditThemeAttributes = GetAttributes(userId),
                                Title = SettingsRepository.BlogName,
                                IsEnabled = SettingsRepository.BlogSyntaxHighlighting,
                                UpdateStatus = true,
                                CanEnable = GetUserId() == 1
                            };

            return View(model);
        }