I used the Sample project from here as a starting point.
<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/tree/master/sample">https://github.com/aspnetboilerplate/mo ... ter/sample</a>
If you need to make Authorized requests against your Application Layer Api's then what I do is hit the MVC AccountController Login action first that gives me back a token. The browser (or any other device has to ) will then send along all the token in the header values of each request to any APIs.
You can see any example of the Sample AccountController here: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/master/sample/ModuleZeroSampleProject.Web/Controllers/AccountController.cs">https://github.com/aspnetboilerplate/mo ... troller.cs</a>
To hit your MVC or WebAPI endpoints from other applications (mobile devices, 3rd party websites) you have to setup CORS. What I do is bring in the Asp.net Nuget packages for CORS.
You do not have to required your API endpoints to be authorized. You can do so by removing the AbpAuthorize attribute from either you Application class or MVC controller class.
Here's an example of my Application Layer controller requiring authorization. [AbpAuthorize] public class CampaignsAppService : CaptureApplicationServiceBase, ICampaignsAppService
Here's an example of my Application Layer controller allowing anonymous access.
public class LookupsAppService : CaptureApplicationServiceBase, ILookupsAppService {
I'm not sure if it will help you to an example of my website that is built based off the Abp framework and Zero module. You can see the javascript and usage of both a traditional MVC application and SPA.
<a class="postlink" href="http://www.capturedog.com">http://www.capturedog.com</a>
Hope this helps.
Chris
I ended up putting this in my constructor protected CaptureWebViewPageBase(){
if (LocalizationManager == null)
{
LocalizationManager = IocManager.Instance.Resolve<ILocalizationManager>();
}
Languages = LocalizationManager.GetAllLanguages();
CurrentLanguage = LocalizationManager.CurrentLanguage;
}
Still not sure if this is the best approach, but it works for now :-)
How are you attempting to use the modal? Are you using an AngularJS based clientside framework?
Please post some sample code or a shared link on a service like <a class="postlink" href="http://plnkr.co/">http://plnkr.co/</a> and I'm sure someone will assist you.
I have navigation menus for my public facing website (typical stuff like Home, Contact Us, About, Login) and then once the user logs into the internal application I have menus like (Dashboard, Profile, Campaigns, etc.).
Here's how I've built the different menus in my NavigationProvider.
//This is the "MainMenu".
context.Manager.MainMenu
.AddItem(
new MenuItemDefinition(
"Home",
new LocalizableString("HomePage", CaptureConsts.LocalizationSourceName),
url: "/",
icon: "fa fa-home"
)
)
.AddItem(
new MenuItemDefinition(
"About",
new LocalizableString("About", CaptureConsts.LocalizationSourceName),
url: "/Home/About",
icon: "fa fa-cog"
)
)
.AddItem(
new MenuItemDefinition(
"Contact",
new LocalizableString("Contact", CaptureConsts.LocalizationSourceName),
url: "/Home/Contact",
icon: "fa fa-info"
)
.AddItem(
new MenuItemDefinition(
"Login",
new LocalizableString("Login", CaptureConsts.LocalizationSourceName), url: "/Account/Login",
icon: "fa fa-info"
))
);
//This is the "Dashboard" menu.
var dashboardMenuDefinition = new MenuDefinition("Dashboard", new LocalizableString("Dashboard", CaptureConsts.LocalizationSourceName));
var dashboardMenuItemDefinition = new MenuItemDefinition(
"Dashboard",
new LocalizableString("Dashboard", CaptureConsts.LocalizationSourceName), url: "/app/dashboard",
icon: "icon-home");
var campaigns = new MenuItemDefinition(
"Campaigns",
new LocalizableString("Campaigns", CaptureConsts.LocalizationSourceName), url: "javascript:;",
icon: "icon-settings")
.AddItem(
new MenuItemDefinition(
"AllCampaigns",
new LocalizableString("AllCampaigns", CaptureConsts.LocalizationSourceName),
url: "/app/campaigns", icon: "icon-puzzle"
))
.AddItem(
new MenuItemDefinition(
"CreateCampaign",
new LocalizableString("CreateCampaign", CaptureConsts.LocalizationSourceName),
url: "/app/campaigns/0/edit", icon: "fa fa-file-o"
));
//.AddItem(
// new MenuItemDefinition(
// "CreateCampaign",
// new LocalizableString("CreateCampaign", CaptureConsts.LocalizationSourceName),
// url: "/app/campaigns/createedit", icon: "fa fa-file-o"
// ));
//url: "/app/campaign/:campaignId/edit",
var userProfile = new MenuItemDefinition(
"UserProfile",
new LocalizableString("UserProfile", CaptureConsts.LocalizationSourceName), url: "/app/userprofile/account",
icon: "icon-user");
dashboardMenuDefinition.AddItem(dashboardMenuItemDefinition);
dashboardMenuDefinition.AddItem(campaigns);
dashboardMenuDefinition.AddItem(userProfile);
context.Manager.Menus.Add("Dashboard", dashboardMenuDefinition);
The javascript object structure looks like the following, which you will see in the AbpScripts/GetScripts api call.
(function() {
abp.nav = {};
abp.nav.menus = {
'MainMenu': {
name: 'MainMenu',
displayName: 'Main menu',
items: [{
name: 'Home',
icon: 'fa fa-home',
url: '/',
displayName: 'Home page',
items: []
} , {
name: 'About',
icon: 'fa fa-cog',
url: '/Home/About',
displayName: 'About',
items: []
} , {
name: 'Contact',
icon: 'fa fa-info',
url: '/Home/Contact',
displayName: 'Contact',
items: [{
name: 'Login',
icon: 'fa fa-info',
url: '/Account/Login',
displayName: 'Login',
items: []
}]
}]
}
, 'Dashboard': {
name: 'Dashboard',
displayName: 'Dashboard',
items: [{
name: 'Dashboard',
icon: 'icon-home',
url: '/app/dashboard',
displayName: 'Dashboard',
items: []
} , {
name: 'Campaigns',
icon: 'icon-settings',
url: 'javascript:;',
displayName: 'Campaigns',
items: [{
name: 'AllCampaigns',
icon: 'icon-puzzle',
url: '/app/campaigns',
displayName: 'All Campaigns',
items: []
} , {
name: 'CreateCampaign',
icon: 'fa fa-file-o',
url: '/app/campaigns/0/edit',
displayName: 'Create Campaign',
items: []
}]
} , {
name: 'UserProfile',
icon: 'icon-user',
url: '/app/userprofile/account',
displayName: 'User Profile',
items: []
}]
}
};
})();