Hi ultimatemm:
I am thinking about doing the exact same change. Can you please let me know if you were able to get this to work properly? If yes, can you let me know the files/folders you updated?
Thx!
Thanks!
Can you send me the updated sidebar.cshtml and let me know where to place the extension method/class?
Thanks for providing those examples. They are helping.
I have mirrored the task repository code for one of my custom entities. I have created the Interface and implemented it just like the task example. Now when I setup a test method to validate the code. I keep getting the error below.
<span style="color:#FF0000">Message=Can not instantiate proxy of class: MyCmp.MyProject.EntityFramework.Repositories.ListValuesRepository. Could not find a parameterless constructor.</span>
It fails soon as the test class tries to instantiate the app service.
Here is the Interface code:
using System.Threading.Tasks;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using EXLNT.NursingOps17.NursingOps.Dto;
using System.Collections.Generic;
namespace EXLNT.NursingOps17.NursingOps
{
public interface IListValuesAppService : IApplicationService
{
ListResultDto<ListValuesListDto> GetListValues(string ListName = "");
}
}
Here is the app service code:
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Collections.Extensions;
using EXLNT.NursingOps17.NursingOps.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EXLNT.NursingOps17.NursingOps
{
public class ListValuesAppService : NursingOps17AppServiceBase, IListValuesAppService
{
private readonly IListValuesRepository _listvaluesRepository;
/// <summary>
///In constructor, we can get needed classes/interfaces.
///They are sent here by dependency injection system automatically.
/// </summary>
public ListValuesAppService(IListValuesRepository listvaluesRepository)
{
_listvaluesRepository = listvaluesRepository;
}
public List<ComboboxItemDto> GetListValuesComboboxItems(int? selectedListValue = default(int?))
{
throw new NotImplementedException();
}
public ListResultDto<ListValuesListDto> GetListValues(string ListName = "")
{
var listvalues = _listvaluesRepository.GetAll().WhereIf(
ListName.Length != 0, p => p.ListName == ListName)
.OrderBy(p => p.ListName)
.ThenBy(p => p.ListValue)
.ToList();
return new ListResultDto<ListValuesListDto>(listvalues.MapTo<List<ListValuesListDto>>());
}
}
}
What project in the ABP solution template should I create my custom repositories in?
I cannot see any examples from the ABP solution as they are in the metadata. At least I cannot find the source code for it.
Thx
<cite>ismcagdas: </cite> Hi,
This problem was related to single page side. Can you share your NavigationProvider class and SideBar.cshtml if you made any changes on it (If you are using ASP.NET Core version it's Default.cshtml file under Views/Shared/Components/*SideBar folder).
Thanks.
I am using the Asp.Net MVC MPA solution. I am not using Asp.Net CORE.
Here are the files you requested. I have only modified the navigation provider to add my menu items.
Navigation Provider.cs:
using Abp.Application.Navigation;
using Abp.Localization;
using EXLNT.NursingOps17.Authorization;
using EXLNT.NursingOps17.Web.Navigation;
namespace EXLNT.NursingOps17.Web.Areas.Mpa.Startup
{
public class MpaNavigationProvider : NavigationProvider
{
public const string MenuName = "Mpa";
public override void SetNavigation(INavigationProviderContext context)
{
var menu = context.Manager.Menus[MenuName] = new MenuDefinition(MenuName, new FixedLocalizableString("Main Menu"));
menu
.AddItem(new MenuItemDefinition(
PageNames.App.Host.Tenants,
L("Tenants"),
url: "Mpa/Tenants",
icon: "icon-globe",
requiredPermissionName: AppPermissions.Pages_Tenants
)
).AddItem(new MenuItemDefinition(
PageNames.App.Host.Editions,
L("Editions"),
url: "Mpa/Editions",
icon: "icon-grid",
requiredPermissionName: AppPermissions.Pages_Editions
)
).AddItem(new MenuItemDefinition(
PageNames.App.Tenant.Dashboard,
L("Dashboard"),
url: "Mpa/Dashboard",
icon: "icon-home",
requiredPermissionName: AppPermissions.Pages_Tenant_Dashboard
)
).AddItem(new MenuItemDefinition(
PageNames.App.Common.Administration,
L("Administration"),
icon: "icon-wrench"
).AddItem(new MenuItemDefinition(
PageNames.App.Common.OrganizationUnits,
L("OrganizationUnits"),
url: "Mpa/OrganizationUnits",
icon: "icon-layers",
requiredPermissionName: AppPermissions.Pages_Administration_OrganizationUnits
)
).AddItem(new MenuItemDefinition(
PageNames.App.Common.Roles,
L("Roles"),
url: "Mpa/Roles",
icon: "icon-briefcase",
requiredPermissionName: AppPermissions.Pages_Administration_Roles
)
).AddItem(new MenuItemDefinition(
PageNames.App.Common.Users,
L("Users"),
url: "Mpa/Users",
icon: "icon-users",
requiredPermissionName: AppPermissions.Pages_Administration_Users
)
).AddItem(new MenuItemDefinition(
PageNames.App.Common.Languages,
L("Languages"),
url: "Mpa/Languages",
icon: "icon-flag",
requiredPermissionName: AppPermissions.Pages_Administration_Languages
)
).AddItem(new MenuItemDefinition(
PageNames.App.Common.AuditLogs,
L("AuditLogs"),
url: "Mpa/AuditLogs",
icon: "icon-lock",
requiredPermissionName: AppPermissions.Pages_Administration_AuditLogs
)
).AddItem(new MenuItemDefinition(
PageNames.App.Host.Maintenance,
L("Maintenance"),
url: "Mpa/Maintenance",
icon: "icon-wrench",
requiredPermissionName: AppPermissions.Pages_Administration_Host_Maintenance
)
)
.AddItem(new MenuItemDefinition(
PageNames.App.Host.Settings,
L("Settings"),
url: "Mpa/HostSettings",
icon: "icon-settings",
requiredPermissionName: AppPermissions.Pages_Administration_Host_Settings
)
).AddItem(new MenuItemDefinition(
PageNames.App.Tenant.Settings,
L("Settings"),
url: "Mpa/Settings",
icon: "icon-settings",
requiredPermissionName: AppPermissions.Pages_Administration_Tenant_Settings
)
)
//20161101 - Added menu for our app
).AddItem(new MenuItemDefinition(
PageNames.App.NursingOps.Home,
L("NursingOps"),
icon: "icon-home",
requiredPermissionName: AppPermissions.Pages_Tenant_NursingOps
)
.AddItem(new MenuItemDefinition(
PageNames.App.NursingOps.Administration,
L("Admin"),
icon: "icon-wrench",
requiredPermissionName: AppPermissions.Pages_Tenant_NursingOps_Administration
)
.AddItem(new MenuItemDefinition(
PageNames.App.NursingOps.Company,
L("Company"),
url: "Mpa/Company",
icon: "icon-home",
requiredPermissionName: AppPermissions.Pages_Tenant_NursingOps_Administration_Company
))
.AddItem(new MenuItemDefinition(
PageNames.App.NursingOps.Home,
L("NursingHome"),
url: "Mpa/NursingHome",
icon: "icon-home",
requiredPermissionName: AppPermissions.Pages_Tenant_NursingOps_Administration_NursingHome
))
)//NursingOps-Admin end
);
}
private static ILocalizableString L(string name)
{
return new LocalizableString(name, NursingOps17Consts.LocalizationSourceName);
}
}
}
_Sidebar.cshtml
@using Abp.Collections.Extensions
@using EXLNT.NursingOps17.Web.Views
@model EXLNT.NursingOps17.Web.Areas.Mpa.Models.Layout.SidebarViewModel
@{
var calculateMenuUrl = new Func<string, string>((url) =>
{
if (string.IsNullOrEmpty(url))
{
return ApplicationPath;
}
if (UrlChecker.IsRooted(url))
{
return url;
}
return ApplicationPath + url;
});
}
<div class="page-sidebar navbar-collapse collapse">
<ul class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
@for (var i = 0; i < Model.Menu.Items.Count; i++)
{
var menuItem = Model.Menu.Items[i];
var isActive = Model.CurrentPageName == menuItem.Name ||
(!menuItem.Items.IsNullOrEmpty() && menuItem.Items.Any(item => item.Name == Model.CurrentPageName));
<li class="@(i==0 ? "start" : "") @(isActive ? "active" : "")">
@if (menuItem.Items.IsNullOrEmpty())
{
<a href="@calculateMenuUrl(menuItem.Url)">
<i class="@menuItem.Icon"></i>
<span class="title">@menuItem.DisplayName</span>
</a>
}
else
{
<a href="javascript:;" class="auto">
<i class="@menuItem.Icon"></i>
<span class="title">@menuItem.DisplayName</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
@foreach (var childMenuItem in menuItem.Items)
{
<li class="@(Model.CurrentPageName == childMenuItem.Name ? "active" : "")">
@if (childMenuItem.Items.IsNullOrEmpty())
{
<a href="@calculateMenuUrl(childMenuItem.Url)">
<span><i class="sub-menu-icon @childMenuItem.Icon"></i> @childMenuItem.DisplayName</span>
</a>
}
else
{
<a href="javascript:;" class="auto">
<i class="@childMenuItem.Icon"></i>
<span class="title">@childMenuItem.DisplayName</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
@foreach (var secondLevelChildMenuItem in childMenuItem.Items)
{
<li class="@(Model.CurrentPageName == secondLevelChildMenuItem.Name ? "active" : "")">
<a href="@calculateMenuUrl(secondLevelChildMenuItem.Url)">
<span><i class="sub-menu-icon @secondLevelChildMenuItem.Icon"></i> @secondLevelChildMenuItem.DisplayName</span>
</a>
</li>
}
</ul>
}
</li>
}
</ul>
}
</li>
}
</ul>
</div>
One additional note, this collapse issue is happening only on the custom portion of the menu I have added. The administration menu that was supplied with the solution is working normally and stays expanded on the selected item.
I cannot locate these files in my solution:
[https://github.com/aspnetzero/aspnet-zero/blob/5fef9a8e7b894fd9586eba9f8dc50bbd3e629b2f/src/MyCompanyName.AbpZeroTemplate.Web/App/common/views/layout/sidebar.js]).
[https://github.com/aspnetzero/aspnet-zero/blob/0a79865a2b50055e38a15a0613747da42f5c9ee6/src/MyCompanyName.AbpZeroTemplate.Web/App/common/directives/metronic/directives.js])
Are they located in another location in my version solution? I am using the MVC Multiple page with JQuery version.
My app version v1.13. Which seems to include latest Metronic version. Do I need to apply the fixes you mentioned above?
Also, are there any documents/instructions on how to implement Metronic changes?
<cite>drenton: </cite> Is this level three menu issue fixed?
After I select level 3 menu, it collapsed, so User can't see which menu is currently selected
And I don't know why but this link does not work for me <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/108">https://github.com/aspnetzero/aspnet-zero/issues/108</a>
Thanks.
It appears as if we are facing this exact issue. We have added our apps nav menu as new parent, then below it we have admin, then actual app page. The menu is not staying expanded after the app page is selected? See images below. How do I find out what version of ASPNETZERO I have?
[attachment=1:n9t07gzw]ASPNETZERO_NavMenu_EXLNT.png[/attachment:n9t07gzw]
[attachment=0:n9t07gzw]ASPNETZERO_NavMenu_EXLNT_Collapsed.png[/attachment:n9t07gzw]
Ok, I was able to resolve the second error. There were DLLs created with my laptop name in the name: MyProject.Application-HPEnvyLaptop.dll. These were sitting in the Bin\DEBUG folder. I deleted ALL of these and the error went away.
Question: How is my machine name getting appended, I did not change anything in the properties of the project or solution. Is there a way I can stop this from happening?
Thanks!
I am now running into yet another error. I develop on two separate PCs, a laptop and desktop. I was building on my laptop last night and checked in my work. Then today I am working on my desktop and now when i run the solution, I get clean build but app does not start and the error below is displayed. Its looking for something with my laptops name in it? I cannot get the app to work on either machine right now, desktop or laptop. Please help!
<span style="color:#FF0000">Could not load file or assembly 'MyProject.Application-HPEnvyLaptop' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</span>