Improved CSS handling
This commit is contained in:
42
Oqtane.Client/Modules/HelloWorld/Index.razor
Normal file
42
Oqtane.Client/Modules/HelloWorld/Index.razor
Normal file
@ -0,0 +1,42 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Services
|
||||
@namespace Oqtane.Modules.HelloWorld
|
||||
@inherits ModuleBase
|
||||
@inject ISettingService SettingService
|
||||
|
||||
<div class="container">
|
||||
<div>
|
||||
<label for="Url" class="control-label">Image Url: </label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" name="Url" class="form-control" placeholder="Image Url" @bind="@url" />
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
|
||||
<div>
|
||||
@if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
<br />
|
||||
<img src="@url" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
string url = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
url = SettingService.GetSetting(settings, "url", "");
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
SettingService.SetSetting(settings, "url", url);
|
||||
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user