Fixed issue #107

This commit is contained in:
Shaun Walker 2019-10-01 15:39:51 -04:00
parent 4de8572a87
commit 0de2250ada
2 changed files with 1 additions and 51 deletions

View File

@ -1,50 +0,0 @@
@namespace YourCompany.Module.HelloWorld
@inherits ModuleBase
@inject ISettingService SettingService
<div class="mx-auto">
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
{
<div class="input-group">
<input type="text" name="Url" class="form-control" placeholder="Enter An Image Url" @bind="@url1" />
<span class="input-group-btn">
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
</span>
</div>
}
<div>
@if (!string.IsNullOrEmpty(url2))
{
<br /><img src="@url2" />
}
</div>
</div>
<br />
@code {
string url1 = ""; // use https://www.oqtane.org/Portals/0/Images/helloworld.png
string url2 = "";
protected override async Task OnInitializedAsync()
{
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
url2 = SettingService.GetSetting(settings, "url", "");
}
private async Task Save()
{
if (!string.IsNullOrEmpty(url1))
{
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
SettingService.SetSetting(settings, "url", url1);
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
ModuleInstance.AddModuleMessage("Url Saved", MessageType.Success);
url2 = url1;
StateHasChanged();
}
else
{
ModuleInstance.AddModuleMessage("You Must Enter A Url", MessageType.Warning);
}
}
}

View File

@ -86,7 +86,6 @@
</td>
<td>
<select class="form-control" @bind="@containertype">
<option value="">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string> container in containers)
{
<option value="@container.Key">@container.Value</option>
@ -145,6 +144,7 @@
}
moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories == "").ToList();
containers = ThemeService.GetContainerTypes(PageState.Themes);
containertype = containers.FirstOrDefault().Key;
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
if (modules.Count > 0)
{