Allow root page paths (rather than specifying a magic "home" string). More UX improvements to FileManager and Pager.
This commit is contained in:
		| @ -74,7 +74,7 @@ | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="row mb-1 align-items-center"> | ||||
|                         <Label Class="col-sm-3" For="path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label> | ||||
|                         <Label Class="col-sm-3" For="path" HelpText="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 '/'." ResourceKey="UrlPath">Url Path: </Label> | ||||
|                         <div class="col-sm-9"> | ||||
|                             <input id="path" class="form-control" @bind="@_path" /> | ||||
|                         </div> | ||||
| @ -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); | ||||
|  | ||||
| @ -81,7 +81,7 @@ | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="row mb-1 align-items-center"> | ||||
|                         <Label Class="col-sm-3" For="path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label> | ||||
|                         <Label Class="col-sm-3" For="path" HelpText="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 '/'." ResourceKey="UrlPath">Url Path: </Label> | ||||
|                         <div class="col-sm-9"> | ||||
|                             <input id="path" class="form-control" @bind="@_path" maxlength="256"/> | ||||
|                         </div> | ||||
| @ -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; | ||||
|  | ||||
| @ -13,58 +13,60 @@ | ||||
|                 <div class="container-fluid px-0"> | ||||
|                     @if (ShowFolders || FolderId <= 0) | ||||
|                     { | ||||
|                         <div class="row"><div class="col"> | ||||
|                             <select class="form-select" value="@FolderId" @onchange="(e => FolderChanged(e))"> | ||||
|                                 @if (string.IsNullOrEmpty(Folder)) | ||||
|                                 { | ||||
|                                     <option value="-1"><@Localizer["Folder.Select"]></option> | ||||
|                                 } | ||||
|                                 @foreach (Folder folder in _folders) | ||||
|                                 { | ||||
|                                     <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option> | ||||
|                                 } | ||||
|                             </select> | ||||
|                         </div></div> | ||||
|                         <div class="row"> | ||||
|                             <div class="col"> | ||||
|                                 <select class="form-select" value="@FolderId" @onchange="(e => FolderChanged(e))"> | ||||
|                                     @if (string.IsNullOrEmpty(Folder)) | ||||
|                                     { | ||||
|                                         <option value="-1"><@Localizer["Folder.Select"]></option> | ||||
|                                     } | ||||
|                                     @foreach (Folder folder in _folders) | ||||
|                                     { | ||||
|                                         <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option> | ||||
|                                     } | ||||
|                                 </select> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     } | ||||
|                     @if (ShowFiles) | ||||
|                     { | ||||
|                         <div class="row"><div class="col mt-1"> | ||||
|                             <select class="form-select" value="@FileId" @onchange="(e => FileChanged(e))"> | ||||
|                                 <option value="-1"><@Localizer["File.Select"]></option> | ||||
|                                 @foreach (File file in _files) | ||||
|                                 { | ||||
|                                     <option value="@(file.FileId)">@(file.Name)</option> | ||||
|                                 } | ||||
|                             </select> | ||||
|                         </div></div> | ||||
|                         <div class="row mt-1"> | ||||
|                             <div class="col"> | ||||
|                                 <select class="form-select" value="@FileId" @onchange="(e => FileChanged(e))"> | ||||
|                                     <option value="-1"><@Localizer["File.Select"]></option> | ||||
|                                     @foreach (File file in _files) | ||||
|                                     { | ||||
|                                         <option value="@(file.FileId)">@(file.Name)</option> | ||||
|                                     } | ||||
|                                 </select> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     } | ||||
|                     @if (ShowUpload && _haseditpermission) | ||||
|                     { | ||||
|                         <div class="row"><div class="col mt-1"> | ||||
|                             @if (UploadMultiple) | ||||
|                             { | ||||
|                                 <input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple /> | ||||
|                             } | ||||
|                             else | ||||
|                             { | ||||
|                                 <input type="file" id="@_fileinputid" name="file" accept="@_filter" /> | ||||
|                             } | ||||
|                             <span class="float-end"> | ||||
|                         <div class="row"> | ||||
|                             <div class="col mt-2"> | ||||
|                                 @if (UploadMultiple) | ||||
|                                 { | ||||
|                                     <input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple /> | ||||
|                                 } | ||||
|                                 else | ||||
|                                 { | ||||
|                                     <input type="file" id="@_fileinputid" name="file" accept="@_filter" /> | ||||
|                                 } | ||||
|                             </div> | ||||
|                             <div class="col mt-2 text-center"> | ||||
|                                 <button type="button" class="btn btn-success" @onclick="UploadFile">@SharedLocalizer["Upload"]</button> | ||||
|                                 @if (ShowFiles && GetFileId() != -1) | ||||
|                                 { | ||||
|                                     <button type="button" class="btn btn-danger" @onclick="DeleteFile">@SharedLocalizer["Delete"]</button> | ||||
|                                     <button type="button" class="btn btn-danger mx-1" @onclick="DeleteFile">@SharedLocalizer["Delete"]</button> | ||||
|                                 } | ||||
|                             </span> | ||||
|                         </div></div> | ||||
|                         <div class="row"><div class="col mt-1"> | ||||
|                             <div class="container-fluid px-0"> | ||||
|                                 <div class="row"> | ||||
|                                     <div class="col-6"><span id="@_progressinfoid"></span></div> | ||||
|                                     <div class="col-6"><progress id="@_progressbarid" class="mt-1" style="visibility: hidden;"></progress></div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div></div> | ||||
|                         </div> | ||||
|                         <div class="row"> | ||||
|                             <div class="col mt-1"><span id="@_progressinfoid" style="display: none;"></span></div> | ||||
|                             <div class="col text-center mt-1"><progress id="@_progressbarid" class="mt-1" style="display: none;"></progress></div> | ||||
|                         </div> | ||||
|                     } | ||||
|                 </div> | ||||
|             </div> | ||||
| @ -77,8 +79,8 @@ | ||||
|         </div> | ||||
|         @if (!string.IsNullOrEmpty(_message)) | ||||
|         { | ||||
|             <div class="row"> | ||||
|                 <div class="col mt-1"> | ||||
|             <div class="row mt-1"> | ||||
|                 <div class="col"> | ||||
|                     <ModuleMessage Message="@_message" Type="@_messagetype" /> | ||||
|                 </div> | ||||
|             </div> | ||||
| @ -151,7 +153,7 @@ | ||||
|         { | ||||
|             ShowImage = false; | ||||
|         } | ||||
|          | ||||
|  | ||||
|         if (!string.IsNullOrEmpty(Folder)) | ||||
|         { | ||||
|             _folders = new List<Folder> { new Folder { FolderId = -1, Name = Folder } }; | ||||
| @ -369,5 +371,7 @@ | ||||
|  | ||||
|     public int GetFileId() => FileId; | ||||
|  | ||||
|     public int GetFolderId() => FolderId; | ||||
|  | ||||
|     public File GetFile() => _file; | ||||
| } | ||||
|  | ||||
| @ -215,7 +215,7 @@ | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Class = "container"; | ||||
|                 Class = "container-fluid px-0"; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker