Creating EPiServer admin tool plugins using MVC

Creating the tool:
EPiServer – How to create gui plugins using MVC – Dejan Caric
I had to configure the route initialization like this to make it work:

        public void Initialize(InitializationEngine context)
        {
            //ContentLanguagePlugin
            RouteTable.Routes.MapRoute("ContentLanguagePlugin", "admin-tools/content-language-plugin/{action}/{id}",
                new
                {
                    controller = "ContentLanguagePlugin",
                    action = "Index",
                    id = UrlParameter.Optional
                },
                new
                {
                    controller = "ContentLanguagePlugin"
                });

        }

I added EPiServer resources in <head> for EPiServer CSS feeling to it:
(_Layout.cshtml file)

@using EPiServer.Framework.Web.Resources
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title>Content Language Tool</title>

    <!-- Shell -->
    @Html.Raw(ClientResources.RenderResources("ShellCore"))
    @Html.Raw(ClientResources.RenderResources("ShellWidgets"))

    <!-- LightTheme -->
    @Html.Raw(ClientResources.RenderResources("ShellCoreLightTheme"))

    <!-- Navigation -->
    @Html.Raw(ClientResources.RenderResources("Navigation"))

    <!-- Dojo Dashboard -->
    @Html.Raw(ClientResources.RenderResources("DojoDashboardCompatibility", new[] { ClientResourceType.Style }))
    
    <style>
        a {
            color: blue !important;
        }
        a:hover {
            text-decoration: underline !important;
        }
    </style>
</head>

<body>
    <div class="epi-padding epi-contentArea">
        <div>
            @RenderBody()
        </div>

    </div>
</body>
</html>

Some info regarding the EPiServer CSS classes etc:
https://www.epinova.no/en/blog/creating-a-consistent-look-in-episerver-plugins/

 

Leave a Reply

Your email address will not be published. Required fields are marked *