refs #5667 Fixes: Style, translations, icons
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-05-20 13:50:55 +02:00
parent 718002d5aa
commit 1160cbc279
5 changed files with 40 additions and 55 deletions

View File

@ -31,12 +31,15 @@ export function firstUpper(str) {
return str.charAt(0).toUpperCase() + str.substr(1);
}
export function djb2a(string) {
let hash = 5381;
for (let i = 0; i < string.length; i++)
hash = ((hash << 5) + hash) ^ string.charCodeAt(i);
return hash >>> 0;
}
export function hashToColor(value) {
value = value || '';
let hash = 0;
for (let i = 0; i < value.length; i++)
hash += value.charCodeAt(i);
return '#' + colors[hash % colors.length];
return '#' + colors[djb2a(value || '') % colors.length];
}
const colors = [

View File

@ -36,12 +36,11 @@
<div
class="action-date text-secondary text-caption vn-mr-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
<span >
<vn-icon
class="action vn-mr-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
title="{{::$ctrl.actionsText[log.action] | translate}}">
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
{{::$ctrl.relativeDate(log.creationDate)}}
</div>
@ -66,17 +65,14 @@
{{::log.changedModelValue}}
</span>
</div>
<div class="changes vn-pa-sm" ng-class="{expanded: log.expand}">
<div class="icon vn-ml-sm">
<vn-icon icon="visibility"
class="expand-button"
ng-click="log.expand = true">
</vn-icon>
<vn-icon icon="visibility_off"
class="shrink-button"
ng-click="log.expand = false">
</vn-icon>
</div>
<div class="changes vn-pa-sm"
ng-class="{expanded: log.expand}"
ng-if="::log.props.length || log.description">
<vn-icon
icon="expand_more"
translate-attr="{title: 'Details'}"
ng-click="log.expand = !log.expand">
</vn-icon>
<span ng-if="::log.props.length"
class="attributes">
<span ng-if="!log.expand" ng-repeat="prop in ::log.props"
@ -98,15 +94,9 @@
</div>
</div>
</span>
<span ng-if="::!log.props.length"
class="description">
<span ng-if="::!log.props.length" class="description">
{{::log.description}}
</span>
<span ng-if="::!log.description && !log.props.length"
class="no-changes"
translate>
No details
</span>
</vn-card>
</div>
</div>

View File

@ -11,9 +11,9 @@ export default class Controller extends Section {
this.hashToColor = hashToColor;
this.actionsText = {
insert: 'Creates',
update: 'Updates',
update: 'Edits',
delete: 'Deletes',
select: 'Views'
select: 'Accesses'
};
this.actionsClass = {
insert: 'success',
@ -23,9 +23,9 @@ export default class Controller extends Section {
};
this.actionsIcon = {
insert: 'add',
update: 'update',
update: 'edit',
delete: 'remove',
select: 'search'
select: 'visibility'
};
this.filter = {
include: [{

View File

@ -10,12 +10,12 @@ After: Despues
History: Historial
Name: Nombre
Creates: Crea
Updates: Actualiza
Edits: Edita
Deletes: Elimina
Views: Visualiza
Accesses: Accede
System: Sistema
Details: Detalles
note: nota
Changes: Cambios
No details: Sin detalles
today: hoy
yesterday: ayer

View File

@ -1,4 +1,5 @@
@import "variables";
@import "effects";
vn-log {
.change {
@ -47,6 +48,7 @@ vn-log {
& > .header {
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
& > .action-model {
@ -63,10 +65,10 @@ vn-log {
white-space: nowrap;
}
}
.action-date {
& > .action-date {
white-space: nowrap;
.action {
& > .action {
display: inline-flex;
align-items: center;
justify-content: center;
@ -75,7 +77,7 @@ vn-log {
border-radius: 50%;
width: 24px;
height: 24px;
font-size: 1.5em;
font-size: 1.4em;
&.notice {
background-color: $color-notice-medium
@ -111,7 +113,6 @@ vn-log {
overflow: hidden;
background-color: rgba(255, 255, 255, .05);
color: $color-font-light;
transition: max-height 1000ms ease-in-out;
position: relative;
overflow: hidden;
text-overflow: ellipsis;
@ -119,32 +120,23 @@ vn-log {
min-height: 34px;
box-sizing: border-box;
& > .icon {
& > vn-icon {
@extend %clickable;
float: right;
position: relative;
cursor: pointer;
& > vn-icon {
font-size: 1.2em;
}
& > .expand-button {
display: block;
}
& > .shrink-button {
display: none;
}
transition-property: transform, background-color;
transition-duration: 150ms;
margin: -5px;
margin-left: 4px;
padding: 1px;
border-radius: 50%;
}
&.expanded {
text-overflow: initial;
white-space: initial;
& > .icon {
& > .expand-button {
display: none;
}
& > .shrink-button {
display: block;
}
& > vn-icon {
transform: rotate(180deg);
}
}
& > .no-changes {