Admin area styling for plugin page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 лет назад
Hi,
I have created a simple plugin to manage some reference/static data items under the Admin -> Configuration -> Shipping menu. When I select the menu item it correctly executes my controller method and displays the required page. However, the page has no styling. What is the thing I'm missing so that my plugin page is displayed with the same styling as all the other pages under the Admin area?
It's probably something really simple but I just can't see it.
Many thanks in advance.
Steve
6 лет назад
Could you please post your plugin cshtml page here?
6 лет назад
It doesn't actually matter what the content is.
This is what I need:
https://preview.ibb.co/iGy2xG/What_I_Need.jpg

and this is what I currently get:
https://preview.ibb.co/na2UcG/What_I_Get.jpg
6 лет назад
randsys wrote:
It doesn't actually matter what the content is.
This is what I need and this is what I currently get:

<a href="https://ibb.co/bvbY4w"><img src="https://preview.ibb.co/na2UcG/What_I_Get.jpg" alt="What_I_Get" border="0"></a>
<a href="https://ibb.co/gTwY4w"><img src="https://preview.ibb.co/iGy2xG/What_I_Need.jpg" alt="What_I_Need" border="0"></a><br /><a target='_blank' href='https://imgbb.com/'>upload my pic</a><br />


I don't ask your content.
BTW, in your cshtml file for plugin's settings view, did you have following code

@{
    Layout = "~/Administration/Views/Shared/_AdminLayout.cshtml";
}
6 лет назад
Hi,
Yes, I've tried all sorts of values for the layout.
When I use:

@{
    Layout = "~/Admin/Views/Shared/_AdminLayout.cshtml";
}

I get:

System.InvalidOperationException: 'The layout view '~/Admin/Views/Shared/_AdminLayout.cshtml' could not be located. The following locations were searched:
~/Admin/Views/Shared/_AdminLayout.cshtml'

I've tried an implementation of IViewLocationExpander too, but nothing I seem to do resolves this issue, so I'm assuming I'm just making some simple silly mistake somewhere :-(
6 лет назад
PS: Forgot to add, this is for NopCommerce V4.0
6 лет назад
randsys wrote:
PS: Forgot to add, this is for NopCommerce V4.0


try that

@{
    Layout = "_ConfigurePlugin";
}
6 лет назад
Still no luck.
It keeps complaining it can't find the file - even when I copy it locally - very strange.
I wonder if when calling from a menu item (Admin -> Configuration -> Shipping) it's looking in a different place?
6 лет назад
randsys wrote:
Still no luck.
It keeps complaining it can't find the file - even when I copy it locally - very strange.
I wonder if when calling from a menu item (Admin -> Configuration -> Shipping) it's looking in a different place?


Also make sure you have decorated your controller/method with:


[Area(AreaNames.Admin)]
[AuthorizeAdmin]
6 лет назад
Thank you so much mgustafsson!
You nailed it!
I knew it must have been something simple, but I'd spent so long looking in the wrong place I'd missed checking the controller side.
Many thanks again.
Cheers
Steve
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.