Skip to content

Commit

Permalink
Rights management: fix UI issue when having dozen groups
Browse files Browse the repository at this point in the history
Header of the table, and the first column, are now sticky,
so they are always visibles
  • Loading branch information
laurentj committed May 19, 2022
1 parent 3cdc909 commit 7cc9097
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<form action="{formurl 'jacl2db_admin~groups:saverights'}" method="post">
<fieldset><legend>{@jacl2db_admin~acl2.rights.title@}</legend>
<div>{formurlparam 'jacl2db_admin~groups:saverights'}</div>
<table class="records-list jacl2-list" id="rights-list">
<table class="records-list jacl2-list jacl2-list-sticky-heads" id="rights-list">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h1>{@jacl2db_admin~acl2.groups.rights.title@}</h1>

<table class="records-list jacl2-list">
<table class="records-list jacl2-list jacl2-list-sticky-heads">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<fieldset><legend>{@jacl2db_admin~acl2.rights.title@}</legend>

<div>{formurlparam 'jacl2db_admin~users:saverights',array('user'=>$user)}</div>
<table class="records-list jacl2-list-user" id="rights-list"
<table class="records-list jacl2-list-user jacl2-list-sticky-heads" id="rights-list"
data-yes-img="{$j_jelixwww}/design/icons/accept.png"
data-yes-title="{@jacl2db_admin~acl2.group.rights.yes@}"
data-no-img="{$j_jelixwww}/design/icons/cancel.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h1>{@jacl2db_admin~acl2.user.rights.title@} {$user}</h1>

<table class="records-list jacl2-list-user">
<table class="records-list jacl2-list-user jacl2-list-sticky-heads">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
26 changes: 26 additions & 0 deletions lib/jelix-www/design/jacl2.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,29 @@ select.right-yes, span.right-yes {
color: green;
font-weight: bold;
}


.jacl2-list.jacl2-list-sticky-heads,
.jacl2-list-user.jacl2-list-sticky-heads
{
overflow: scroll;
position: relative;
border-collapse: separate;
}

.jacl2-list.jacl2-list-sticky-heads thead,
.jacl2-list-user.jacl2-list-sticky-heads thead
{
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
z-index: 1;
}
.jacl2-list.jacl2-list-sticky-heads tbody th ,
.jacl2-list-user.jacl2-list-sticky-heads tbody th
{
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
background: #ecebeb
}
5 changes: 3 additions & 2 deletions lib/jelix-www/js/jforms_jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ jFormsJQForm.prototype={
}

var elt = this.element.elements[ctrl.name];
var eltValue = elt.value;
var me = this;

