Skip to content

Commit

Permalink
what3words 4.80
Browse files Browse the repository at this point in the history
  • Loading branch information
skoshelev committed Jan 13, 2025
1 parent d9bc3d1 commit f242785
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
16 changes: 6 additions & 10 deletions Nop.Plugin.Widgets.What3words/Controllers/What3wordsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ public What3wordsController(ILocalizationService localizationService,

#region Methods

public async Task<IActionResult> Configure()
[CheckPermission(StandardPermission.Configuration.MANAGE_WIDGETS)]
public IActionResult Configure()
{
if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageWidgets))
return AccessDeniedView();

var model = new ConfigurationModel
{
Enabled = _what3WordsSettings.Enabled
Expand All @@ -73,13 +71,11 @@ public async Task<IActionResult> Configure()
}

[HttpPost]
[CheckPermission(StandardPermission.Configuration.MANAGE_WIDGETS)]
public async Task<IActionResult> Configure(ConfigurationModel model)
{
if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageWidgets))
return AccessDeniedView();

if (!ModelState.IsValid)
return await Configure();
return Configure();

//request client API key if doesn't exist
if (string.IsNullOrEmpty(_what3WordsSettings.ApiKey))
Expand All @@ -96,7 +92,7 @@ public async Task<IActionResult> Configure(ConfigurationModel model)
await _logger.ErrorAsync($"what3words error: {exception.Message}.", exception, await _workContext.GetCurrentCustomerAsync());
_notificationService
.ErrorNotification(await _localizationService.GetResourceAsync("Plugins.Widgets.What3words.Configuration.Failed"));
return await Configure();
return Configure();
}
}

Expand All @@ -105,7 +101,7 @@ public async Task<IActionResult> Configure(ConfigurationModel model)

_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Plugins.Saved"));

return await Configure();
return Configure();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Copyright>Copyright © Nop Solutions, Ltd</Copyright>
<Company>Nop Solutions, Ltd</Company>
<Authors>Nop Solutions, Ltd</Authors>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageProjectUrl>https://www.nopcommerce.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/nopSolutions/nopcommerce</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Widgets.What3words</OutputPath>
<OutputPath>$(SolutionDir)\Presentation\Nop.Web\Plugins\Widgets.What3words</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project. You need to set this parameter to true if your plugin has a nuget package to ensure that the dlls copied from the NuGet cache to the output of your project-->
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
Expand Down Expand Up @@ -54,14 +54,14 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Presentation\Nop.Web\Nop.Web.csproj" />
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />
<ProjectReference Include="$(SolutionDir)\Presentation\Nop.Web\Nop.Web.csproj" />
<ClearPluginAssemblies Include="$(SolutionDir)\Build\ClearPluginAssemblies.proj" />
</ItemGroup>

<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(OutDir)" Targets="NopClear" />
</Target>

</Project>
8 changes: 4 additions & 4 deletions Nop.Plugin.Widgets.What3words/Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Important points when developing plugins

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputPath>..\..\Presentation\Nop.Web\Plugins\PLUGIN_OUTPUT_DIRECTORY</OutputPath>
<TargetFramework>net9.0</TargetFramework>
<OutputPath>$(SolutionDir)\Presentation\Nop.Web\Plugins\PLUGIN_OUTPUT_DIRECTORY</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<!--Set this parameter to true to get the dlls copied from the NuGet cache to the output of your project.
You need to set this parameter to true if your plugin has a nuget package
Expand All @@ -18,13 +18,13 @@ Important points when developing plugins
</PropertyGroup>

<ItemGroup>
<ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />
<ClearPluginAssemblies Include="$(SolutionDir)\Build\ClearPluginAssemblies.proj" />
</ItemGroup>

<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(OutDir)" Targets="NopClear" />
</Target>
</Project>

Expand Down
22 changes: 14 additions & 8 deletions Nop.Plugin.Widgets.What3words/Views/AdminOrderAddress.cshtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
@model string

<tr>
<td>
@T("Plugins.Widgets.What3words.Address.Field.Label")
</td>
<td>
@Model
</td>
</tr>
<div class="form-group row">
<div class="col-md-4">
<div class="label-wrapper">
<label class="col-form-label">
@T("Plugins.Widgets.What3words.Address.Field.Label")
</label>
</div>
</div>
<div class="col-md-8">
<div class="form-text-row">
@Model
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions Nop.Plugin.Widgets.What3words/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"Group": "Widgets",
"FriendlyName": "what3words",
"SystemName": "Widgets.What3words",
"Version": "4.70.4",
"SupportedVersions": [ "4.70" ],
"Version": "4.80.3",
"SupportedVersions": [ "4.80" ],
"Author": "nopCommerce team",
"DisplayOrder": 1,
"FileName": "Nop.Plugin.Widgets.What3words.dll",
Expand Down

0 comments on commit f242785

Please sign in to comment.