Mercurial > gemma
view client/src/components/ui/UITableHeader.vue @ 5348:45b03e8ca47e extented-report
Toggles in user overview and in details section as well established
This commit introduces toggles to change the state for administrative
users to be able to receive the DQL Report.
For quick access there is the possibility to change via overview.
If you want to edit this in the details or if you change the role
of the user to a non administrative, there is the possibility to change
the flag in a fast way.
When the user looses administrative privilege the option is not available
and the according flag is set to "false".
Aside: Changed user.go to resolve inconsitencies in frontend where the
key "reports" was missing due to "omitempty" in marshalling the go objects.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 21 Jun 2021 16:41:39 +0200 |
parents | b9a6abef9f1c |
children | 84d01a536bec |
line wrap: on
line source
<template> <div :class="['table-header row no-gutters bg-light', { sortable }]"> <a v-for="column in columns" @click.prevent="!column.disableSorting && sortTable(column.id)" :key="column.id" :class="[ 'd-inline-block py-1 text-center truncate small ' + (column.class || '') + ' ' + (column.disableSorting ? ' sorting-disabled' : ''), { active: sortColumn === column.id } ]" :style="`width: ${column.width};`" > <span :style="'opacity: ' + (sortColumn === column.id ? '1' : '0.3')" v-if="sortable && !column.disableSorting" > <font-awesome-icon :icon="sortIcon(column.id)" fixed-width /> </span> <font-awesome-icon v-if="column.icon" :icon="column.icon" fixed-width /> <span v-if="column.title"> {{ column.title }} </span> </a> <div v-if="extraColumnForButtons" class="col"></div> </div> </template> <style lang="sass"> .table-header > a border-right: solid 1px #e7e8e9 background-color: #f8f9fa a outline: none &:hover text-decoration: none background-color: #f8f9fa &.sortable a:not(.sorting-disabled) cursor: pointer &:hover, &.active background: #e7e8e9 </style> <script> /* This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt * * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH * * Author(s): * Markus Kottländer <markus.kottlaender@intevation.de> */ export default { props: { columns: { type: Array }, sortable: { type: Boolean, default: true }, extraColumnForButtons: { type: Boolean, default: true } }, data() { return { sortColumn: null, sortDirection: "ASC" }; }, methods: { sortIcon(id) { if (this.sortColumn === id) { return "sort-" + (this.sortDirection === "ASC" ? "down" : "up"); } return "sort"; }, sortTable(id) { if (this.sortable) { this.sortColumn = id; this.sortDirection = this.sortDirection === "ASC" ? "DESC" : "ASC"; this.$parent.sortTable({ sortColumn: this.sortColumn, sortDirection: this.sortDirection }); } } } }; </script>