Merge pull request #78 from oqtane/dev

sync with upstream
This commit is contained in:
Shaun Walker 2021-01-05 17:12:40 -05:00 committed by GitHub
commit b8fb230a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 10 deletions

View File

@ -60,7 +60,7 @@
</tr>
<tr>
<td>
<Label For="url" HelpText="The reference url of the module" resource="ReferenceUrl">Reference Url: </Label>
<Label For="url" HelpText="The reference url of the module" ResourceKey="ReferenceUrl">Reference Url: </Label>
</td>
<td>
<input id="url" class="form-control" @bind="@_url" disabled />

View File

@ -1,4 +1,5 @@
@namespace Oqtane.Modules.Admin.Modules
@using Oqtane.Interfaces
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IThemeService ThemeService
@ -137,7 +138,7 @@
builder.AddComponentReferenceCapture(1, inst => { _settings = Convert.ChangeType(inst, _settingsModuleType); });
builder.CloseComponent();
};
}
}
}
private async Task SaveModule()
@ -162,15 +163,16 @@
module.Permissions = _permissionGrid.GetPermissions();
await ModuleService.UpdateModuleAsync(module);
if (_settingsModuleType != null)
if (_settings is ISettingsControl control)
{
var moduleType = Type.GetType(ModuleState.ModuleType);
if (moduleType != null)
{
moduleType.GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
}
await control.UpdateSettings();
}
else
{
// Compatibility 2.0 fallback
_settings?.GetType().GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
}
NavigationManager.NavigateTo(NavigateUrl());
}

View File

@ -89,7 +89,10 @@ else
Role role = await RoleService.GetRoleAsync(roleid);
name = role.Name;
users = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
users = users.Where(item => item.Role.Name == RoleNames.Registered).ToList();
users = users
.Where(u => u.Role.Name == RoleNames.Registered)
.OrderBy(u => u.User.DisplayName)
.ToList();
await GetUserRoles();
}
catch (Exception ex)

View File

@ -0,0 +1,9 @@
using System.Threading.Tasks;
namespace Oqtane.Interfaces
{
public interface ISettingsControl
{
Task UpdateSettings();
}
}