From 1160cbc279477e203b4ddd4d75d52230970cf6b2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sat, 20 May 2023 13:50:55 +0200 Subject: [PATCH] refs #5667 Fixes: Style, translations, icons --- front/core/lib/string.js | 13 ++++---- front/salix/components/log/index.html | 30 +++++++------------ front/salix/components/log/index.js | 8 ++--- front/salix/components/log/locale/es.yml | 6 ++-- front/salix/components/log/style.scss | 38 ++++++++++-------------- 5 files changed, 40 insertions(+), 55 deletions(-) diff --git a/front/core/lib/string.js b/front/core/lib/string.js index 89477245d1..c4546a9a2b 100644 --- a/front/core/lib/string.js +++ b/front/core/lib/string.js @@ -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 = [ diff --git a/front/salix/components/log/index.html b/front/salix/components/log/index.html index b41436adfd..6e9eeff3e0 100644 --- a/front/salix/components/log/index.html +++ b/front/salix/components/log/index.html @@ -36,12 +36,11 @@
- + translate-attr="::{title: $ctrl.actionsText[log.action]}"> {{::$ctrl.relativeDate(log.creationDate)}}
@@ -66,17 +65,14 @@ {{::log.changedModelValue}} -
-
- - - - -
+
+ +
- + {{::log.description}} - - No details -
diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 82fe4b5ab8..7452c66364 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -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: [{ diff --git a/front/salix/components/log/locale/es.yml b/front/salix/components/log/locale/es.yml index 6890b35a93..b73346ce18 100644 --- a/front/salix/components/log/locale/es.yml +++ b/front/salix/components/log/locale/es.yml @@ -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 diff --git a/front/salix/components/log/style.scss b/front/salix/components/log/style.scss index 117ee87e12..7a5e180497 100644 --- a/front/salix/components/log/style.scss +++ b/front/salix/components/log/style.scss @@ -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 {