I'm using ABP framework in a MVC and SPA application. The front-end application is MVC to benefit from SEO.
My application supports multiple languages (thanks to Abp awesome framework).
What I need to do is build a dynamic header menu for different language supported on the _Layout.cshtml base razor layout page.
In my _Layout.cshtml, I split my top menu into a Partial.
@Html.Partial("_TopBar")
Every page uses the _Layout.cshtml for their base template (Index.cshtml, Contact.cshtml, etc.).
Below is my _TopBar.cshtml partial page.
Question:
In my base MVC page public abstract class CaptureWebViewPageBase<TModel> : AbpWebViewPage<TModel>
I'm trying to use Property injection to get an public ILocalizationManager LocalizationManager { get; set; } but this object is not being set.
If I use constructor injection, then I get compile errors telling me "CaptureWebViewPageBase<TModel> doesn't contain parameterless constructor."
How can I inject the a ILocalizationManager into this page or am I doing this totally the wrong way?
Thanks so much for the guidance.
<div class="pre-header">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6 additional-shop-info">
<ul class="list-unstyled list-inline">
<li>
<i class="fa fa-envelope-o"></i>
<span>
<a href="mailto:[email protected]">[email protected]</a>
</span>
</li>
</ul>
</div>
<div class="col-md-6 col-sm-6 additional-nav">
<ul class="list-unstyled list-inline pull-right">
@using Microsoft.AspNet.Identity
@if (Request.IsAuthenticated)
{
<li>@Html.ActionLink(L("MyAccount"), "Dashboard", "App")</li>
<li>@Html.ActionLink(L("Logout"), "Logout", "Account", routeValues: null, htmlAttributes: new { id = "logoutForm", target = "_self" })</li>
}
else
{
<li class="dropdown dropdown-language">
<a class="dropdown-toggle" dropdown-menu-hover data-toggle="dropdown" data-close-others="true">
<i></i>
<span class="langname">@L(@CurrentLanguage) </span>
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu dropdown-menu-default">
@foreach (var language in Languages)
{
<li class="active">
<a href="/AbpLocalization/[email protected]">
<i class="@language.Icon"></i> @L(language.DisplayName)
</a>
</li>
}
</ul>
</li>
<li>
@Html.ActionLink(@L("Login"), "Login", "Account")
</li>
}
</ul>
</div>
</div>
</div>
</div>
My application service call will read .css and .js files from disk, perform some customizations to the content, then generate and minified output file.
When using MVC or WebAPI, I usually just use the HttpContext to figure out my paths such as:
var pathToCssWidget = HttpContext.Server.MapPath("~/Content/");
How would I go about getting access to the HttpContext from a class derived from the ApplicationService?
Thanks,
Chris