Skip to content

Theme Management - #807

Merged
poppastring merged 4 commits into
mainfrom
theme-editor
May 4, 2026
Merged

poppastring merged 4 commits into
mainfrom
theme-editor

Conversation

@poppastring

Copy link
Copy Markdown
Owner

PR Classification

New feature: Adds a complete admin UI for theme management in DasBlog.

PR Summary

Introduces a full-featured admin interface for managing, editing, and versioning site themes, with integrated code editing and navigation updates.

  • ThemesController.cs: Implements CRUD operations and file editing with backup/revert for themes.
  • ThemeManager.cs and IThemeManager: Provide theme discovery, file management, and safe editing/versioning logic.
  • Adds new admin view models and Razor views for theme management and file editing with CodeMirror integration.
  • Updates _Layout.cshtml and _AdminNavBar.cshtml to add "Themes" to the admin menu and links from settings.
  • Registers ThemeManager in DI and refactors ThemesListViewModel to use it for theme enumeration.

Introduces a Theme Manager feature with a new ThemesController and Razor views, allowing admins to view, create, edit, and delete site themes. Registers IThemeManager in DI, refactors ThemesListViewModel, and adds navigation links to the new UI. ThemeManager.cs handles theme operations with protections for built-in and active themes. Adds view models and modal dialogs for confirmation. Enhances workflow and security by validating theme names and restricting file operations to safe extensions and paths.
Added CodeMirror to EditFile.cshtml for enhanced editing with syntax highlighting and theme switching based on file type and site mode. Included necessary CodeMirror assets and language modes. Updated navigation label from "Manage Comments" to "Comments" for clarity.
Theme file editor now saves up to 3 previous versions as backups before overwriting. Users can view, restore, and manage backups via the UI. ThemeManager handles backup creation, listing, pruning, and reversion. UI updates include backup badges, revert actions, and confirmation modals. Success/error messages reflect backup and reversion actions.
Introduce ThemeContentValidator for pre-save .cshtml/.css checks, preventing common syntax errors. Integrate validation into ThemesController and display errors in EditFile. Register validator in DI. Improve EditFile UI with dirty indicator, save shortcut, and unsaved changes warning. Remove obsolete admin theme comment from _Layout.cshtml.
@poppastring
poppastring merged commit d58c10f into main May 4, 2026
3 checks passed
@poppastring
poppastring deleted the theme-editor branch May 4, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant