resolve #526 remove pluralization from module creation templates

This commit is contained in:
Shaun Walker
2020-08-14 12:44:37 -04:00
parent aec5882de1
commit 282579fcf2
47 changed files with 346 additions and 358 deletions

View File

@ -1,8 +1,8 @@
@using Oqtane.Modules.Controls
@using [Owner].[Module]s.Services
@using [Owner].[Module]s.Models
@using [Owner].[Module].Services
@using [Owner].[Module].Models
@namespace [Owner].[Module]s
@namespace [Owner].[Module]
@inherits ModuleBase
@inject I[Module]Service [Module]Service
@inject NavigationManager NavigationManager
@ -31,6 +31,8 @@
public override string Actions => "Add,Edit";
public override string Title => "Manage [Module]";
public override List<Resource> Resources => new List<Resource>()
{
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }

View File

@ -1,7 +1,7 @@
@using [Owner].[Module]s.Services
@using [Owner].[Module]s.Models
@using [Owner].[Module].Services
@using [Owner].[Module].Models
@namespace [Owner].[Module]s
@namespace [Owner].[Module]
@inherits ModuleBase
@inject I[Module]Service [Module]Service
@inject NavigationManager NavigationManager
@ -17,16 +17,16 @@ else
<br />
@if (@_[Module]s.Count != 0)
{
<Pager Items="@_[Module]s" Format="Grid">
<Pager Items="@_[Module]s">
<Header>
<div class="col"><strong>[Module]s</strong></div>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>Name</th>
</Header>
<Row>
<div class="col">
<ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" />
<ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" />
@context.Name
</div>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" /></td>
<td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" /></td>
<td>@context.Name</td>
</Row>
</Pager>
}
@ -41,7 +41,7 @@ else
<hr />
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
[RootPath]Client\<br />
- [Owner].[Module]s.Client.csproj - client project<br />
- [Owner].[Module].Client.csproj - client project<br />
- _Imports.razor - global imports for module components<br />
- Edit.razor - component for adding or editing content<br />
- Index.razor - main component for your module **the content you are reading is in this file**<br />
@ -50,22 +50,22 @@ else
- Services\I[Module]Service.cs - interface for defining service API methods<br />
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
[RootPath]Package\<br />
- [Owner].[Module]s.nuspec - nuget manifest for packaging module<br />
- [Owner].[Module]s.Package.csproj - packaging project<br />
- [Owner].[Module].nuspec - nuget manifest for packaging module<br />
- [Owner].[Module].Package.csproj - packaging project<br />
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
[RootPath]Server\<br />
- [Owner].[Module]s.Server.csproj - server project<br />
- [Owner].[Module].Server.csproj - server project<br />
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
- Scripts\[Owner].[Module]s.1.0.0.sql - database schema definition script<br />
- Scripts\[Owner].[Module]s.Uninstall.sql - database uninstall script<br />
- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br />
- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br />
- wwwroot\Module.css - module style sheet<br /><br />
[RootPath]Shared\<br />
- [Owner].[Module]s.csproj - shared project<br />
- [Owner].[Module].csproj - shared project<br />
- Models\[Module].cs - model definition<br /><br />
<!-- The content above is for informational purposes only and can be safely removed -->

View File

@ -1,7 +1,7 @@
using Oqtane.Models;
using Oqtane.Modules;
namespace [Owner].[Module]s
namespace [Owner].[Module]
{
public class ModuleInfo : IModule
{
@ -12,7 +12,7 @@ namespace [Owner].[Module]s
Version = "1.0.0",
ServerManagerType = "[ServerManagerType]",
ReleaseVersions = "1.0.0",
Dependencies = "[Owner].[Module]s.Shared.Oqtane"
Dependencies = "[Owner].[Module].Shared.Oqtane"
};
}
}

View File

@ -1,18 +1,18 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using [Owner].[Module]s.Models;
using [Owner].[Module].Models;
namespace [Owner].[Module]s.Services
namespace [Owner].[Module].Services
{
public interface I[Module]Service
{
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
Task<List<Models.[Module]>> Get[Module]sAsync(int ModuleId);
Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId);
Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId);
Task<[Module]> Add[Module]Async([Module] [Module]);
Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module]);
Task<[Module]> Update[Module]Async([Module] [Module]);
Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module]);
Task Delete[Module]Async(int [Module]Id, int ModuleId);
}

View File

@ -5,9 +5,9 @@ using System.Threading.Tasks;
using Oqtane.Modules;
using Oqtane.Services;
using Oqtane.Shared;
using [Owner].[Module]s.Models;
using [Owner].[Module].Models;
namespace [Owner].[Module]s.Services
namespace [Owner].[Module].Services
{
public class [Module]Service : ServiceBase, I[Module]Service, IService
{
@ -20,42 +20,30 @@ namespace [Owner].[Module]s.Services
private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]");
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
public async Task<List<Models.[Module]>> Get[Module]sAsync(int ModuleId)
{
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>(CreateAuthPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
List<Models.[Module]> [Module]s = await GetJsonAsync<List<Models.[Module]>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
return [Module]s.OrderBy(item => item.Name).ToList();
}
public async Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
public async Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
{
return await GetJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
return await GetJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
}
public async Task<[Module]> Add[Module]Async([Module] [Module])
public async Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module])
{
return await PostJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]);
return await PostJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]);
}
public async Task<[Module]> Update[Module]Async([Module] [Module])
public async Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module])
{
return await PutJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
return await PutJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
}
public async Task Delete[Module]Async(int [Module]Id, int ModuleId)
{
await DeleteAsync(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
}
private string CreateAuthPolicyUrl(string Url, int ModuleId)
{
if (Url.Contains("?"))
{
return Url + "&entityid=" + ModuleId.ToString();
}
else
{
return Url + "?entityid=" + ModuleId.ToString();
}
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
}
}
}

View File

@ -1,4 +1,4 @@
@namespace [Owner].[Module]s
@namespace [Owner].[Module]
@inherits ModuleBase
@inject ISettingService SettingService

View File

@ -7,9 +7,9 @@
<Authors>[Owner]</Authors>
<Company>[Owner]</Company>
<Description>[Description]</Description>
<Product>[Owner].[Module]s</Product>
<Product>[Owner].[Module]</Product>
<Copyright>[Owner]</Copyright>
<AssemblyName>[Owner].[Module]s.Client.Oqtane</AssemblyName>
<AssemblyName>[Owner].[Module].Client.Oqtane</AssemblyName>
</PropertyGroup>
<ItemGroup>
@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
<ProjectReference Include="..\Shared\[Owner].[Module].Shared.csproj" />
</ItemGroup>
<ItemGroup>