Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public ActionResult SyntaxHighlighterOptions()
        {
            if (!User.IsInRole("SuperAdmin") && !User.IsInRole("Admin"))
            {
                return RedirectToAction("Index", "Admin", new { Area = "Admin" });
            }

            var currentTheme = SettingsRepository.BlogSyntaxTheme;
            var selectedItems = SettingsRepository.BlogSyntaxScripts;
            var model = new SyntaxHighlighterViewModel
            {
                Brushes = GetBrushesModel(selectedItems),
                AvailableThemes = GetAvailableSyntaxThemes(currentTheme),
                EditThemeAttributes = GetAttributes(GetUserId()),
                Title = SettingsRepository.BlogName,
                IsEnabled = SettingsRepository.BlogSyntaxHighlighting,
                CanEnable = GetUserId() == 1
            };

            return View(model);
        }
Пример #4
0
        public ActionResult SyntaxHighlighterOptions()
        {
            var currentTheme = SettingsRepository.BlogSyntaxTheme;
            var selectedItems = SettingsRepository.BlogSyntaxScripts;
            var model = new SyntaxHighlighterViewModel
                            {
                                Brushes = GetBrushesModel(selectedItems),
                                AvailableThemes = GetAvailableSyntaxThemes(currentTheme),
                                EditThemeAttributes = GetAttributes(GetUserId()),
                                Title = SettingsRepository.BlogName,
                                IsEnabled = SettingsRepository.BlogSyntaxHighlighting,
                                CanEnable = GetUserId() == 1
                            };

            return View(model);
        }