Improved CSS handling

This commit is contained in:
Shaun Walker
2019-09-21 22:15:44 -04:00
parent 054495056d
commit 5f62957752
15 changed files with 142 additions and 39 deletions

View File

@ -175,6 +175,9 @@
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
themetype = PageState.Site.DefaultThemeType;
layouttype = PageState.Site.DefaultLayoutType;
List<PermissionString> permissionstrings = new List<PermissionString>();
permissionstrings.Add(new PermissionString { PermissionName = "View", Permissions = Constants.AdminRole });
permissionstrings.Add(new PermissionString { PermissionName = "Edit", Permissions = Constants.AdminRole });

View File

@ -11,7 +11,7 @@
{
<ActionLink Action="Add" Text="Add Page" Style="float: right; margin: 10px;" />
<Pager Items="@PageState.Pages" DisplayPages="3" PageSize="3">
<Pager Items="@PageState.Pages">
<Header>
<th>Name</th>
<th>&nbsp;</th>

View File

@ -70,7 +70,7 @@
{
if (string.IsNullOrEmpty(PageSize))
{
MaxItems = 5;
MaxItems = 10;
}
else
{

View File

@ -102,6 +102,10 @@
{
permissionnames = "View,Edit";
}
else
{
permissionnames = PermissionNames;
}
roles = await RoleService.GetRolesAsync(ModuleState.SiteId);
roles.Insert(0, new Role { Name = Constants.AllUsersRole });

View 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();
}
}

View File

@ -1,11 +1,16 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Oqtane.Shared;
using Oqtane.Models;
using System.Threading.Tasks;
namespace Oqtane.Modules
{
public class ModuleBase : ComponentBase, IModuleControl
{
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[CascadingParameter]
protected PageState PageState { get; set; }
@ -25,6 +30,16 @@ namespace Oqtane.Modules
return "Modules/" + this.GetType().Namespace + "/";
}
public async Task AddCSS(string Url)
{
if (!Url.StartsWith("http"))
{
Url = ModulePath() + Url;
}
var interop = new Interop(JSRuntime);
await interop.AddCSS("Module:" + Utilities.CreateIdFromUrl(Url), Url);
}
public string NavigateUrl()
{
return NavigateUrl(PageState.Page.Path);