Browse Source

Merge pull request #6575 from abpframework/cotur/page-toolbar

Page toolbar extensions applied for the modules
pull/6584/head
Halil İbrahim Kalkan 6 years ago
committed by GitHub
parent
commit
bc83da78f2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  2. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml
  3. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml
  4. 24
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs
  5. 10
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml

30
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs

@ -2,9 +2,11 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.PageToolbars;
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity.Localization;
using Volo.Abp.Identity.Web.Navigation;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity;
@ -64,6 +66,34 @@ namespace Volo.Abp.Identity.Web
options.Conventions.AuthorizePage("/Identity/Roles/CreateModal", IdentityPermissions.Roles.Create);
options.Conventions.AuthorizePage("/Identity/Roles/EditModal", IdentityPermissions.Roles.Update);
});
Configure<AbpPageToolbarOptions>(options =>
{
options.Configure<Volo.Abp.Identity.Web.Pages.Identity.Users.IndexModel>(
toolbar =>
{
toolbar.AddButton(
LocalizableString.Create<IdentityResource>("NewUser"),
icon: "plus",
name: "CreateUser",
requiredPolicyName: IdentityPermissions.Users.Create
);
}
);
options.Configure<Volo.Abp.Identity.Web.Pages.Identity.Roles.IndexModel>(
toolbar =>
{
toolbar.AddButton(
LocalizableString.Create<IdentityResource>("NewRole"),
icon: "plus",
name: "CreateRole",
requiredPolicyName: IdentityPermissions.Roles.Create
);
}
);
});
}
public override void PostConfigureServices(ServiceConfigurationContext context)

6
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml

@ -2,6 +2,7 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar
@using Volo.Abp.Identity
@using Volo.Abp.Identity.Localization
@using Volo.Abp.Identity.Web.Navigation
@ -33,10 +34,7 @@
<abp-card-title>@L["Roles"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-right">
@if (await Authorization.IsGrantedAsync(IdentityPermissions.Roles.Create))
{
<abp-button button-type="Primary" name="CreateRole" text="@L["NewRole"].Value" icon="plus" />
}
@await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName })
</abp-column>
</abp-row>
</abp-card-header>

6
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml

@ -2,6 +2,7 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar
@using Volo.Abp.Identity
@using Volo.Abp.Identity.Localization
@using Volo.Abp.Identity.Web.Navigation
@ -34,10 +35,7 @@
<abp-card-title>@L["Users"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-right">
@if (await Authorization.IsGrantedAsync(IdentityPermissions.Users.Create))
{
<abp-button button-type="Primary" name="CreateUser" text="@L["NewUser"].Value" icon="plus" />
}
@await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName })
</abp-column>
</abp-row>
</abp-card-header>

24
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs

@ -2,8 +2,10 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.PageToolbars;
using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity;
@ -61,6 +63,28 @@ namespace Volo.Abp.TenantManagement.Web
options.Conventions.AuthorizePage("/TenantManagement/Tenants/EditModal", TenantManagementPermissions.Tenants.Update);
options.Conventions.AuthorizePage("/TenantManagement/Tenants/ConnectionStrings", TenantManagementPermissions.Tenants.ManageConnectionStrings);
});
Configure<AbpPageToolbarOptions>(options =>
{
options.Configure<Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants.IndexModel>(
toolbar =>
{
toolbar.AddButton(
LocalizableString.Create<AbpTenantManagementResource>("ManageHostFeatures"),
icon: "cog",
name: "ManageHostFeatures",
requiredPolicyName: FeatureManagementPermissions.ManageHostFeatures
);
toolbar.AddButton(
LocalizableString.Create<AbpTenantManagementResource>("NewTenant"),
icon: "plus",
name: "CreateTenant",
requiredPolicyName: TenantManagementPermissions.Tenants.Create
);
}
);
});
}
public override void PostConfigureServices(ServiceConfigurationContext context)

10
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml

@ -2,6 +2,7 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar
@using Volo.Abp.FeatureManagement
@using Volo.Abp.TenantManagement
@using Volo.Abp.TenantManagement.Localization
@ -30,14 +31,7 @@
<abp-card-title>@L["Tenants"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-right">
@if (await Authorization.IsGrantedAsync(FeatureManagementPermissions.ManageHostFeatures))
{
<abp-button button-type="Primary" name="ManageHostFeatures" icon="cog" text="@L["ManageHostFeatures"].Value" />
}
@if (await Authorization.IsGrantedAsync(TenantManagementPermissions.Tenants.Create))
{
<abp-button button-type="Primary" name="CreateTenant" icon="plus" text="@L["NewTenant"].Value"/>
}
@await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(IndexModel).FullName })
</abp-column>
</abp-row>
</abp-card-header>

Loading…
Cancel
Save