WebAdmin: allow to simplify the user page

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-09-21 19:36:08 +02:00
parent 7349598b19
commit bd294bb3cf
16 changed files with 337 additions and 124 deletions

View File

@@ -162,6 +162,29 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
<div class="card bg-light mb-3">
<div class="card-header">
<b>User page preferences</b>
</div>
<div class="card-body">
<h6 class="card-title mb-4">You can hide some sections from the user page. These are not security settings and are not enforced server side in any way. They are only intended to simplify the user page in the WebAdmin UI.</h6>
<div class="form-group row">
<label for="idUserPageHiddenSections" class="col-sm-2 col-form-label">Hide sections</label>
<div class="col-sm-10">
<select class="form-control selectpicker" id="idUserPageHiddenSections" name="user_page_hidden_sections" multiple>
<option value="1" {{if .Admin.Filters.Preferences.HideGroups}}selected{{end}}>Groups</option>
<option value="2" {{if .Admin.Filters.Preferences.HideFilesystem}}selected{{end}}>Filesystem</option>
<option value="3" {{if .Admin.Filters.Preferences.HideVirtualFolders}}selected{{end}}>Virtual Folders</option>
<option value="4" {{if .Admin.Filters.Preferences.HideProfile}}selected{{end}}>Profile</option>
<option value="5" {{if .Admin.Filters.Preferences.HideACLs}}selected{{end}}>ACLs</option>
<option value="6" {{if .Admin.Filters.Preferences.HideDiskQuotaAndBandwidthLimits}}selected{{end}}>Disk quota and bandwidth limits</option>
<option value="7" {{if .Admin.Filters.Preferences.HideAdvancedSettings}}selected{{end}}>Advanced settings</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="idAllowedIP" class="col-sm-2 col-form-label">Allowed IP/Mask</label>
<div class="col-sm-10">

View File

@@ -14,7 +14,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
{{define "fshtml"}}
<div class="card bg-light mb-3">
<div class="card bg-light mb-3 {{if .IsHidden}}d-none{{end}}">
<div class="card-header">
<b>Filesystem</b>
</div>

View File

@@ -382,7 +382,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</button>
</h2>
</div>
<div id="collapseQuota" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionUser">
<div id="collapseQuota" class="collapse" aria-labelledby="headingQuota" data-parent="#accordionUser">
<div class="card-body">
<div class="form-group row">
@@ -663,7 +663,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</button>
</h2>
</div>
<div id="collapseAdvanced" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionUser">
<div id="collapseAdvanced" class="collapse" aria-labelledby="headingAdvanced" data-parent="#accordionUser">
<div class="card-body">
<div class="form-group row">

View File

@@ -41,6 +41,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<tr>
<th>Name</th>
<th>Description</th>
<th>Members</th>
</tr>
</thead>
<tbody>
@@ -48,6 +49,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<tr>
<td>{{.Name}}</td>
<td>{{.Description}}</td>
<td>{{.GetMembersAsString}}</td>
</tr>
{{end}}
</tbody>
@@ -183,7 +185,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{
"targets": [0],
"className": "noVis"
}
},
{
"targets": [2],
"render": $.fn.dataTable.render.ellipsis(100, true)
},
],
"scrollX": false,
"scrollY": false,

View File

@@ -156,7 +156,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
{{end}}
<div class="card bg-light mb-3">
{{if .Groups}}
<div class="card bg-light mb-3 {{if .LoggedAdmin.Filters.Preferences.HideGroups}}d-none{{end}}">
<div class="card-header">
<b>Groups</b>
</div>
@@ -195,10 +196,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
</div>
{{end}}
{{template "fshtml" .FsWrapper}}
{{if .VirtualFolders}}
<div class="card bg-light mb-3">
<div class="card bg-light mb-3 {{if .LoggedAdmin.Filters.Preferences.HideVirtualFolders}}d-none{{end}}">
<div class="card-header">
<b>Virtual folders</b>
</div>
@@ -285,8 +287,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
{{end}}
<div class="accordion" id="accordionUser">
<div class="card">
<div class="accordion {{if eq .LoggedAdmin.Filters.Preferences.VisibleUserPageSections 0}}d-none{{end}}" id="accordionUser">
<div class="card {{if .LoggedAdmin.Filters.Preferences.HideProfile}}d-none{{end}}">
<div class="card-header" id="headingProfile">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse"
@@ -352,7 +354,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
</div>
<div class="card">
<div class="card {{if .LoggedAdmin.Filters.Preferences.HideACLs}}d-none{{end}}">
<div class="card-header" id="headingPermissions">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse"
@@ -590,7 +592,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
</div>
<div class="card">
<div class="card {{if .LoggedAdmin.Filters.Preferences.HideDiskQuotaAndBandwidthLimits}}d-none{{end}}">
<div class="card-header" id="headingQuota">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse"
@@ -599,7 +601,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</button>
</h2>
</div>
<div id="collapseQuota" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionUser">
<div id="collapseQuota" class="collapse" aria-labelledby="headingQuota" data-parent="#accordionUser">
<div class="card-body">
<div class="form-group row">
@@ -871,7 +873,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
<div class="card">
<div class="card {{if .LoggedAdmin.Filters.Preferences.HideAdvancedSettings}}d-none{{end}}">
<div class="card-header" id="headingAdvanced">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse"
@@ -880,7 +882,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</button>
</h2>
</div>
<div id="collapseAdvanced" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionUser">
<div id="collapseAdvanced" class="collapse" aria-labelledby="headingAdvanced" data-parent="#accordionUser">
<div class="card-body">
<div class="form-group row">
@@ -1044,10 +1046,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<script src="{{.StaticURL}}/vendor/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.fn.selectpicker.Constructor.BootstrapVersion = '4';
{{if .Error}}
{{if ne .LoggedAdmin.Filters.Preferences.VisibleUserPageSections 0}}
$('#accordionUser .collapse').removeAttr("data-parent").collapse('show');
{{end}}
{{end}}
$('#expirationDatePicker').datetimepicker({
format: 'YYYY-MM-DD',
buttons: {