Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change BackOfficePreviewService to use the Razor Engine to find the View #14

Closed
37Stars opened this issue Mar 24, 2023 · 3 comments
Closed
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@37Stars
Copy link

37Stars commented Mar 24, 2023

Instead of hardcoding the path for views to "/Views/Partials/blockgrid/Components/{contentAlias}.cshtml" or "/Views/Partials/blocklist/Components/{contentAlias}.cshtml", use the Razor Engine to find the view.

Changing line 120 in BackOfficePreviewService.cs:

string partialPath = _razorViewEngine.FindView(controllerContext, contentAlias, false).ViewName;

** I was going to create a pull request, but I was prompted to merge into a branch first and I wasn't sure how you wanted to work with pull requests.

@rickbutterfield rickbutterfield added enhancement New feature or request good first issue Good for newcomers labels Mar 24, 2023
@rickbutterfield
Copy link
Owner

This is a great idea! Feel free to fork and and send a PR, I'm happy either with a temp/ or feature/ branch 😃

@rickbutterfield rickbutterfield added this to the 1.2.0 milestone Mar 24, 2023
@37Stars
Copy link
Author

37Stars commented Mar 27, 2023

I have made the code updates, but it requires 1) adding search paths to the Razor View Engine if you want to move the views outside of the \blockgrid\Component folder and 2) modifying the items.cshtml file in the \blockgrid folder. Would you like that information in the readme markdown file?

@rickbutterfield
Copy link
Owner

@37Stars yes please! I'll review one you've opened a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants