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); 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) { export function hashToColor(value) {
value = value || ''; return '#' + colors[djb2a(value || '') % colors.length];
let hash = 0;
for (let i = 0; i < value.length; i++)
hash += value.charCodeAt(i);
return '#' + colors[hash % colors.length];
} }
const colors = [ const colors = [

View File

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

View File

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

View File

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

View File

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