diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor index 583b62f2..36d45b47 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Add.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor @@ -74,7 +74,7 @@
- +
@@ -293,11 +293,11 @@ page.SiteId = PageState.Page.SiteId; page.Name = _name; page.Title = _title; + if (string.IsNullOrEmpty(_path)) { _path = _name; } - if (_path.Contains("/")) { _path = _path.Substring(_path.LastIndexOf("/") + 1); diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor index 00e02fab..d3cbfbac 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor @@ -81,7 +81,7 @@
- +
@@ -225,9 +225,16 @@ _title = page.Title; _path = page.Path; - if (_path.Contains("/")) + if (string.IsNullOrEmpty(_path)) { - _path = _path.Substring(_path.LastIndexOf("/") + 1); + _path = "/"; + } + else + { + if (_path.Contains("/")) + { + _path = _path.Substring(_path.LastIndexOf("/") + 1); + } } if (page.ParentId == null) @@ -370,7 +377,8 @@ page.Name = _name; page.Title = _title; - if (string.IsNullOrEmpty(_path) && _name.ToLower() != "home") + + if (string.IsNullOrEmpty(_path)) { _path = _name; } @@ -378,6 +386,7 @@ { _path = _path.Substring(_path.LastIndexOf("/") + 1); } + if (_parentid == "-1") { page.ParentId = null; diff --git a/Oqtane.Client/Modules/Controls/FileManager.razor b/Oqtane.Client/Modules/Controls/FileManager.razor index 5eb01d6c..6164dad3 100644 --- a/Oqtane.Client/Modules/Controls/FileManager.razor +++ b/Oqtane.Client/Modules/Controls/FileManager.razor @@ -13,58 +13,60 @@
@if (ShowFolders || FolderId <= 0) { -
- -
+
+
+ +
+
} @if (ShowFiles) { -
- -
+
+
+ +
+
} @if (ShowUpload && _haseditpermission) { -
- @if (UploadMultiple) - { - - } - else - { - - } - +
+
+ @if (UploadMultiple) + { + + } + else + { + + } +
+
@if (ShowFiles && GetFileId() != -1) { - + } - -
-
-
-
-
-
-
-
+
+
+
+
+
}
@@ -77,8 +79,8 @@
@if (!string.IsNullOrEmpty(_message)) { -
-
+
+
@@ -151,7 +153,7 @@ { ShowImage = false; } - + if (!string.IsNullOrEmpty(Folder)) { _folders = new List { new Folder { FolderId = -1, Name = Folder } }; @@ -369,5 +371,7 @@ public int GetFileId() => FileId; + public int GetFolderId() => FolderId; + public File GetFile() => _file; } diff --git a/Oqtane.Client/Modules/Controls/Pager.razor b/Oqtane.Client/Modules/Controls/Pager.razor index 9a8b6c61..fec95246 100644 --- a/Oqtane.Client/Modules/Controls/Pager.razor +++ b/Oqtane.Client/Modules/Controls/Pager.razor @@ -215,7 +215,7 @@ } else { - Class = "container"; + Class = "container-fluid px-0"; } } diff --git a/Oqtane.Client/Resources/Modules/Admin/Pages/Add.resx b/Oqtane.Client/Resources/Modules/Admin/Pages/Add.resx index 5f2f31e5..b29a4f1e 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Pages/Add.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Pages/Add.resx @@ -181,7 +181,7 @@ Select whether the page is part of the site navigation or hidden - Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used. + Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used. If the page is intended to be the root path specify '/'. Optionally enter a url which this page should redirect to when a user navigates to it diff --git a/Oqtane.Client/Resources/Modules/Admin/Pages/Edit.resx b/Oqtane.Client/Resources/Modules/Admin/Pages/Edit.resx index ab2903cd..55987b3c 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Pages/Edit.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Pages/Edit.resx @@ -169,7 +169,7 @@ Select whether the page is part of the site navigation or hidden - Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used. + Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used. If the page is intended to be the root path specify '/'. Optionally enter a url which this page should redirect to when a user navigates to it diff --git a/Oqtane.Client/Services/FileService.cs b/Oqtane.Client/Services/FileService.cs index 17d93b02..84932e19 100644 --- a/Oqtane.Client/Services/FileService.cs +++ b/Oqtane.Client/Services/FileService.cs @@ -109,6 +109,9 @@ namespace Oqtane.Services attempts += 1; } + await interop.SetElementAttribute(id + "ProgressInfo", "style", "display: none;"); + await interop.SetElementAttribute(id + "ProgressBar", "style", "display: none;"); + if (!success) { result = result.Substring(0, result.Length - 1); diff --git a/Oqtane.Client/UI/Interop.cs b/Oqtane.Client/UI/Interop.cs index b54fde6f..2aa9fb9f 100644 --- a/Oqtane.Client/UI/Interop.cs +++ b/Oqtane.Client/UI/Interop.cs @@ -247,5 +247,20 @@ namespace Oqtane.UI return new ValueTask(Task.FromResult(false)); } } + + public Task SetElementAttribute(string id, string attribute, string value) + { + try + { + _jsRuntime.InvokeVoidAsync( + "Oqtane.Interop.setElementAttribute", + id, attribute, value); + return Task.CompletedTask; + } + catch + { + return Task.CompletedTask; + } + } } } diff --git a/Oqtane.Server/wwwroot/js/interop.js b/Oqtane.Server/wwwroot/js/interop.js index 73d2398b..0db5c13e 100644 --- a/Oqtane.Server/wwwroot/js/interop.js +++ b/Oqtane.Server/wwwroot/js/interop.js @@ -298,10 +298,14 @@ Oqtane.Interop = { return files; }, uploadFiles: function (posturl, folder, id) { - var files = document.getElementById(id + 'FileInput').files; + var fileinput = document.getElementById(id + 'FileInput'); + var files = fileinput.files; var progressinfo = document.getElementById(id + 'ProgressInfo'); var progressbar = document.getElementById(id + 'ProgressBar'); + progressinfo.setAttribute("style", "display: inline;"); + progressbar.setAttribute("style", "width: 200px; display: inline;"); + for (var i = 0; i < files.length; i++) { var FileChunk = []; var file = files[i]; @@ -311,8 +315,6 @@ Oqtane.Interop = { var EndPos = BufferChunkSize; var Size = file.size; - progressbar.setAttribute("style", "width:100%; visibility: visible;"); - while (FileStreamPos < Size) { FileChunk.push(file.slice(FileStreamPos, EndPos)); FileStreamPos = EndPos; @@ -332,21 +334,22 @@ Oqtane.Interop = { var request = new XMLHttpRequest(); request.open('POST', posturl, true); request.upload.onloadstart = function (e) { - progressbar.value = 0; progressinfo.innerHTML = file.name + ' 0%'; + progressbar.value = 0; }; request.upload.onprogress = function (e) { var percent = Math.ceil((e.loaded / e.total) * 100); - progressbar.value = (percent / 100); progressinfo.innerHTML = file.name + '[' + PartCount + '] ' + percent + '%'; + progressbar.value = (percent / 100); }; request.upload.onloadend = function (e) { - progressbar.value = 1; progressinfo.innerHTML = file.name + ' 100%'; + progressbar.value = 1; }; request.send(data); } } + fileinput.value = ''; }, refreshBrowser: function (reload, wait) { setInterval(function () { @@ -360,5 +363,11 @@ Oqtane.Interop = { }, formValid: function (formRef) { return formRef.checkValidity(); + }, + setElementAttribute: function (id, attribute, value) { + var element = document.getElementById(id); + if (element !== null) { + element.setAttribute(attribute, value); + } } };