Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5394-descriptor-popovers-logs
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
fbc6fa6413
|
@ -174,7 +174,6 @@ export default class Autocomplete extends Field {
|
||||||
|
|
||||||
refreshDisplayed() {
|
refreshDisplayed() {
|
||||||
let display = '';
|
let display = '';
|
||||||
let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem');
|
|
||||||
|
|
||||||
if (this._selection && this.showField) {
|
if (this._selection && this.showField) {
|
||||||
if (this.multiple && Array.isArray(this._selection)) {
|
if (this.multiple && Array.isArray(this._selection)) {
|
||||||
|
@ -182,19 +181,8 @@ export default class Autocomplete extends Field {
|
||||||
if (display.length > 0) display += ', ';
|
if (display.length > 0) display += ', ';
|
||||||
display += item[this.showField];
|
display += item[this.showField];
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
display = this._selection[this.showField];
|
display = this._selection[this.showField];
|
||||||
if (hasTemplate) {
|
|
||||||
let template = this.$transclude(() => {}, null, 'tplItem');
|
|
||||||
const element = template[0];
|
|
||||||
const description = element.querySelector('.text-secondary');
|
|
||||||
if (description) description.remove();
|
|
||||||
|
|
||||||
const displayElement = angular.element(element);
|
|
||||||
const displayText = displayElement.text();
|
|
||||||
display = this.$interpolate(displayText)(this._selection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.input.value = display;
|
this.input.value = display;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="letter">
|
||||||
|
{{::$ctrl.val && $ctrl.val.charAt(0).toUpperCase()}}
|
||||||
|
</div>
|
||||||
|
<div class="image" ng-transclude>
|
||||||
|
</div>
|
|
@ -0,0 +1,63 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays colored avatar based on value.
|
||||||
|
*
|
||||||
|
* @property {*} val The value
|
||||||
|
*/
|
||||||
|
export default class Avatar extends Component {
|
||||||
|
get val() {
|
||||||
|
return this._val;
|
||||||
|
}
|
||||||
|
|
||||||
|
set val(value) {
|
||||||
|
this._val = value;
|
||||||
|
|
||||||
|
const val = value || '';
|
||||||
|
let hash = 0;
|
||||||
|
for (let i = 0; i < val.length; i++)
|
||||||
|
hash += val.charCodeAt(i);
|
||||||
|
const color = '#' + colors[hash % colors.length];
|
||||||
|
|
||||||
|
const el = this.element;
|
||||||
|
el.style.backgroundColor = color;
|
||||||
|
el.title = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnAvatar', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Avatar,
|
||||||
|
bindings: {
|
||||||
|
val: '@?'
|
||||||
|
},
|
||||||
|
transclude: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const colors = [
|
||||||
|
'e2553d', // Coral
|
||||||
|
'FFA07A', // Salmon
|
||||||
|
'FFDAB9', // Peach
|
||||||
|
'a17077', // Pink
|
||||||
|
'bf0e99', // Pink light
|
||||||
|
'52a500', // Green chartreuse
|
||||||
|
'00aeae', // Cian
|
||||||
|
'b754cf', // Purple middle
|
||||||
|
'8a69cd', // Blue lavender
|
||||||
|
'1fa8a1', // Green ocean
|
||||||
|
'DC143C', // Red crimson
|
||||||
|
'5681cf', // Blue steel
|
||||||
|
'FF1493', // Ping intense
|
||||||
|
'02ba02', // Green lime
|
||||||
|
'1E90FF', // Blue sky
|
||||||
|
'8B008B', // Purple dark
|
||||||
|
'cc7000', // Orange bright
|
||||||
|
'00b5b8', // Turquoise
|
||||||
|
'8B0000', // Red dark
|
||||||
|
'008080', // Green bluish
|
||||||
|
'2F4F4F', // Gray board
|
||||||
|
'7e7e7e', // Gray
|
||||||
|
'5d5d5d', // Gray dark
|
||||||
|
];
|
|
@ -0,0 +1,32 @@
|
||||||
|
@import "variables";
|
||||||
|
|
||||||
|
vn-avatar {
|
||||||
|
display: block;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 36px;
|
||||||
|
width: 36px;
|
||||||
|
font-size: 22px;
|
||||||
|
background-color: $color-main;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
& > .letter {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
& > .image {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
& > img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import './pagination/pagination';
|
||||||
import './searchbar/searchbar';
|
import './searchbar/searchbar';
|
||||||
import './scroll-up/scroll-up';
|
import './scroll-up/scroll-up';
|
||||||
import './autocomplete';
|
import './autocomplete';
|
||||||
|
import './avatar';
|
||||||
import './button';
|
import './button';
|
||||||
import './button-menu';
|
import './button-menu';
|
||||||
import './calendar';
|
import './calendar';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import './index';
|
import './index';
|
||||||
|
|
||||||
describe('Salix Component vnLog', () => {
|
describe('Component vnJsonValue', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $scope;
|
let $scope;
|
||||||
let $element;
|
let $element;
|
||||||
|
@ -10,7 +10,7 @@ describe('Salix Component vnLog', () => {
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope) => {
|
beforeEach(inject(($componentController, $rootScope) => {
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$element = angular.element('<json-value></json-value>');
|
$element = angular.element('<vn-json-value></vn-json-value>');
|
||||||
controller = $componentController('vnJsonValue', {$element, $scope});
|
controller = $componentController('vnJsonValue', {$element, $scope});
|
||||||
el = controller.element;
|
el = controller.element;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -17,20 +17,16 @@
|
||||||
<vn-data-viewer model="model" class="vn-w-md vn-px-sm">
|
<vn-data-viewer model="model" class="vn-w-md vn-px-sm">
|
||||||
<div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs">
|
<div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs">
|
||||||
<div class="user-wrapper">
|
<div class="user-wrapper">
|
||||||
<div
|
<vn-avatar class="vn-mt-xs"
|
||||||
class="user vn-mt-xs"
|
|
||||||
ng-class="::{system: !log.user}"
|
ng-class="::{system: !log.user}"
|
||||||
ng-style="::$ctrl.userBgColor(log.user)"
|
val="{{::log.user ? log.user.nickname : 'System'}}"
|
||||||
title="{{::log.user.nickname || 'System'}}">
|
ng-click="$ctrl.showWorkerDescriptor($event, log)">
|
||||||
<div class="user-letter">
|
|
||||||
{{::log.user ? log.user.name.charAt(0).toUpperCase() : 'S'}}
|
|
||||||
</div>
|
|
||||||
<img
|
<img
|
||||||
ng-if="::log.user.image"
|
ng-if="::log.user.image"
|
||||||
ng-src="/api/Images/user/160x160/{{::log.userFk}}/download?access_token={{::$ctrl.vnToken.token}}"
|
ng-src="/api/Images/user/160x160/{{::log.userFk}}/download?access_token={{::$ctrl.vnToken.token}}"
|
||||||
ng-click="::$ctrl.showDescriptor('Worker', $event, log.userFk)">
|
ng-click="::$ctrl.showDescriptor('Worker', $event, log.userFk)">
|
||||||
</img>
|
</img>
|
||||||
</div>
|
</vn-avatar>
|
||||||
<div class="arrow bg-panel"></div>
|
<div class="arrow bg-panel"></div>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,7 +37,7 @@
|
||||||
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}">
|
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}">
|
||||||
{{::$ctrl.relativeDate(log.creationDate)}}
|
{{::$ctrl.relativeDate(log.creationDate)}}
|
||||||
</div>
|
</div>
|
||||||
<span class="chip {{::$ctrl.actionsClass[log.action]}}" translate>
|
<span class="chip" ng-class="::$ctrl.actionsClass[log.action]" translate>
|
||||||
{{::$ctrl.actionsText[log.action]}}
|
{{::$ctrl.actionsText[log.action]}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,7 +58,9 @@
|
||||||
{{::log.changedModelValue}}
|
{{::log.changedModelValue}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="changes {{::log.props.length ? 'props' : 'no-props'}}" vn-id="changes">
|
<div class="changes"
|
||||||
|
ng-class="::log.props.length ? 'props' : 'no-props'"
|
||||||
|
vn-id="changes">
|
||||||
<vn-icon icon="visibility"
|
<vn-icon icon="visibility"
|
||||||
class="expand-button"
|
class="expand-button"
|
||||||
ng-click="$ctrl.toggleAttributes(log, changes, true)">
|
ng-click="$ctrl.toggleAttributes(log, changes, true)">
|
||||||
|
@ -152,13 +150,25 @@
|
||||||
ng-model="filter.userFk"
|
ng-model="filter.userFk"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
show-field="nickname"
|
show-field="nickname"
|
||||||
fields="['id', 'name', 'nickname']"
|
fields="['id', 'name', 'nickname', 'image']"
|
||||||
search-function="$ctrl.searchUser($search)"
|
search-function="$ctrl.searchUser($search)"
|
||||||
url="{{$ctrl.url}}/{{$ctrl.originId}}/editors"
|
url="{{$ctrl.url}}/{{$ctrl.originId}}/editors"
|
||||||
order="nickname">
|
order="nickname">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
<div>{{nickname}}</div>
|
<div style="display: flex;">
|
||||||
<div class="text-secondary text-caption">{{name}}</div>
|
<vn-avatar
|
||||||
|
class="vn-mr-sm"
|
||||||
|
val="{{::nickname}}">
|
||||||
|
<img
|
||||||
|
ng-if="::image"
|
||||||
|
ng-src="/api/Images/user/160x160/{{::id}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||||
|
</img>
|
||||||
|
</vn-avatar>
|
||||||
|
<div>
|
||||||
|
<div>{{::nickname}}</div>
|
||||||
|
<div class="text-secondary text-caption">{{::name}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
|
|
@ -228,29 +228,3 @@ ngModule.vnComponent('vnLog', {
|
||||||
url: '@'
|
url: '@'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const colors = [
|
|
||||||
'e2553d', // Coral
|
|
||||||
'FFA07A', // Salmon
|
|
||||||
'FFDAB9', // Peach
|
|
||||||
'a17077', // Pink
|
|
||||||
'bf0e99', // Pink light
|
|
||||||
'52a500', // Green chartreuse
|
|
||||||
'00aeae', // Cian
|
|
||||||
'b754cf', // Purple middle
|
|
||||||
'8a69cd', // Blue lavender
|
|
||||||
'1fa8a1', // Green ocean
|
|
||||||
'DC143C', // Red crimson
|
|
||||||
'5681cf', // Blue steel
|
|
||||||
'FF1493', // Ping intense
|
|
||||||
'02ba02', // Green lime
|
|
||||||
'1E90FF', // Blue sky
|
|
||||||
'8B008B', // Purple dark
|
|
||||||
'cc7000', // Orange bright
|
|
||||||
'00b5b8', // Turquoise
|
|
||||||
'8B0000', // Red dark
|
|
||||||
'008080', // Green bluish
|
|
||||||
'2F4F4F', // Gray board
|
|
||||||
'7e7e7e', // Gray
|
|
||||||
'5d5d5d', // Gray dark
|
|
||||||
];
|
|
||||||
|
|
|
@ -8,34 +8,11 @@ vn-log {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
|
||||||
& > .user {
|
& > vn-avatar {
|
||||||
position: relative;
|
|
||||||
border-radius: 50%;
|
|
||||||
height: 36px;
|
|
||||||
width: 36px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
& > * {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
&.system {
|
|
||||||
background-color: $color-main;
|
|
||||||
}
|
|
||||||
.user-letter {
|
|
||||||
font-size: 22px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
img {
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
&.system {
|
||||||
left: 0;
|
background-color: $color-main !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& > .arrow {
|
& > .arrow {
|
||||||
|
|
Loading…
Reference in New Issue