jQuery.post(jFormsJQ.selectFillUrl, param,
Expand All @@ -426,11 +427,11 @@ jFormsJQForm.prototype={
select.append('<optgroup label="'+item.label+'"/>');
var optgroup = select.children('optgroup[label="'+item.label+'"]').eq(0);
jQuery.each(item.items, function(i,item){
optgroup.append('<option value="'+item.value+'">'+item.label+'</option>');
optgroup.append('<option value="'+item.value+'"'+(item.value == eltValue ? ' selected="selected"' : '')+'>'+item.label+'</option>');
});
}
else
select.append('<option value="'+item.value+'">'+item.label+'</option>');
select.append('<option value="'+item.value+'"'+(item.value == eltValue ? ' selected="selected"' : '')+'>'+item.label+'</option>');
});
}
if (me.controlsToUpdate.length) {
Expand Down
4 changes: 2 additions & 2 deletions lib/jelix/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; --- build date: 2022-03-28 11:07
; --- build date: 2022-05-19 13:12
; --- lib version: 1.6.37-pre
PHP_VERSION_TARGET=7.4
EDITION_NAME=dev
ENABLE_DEVELOPER=1
ENABLE_OPTIMIZED_SOURCE=0
STRIP_COMMENT=0
SOURCE_REVISION=3814
SOURCE_REVISION=3816
2 changes: 1 addition & 1 deletion lib/jelix/core-modules/jelix/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://jelix.org/ns/module/1.0">
<info id="jelix@modules.jelix.org" name="jelix" createdate="2006-01-01">
<version stability="stable" date="2022-03-28 11:07">1.6.37-pre</version>
<version stability="stable" date="2022-05-19 13:12">1.6.37-pre</version>
<label lang="en_US">Jelix Main Module</label>
<description lang="en_US">Main module of jelix which contains some ressources needed by jelix classes</description>
<license URL="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL 2.1</license>
Expand Down
2 changes: 1 addition & 1 deletion lizmap/var/themes/default/jacl2db_admin/groups_right.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<form action="{formurl 'jacl2db_admin~groups:saverights'}" method="post">
<fieldset><legend>{@jacl2db_admin~acl2.rights.title@}</legend>
<div>{formurlparam 'jacl2db_admin~groups:saverights'}</div>
<table class="records-list jacl2-list table-striped" id="rights-list">
<table class="records-list jacl2-list table-striped jacl2-list-sticky-heads" id="rights-list">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<p><a href="{jurl 'jacl2db_admin~groups:index'}" class="btn">{@jacl2db_admin~acl2.menu.item.groups@}</a></p>

<table class="records-list jacl2-list table-striped">
<table class="records-list jacl2-list table-striped jacl2-list-sticky-heads">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
2 changes: 1 addition & 1 deletion lizmap/var/themes/default/jacl2db_admin/user_rights.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<fieldset><legend>{@jacl2db_admin~acl2.rights.title@}</legend>

<div>{formurlparam 'jacl2db_admin~users:saverights',array('user'=>$user)}</div>
<table class="records-list jacl2-list-user table-striped" id="rights-list"
<table class="records-list jacl2-list-user table-striped jacl2-list-sticky-heads" id="rights-list"
data-yes-img="{$j_jelixwww}/design/icons/accept.png"
data-yes-title="{@jacl2db_admin~acl2.group.rights.yes@}"
data-no-img="{$j_jelixwww}/design/icons/cancel.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<h1>{@jacl2db_admin~acl2.user.rights.title@} {$user}</h1>

<table class="records-list jacl2-list-user table-striped">
<table class="records-list jacl2-list-user table-striped jacl2-list-sticky-heads">
<thead>
<tr>
<th rowspan="2"></th>
Expand Down
6 changes: 6 additions & 0 deletions lizmap/www/assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ dd#dd_qgis_logs_value {
font-size: 0.8em;
line-height: 15px;
}

.jacl2-list.jacl2-list-sticky-heads thead,
.jacl2-list-user.jacl2-list-sticky-heads thead
{
top: 75px;
}
5 changes: 5 additions & 0 deletions lizmap/www/assets/css/media.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ only screen and ( max-device-height : 640px) {
#header {
height : 30px;
}
.jacl2-list.jacl2-list-sticky-heads thead,
.jacl2-list-user.jacl2-list-sticky-heads thead
{
top: 35px;
}
#logo {
height : 30px;
margin: 0px 5px;
Expand Down
26 changes: 26 additions & 0 deletions lizmap/www/assets/jelix/design/jacl2.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,29 @@ select.right-yes, span.right-yes {
color: green;
font-weight: bold;
}


.jacl2-list.jacl2-list-sticky-heads,
.jacl2-list-user.jacl2-list-sticky-heads
{
overflow: scroll;
position: relative;
border-collapse: separate;
}

.jacl2-list.jacl2-list-sticky-heads thead,
.jacl2-list-user.jacl2-list-sticky-heads thead
{
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
z-index: 1;
}
.jacl2-list.jacl2-list-sticky-heads tbody th ,
.jacl2-list-user.jacl2-list-sticky-heads tbody th
{
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
background: #ecebeb
}
8 changes: 5 additions & 3 deletions lizmap/www/assets/jelix/js/jforms_jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,11 @@ jFormsJQForm.prototype={
select.empty();
if(emptyitem)
select.append(emptyitem);
jQuery.each(data, function(i, item){
if (emptyitem && item.value == '')
return; // do not add empty item if it already exists.
jQuery.each(data, function(i, item) {
if (emptyitem && item.value == '') {
// do not add empty item if it already exists.
return;
}
if(typeof item.items == 'object'){
select.append('<optgroup label="'+item.label+'"/>');
var optgroup = select.children('optgroup[label="'+item.label+'"]').eq(0);
Expand Down

0 comments on commit 7cc9097

Please sign in to comment.