コード例 #1
0
ファイル: AdminController.cs プロジェクト: kamilkk/sblog.net
        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
ファイル: AdminController.cs プロジェクト: LByron/BS
        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
ファイル: AdminController.cs プロジェクト: kamilkk/sblog.net
        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
ファイル: AdminController.cs プロジェクト: LByron/BS
        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);
        }