Skip to content

Commit

Permalink
Represent read-only items in index with lock icon (CFM-189)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Aug 30, 2022
1 parent 453359c commit bbc42a2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 80 deletions.
38 changes: 34 additions & 4 deletions app/templates/Standard/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,28 @@ function _column_key($modelsName, $c, $tz=null) {
foreach($tryActions as $a) {
// Does this user have permission for this action?
if($vv_permission_set[$entity->id][$a]) {
$args = [];
$args = [];
$readOnlyIcon = '';
if($isFirstLink) {
$args = ['class' => 'row-link'];
$linkClass = 'row-link';
if($a == 'edit') {
$linkClass .= ' row-link-edit';
} elseif ($a == 'view') {
$linkClass .= ' row-link-view';
$readOnlyIcon = ' <em class="material-icons read-only-icon">lock</em>';
}
$args = ['class' => $linkClass];
$isFirstLink = false;
}
// Output the link
if(!empty($readOnlyIcon)) {
print '<div class="read-only-link-container">';
}
print $this->Html->link($label, ['action' => $a, $entity->id], $args);
if(!empty($readOnlyIcon)) {
print $readOnlyIcon;
print '</div>';
}
$linked = true;
break 2;
}
Expand All @@ -581,15 +596,30 @@ function _column_key($modelsName, $c, $tz=null) {
foreach($tryActions as $a) {
// Does this user have permission for this action?
// XXX we actually need to know the permissions on the target (ie: actor person)
if(true ||
if(true ||
$vv_permission_set[$entity->id][$a]) {
$args = [];
$readOnlyIcon = '';
if($isFirstLink) {
$args = ['class' => 'row-link'];
$linkClass = 'row-link';
if($a == 'edit') {
$linkClass .= ' row-link-edit';
} elseif ($a == 'view') {
$linkClass .= ' row-link-view';
$readOnlyIcon = ' <em class="material-icons read-only-icon">lock</em>';
}
$args = ['class' => $linkClass];
$isFirstLink = false;
}
// Output the link
if(!empty($readOnlyIcon)) {
print '<div class="read-only-link-container">';
}
print $this->Html->link($label, ['controller' => $c, 'action' => $a, $entity->$m->id], $args);
if(!empty($readOnlyIcon)) {
print $readOnlyIcon;
print '</div>';
}
$linked = true;
break 2;
}
Expand Down
86 changes: 10 additions & 76 deletions app/webroot/css/co-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -760,74 +760,6 @@ ul.form-list li.alert-banner .co-alert {
white-space: nowrap;
margin-right: 0.5em;
}
/* RECONCILE TABLE */
#reconcile-table {
width: auto;
border: none;
font-size: 0.8em;
}
#reconcile-table td,
#reconcile-table th {
border: 1px solid var(--cmg-color-lightgray-006);
}
#reconcile-table th {
font-weight: normal;
}
#reconcile-table th.col-names {
text-align: center;
background-color: var(--cmg-color-white);
border: none;
font-weight: bold;
}
#reconcile-table td.empty {
background-color: var(--cmg-color-white) !important;
border: none;
font-size: 0.5em;
}
#reconcile-table tbody td.reference-ids {
text-align: center;
word-break: break-all;
background-color: var(--cmg-color-lightgray-003) !important;
}
#reconcile-table td.reconcile-actions {
text-align: center;
}
#reconcile-table .btn {
font-size: 1em;
}
#reconcile-table th.attr-title {
border: none;
background-color: var(--cmg-color-white);
text-align: right;
}
/* set the borders on the "new" reference id */
#reconcile-table tbody td:nth-child(2) {
border-left: 2px solid var(--cmg-color-lightgray-007);
border-right: 2px solid var(--cmg-color-lightgray-007);
}
#reconcile-table tbody tr:first-child td:nth-child(2) {
border-top: 2px solid var(--cmg-color-lightgray-007);
}
#reconcile-table tbody tr:last-child td:nth-child(2) {
border-bottom: 2px solid var(--cmg-color-lightgray-007);
}
/* no zebra for this table */
#reconcile-table tr:nth-child(2n+1) td {
background-color: var(--cmg-color-white);
}
#reconcile-table tr.match td {
background-color: var(--cmg-color-green-004);
}
/* MATCHGRID MANAGEMENT */
#matchgrid-management {
padding: 0;
margin: 0 0 3em;
}
.matchgrid-description {
margin-top: -1em;
margin-bottom: 2em;
font-style: italic;
}
/* CO CONFIGURATION DASHBOARD */
#configuration-menu {
list-style: none;
Expand All @@ -843,13 +775,6 @@ ul.form-list li.alert-banner .co-alert {
color: var(--cmg-color-gray-001);
margin-right: 0.5em;
}
/* MATCHGRID RECORDS INDEX */
body.matchgridrecords .popover {
max-width: unset;
}
body.matchgridrecords .popover-header {
font-size: 1em;
}
/* INDEX ACTION COMMAND MENUS */
a.action-menu-toggle {
padding: 0.5rem;
Expand Down Expand Up @@ -879,6 +804,7 @@ a.dropdown-item.deletebutton {
padding: 0.5em 1em;
}
table.bulk-edit-mode a.row-link,
table.bulk-edit-mode .read-only-link-container,
table.bulk-edit-mode .row-link-heading,
table.bulk-edit-mode td.actions .field-actions {
display: none;
Expand Down Expand Up @@ -1377,7 +1303,7 @@ code,
.fixed-width * {
font-family: "Courier New","Courier",monospace !important;
}
/* Tables */
/* INDEX VIEWS and TABLES */
table {
width: 100%;
border-collapse: collapse;
Expand Down Expand Up @@ -1437,6 +1363,14 @@ table.index-table.with-actions td:nth-child(2) {
.linked-row:hover td {
background-color: var(--cmg-color-lightgray-001) !important;
}
table.list-mode .read-only-link-container {
display: flex;
justify-content: space-between;
align-items: center;
}
.linked-row .read-only-icon {
color: var(--cmg-color-gray-003);
}
.menuitembutton {
width: 250px;
}
Expand Down

0 comments on commit bbc42a2

Please sign in to comment.