From 09811d322a18654c00c4a8da48f63b7262f3dfbd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 21 Jan 2019 15:21:24 +0100 Subject: [PATCH] Descriptor style fixes --- e2e/helpers/nightmare.js | 13 +- e2e/helpers/selectors.js | 8 +- .../components/array-model/array-model.js | 6 +- .../components/button-menu/button-menu.html | 6 +- .../components/button-menu/button-menu.js | 8 +- front/core/components/button-menu/style.scss | 10 +- front/core/components/drop-down/drop-down.js | 8 +- .../core/components/icon-menu/icon-menu.html | 15 +- front/core/components/icon-menu/style.scss | 2 + front/core/components/popover/style.scss | 1 + front/salix/styles/misc.scss | 81 ++++---- front/salix/styles/summary.scss | 9 +- modules/agency/front/descriptor/index.html | 9 +- modules/claim/front/descriptor/index.html | 70 +++---- modules/client/front/descriptor/index.html | 144 ++++++++------- modules/item/front/descriptor/index.html | 34 ++-- .../item/front/ticket-descriptor/index.html | 174 +++++++++--------- modules/order/front/descriptor/index.html | 120 ++++++------ 18 files changed, 375 insertions(+), 343 deletions(-) diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js index 62a408d218..f88396fbff 100644 --- a/e2e/helpers/nightmare.js +++ b/e2e/helpers/nightmare.js @@ -2,12 +2,19 @@ import Nightmare from 'nightmare'; export default function createNightmare(width = 1280, height = 720) { - const nightmare = new Nightmare({show: process.env.E2E_SHOW, typeInterval: 10, x: 0, y: 0, waitTimeout: 2000}) - .viewport(width, height); + const nightmare = new Nightmare({ + show: process.env.E2E_SHOW, + typeInterval: 10, + x: 0, + y: 0, + waitTimeout: 2000 + }).viewport(width, height); - nightmare.on('console', (type, message) => { + nightmare.on('console', (type, message, ...args) => { if (type === 'error') fail(message); + else + console[type](message, ...args); }); nightmare.header('Accept-Language', 'en'); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d7cb354470..932ecc845e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -35,7 +35,7 @@ export default { cancelButton: `vn-button[href="#!/client/index"]` }, clientDescriptor: { - moreMenu: `vn-client-descriptor > vn-card > div vn-icon-menu > div > vn-icon`, + moreMenu: `vn-client-descriptor vn-icon-menu > div > vn-icon`, simpleTicketButton: 'vn-client-descriptor vn-popover > div > div.content > div > div.list > ul > li' }, clientBasicData: { @@ -189,7 +189,7 @@ export default { cancelButton: `button[ui-sref="item.index"]` }, itemDescriptor: { - moreMenu: `vn-item-descriptor > vn-card > div vn-icon-menu > div > vn-icon`, + moreMenu: `vn-item-descriptor vn-icon-menu > div > vn-icon`, moreMenuRegularizeButton: `vn-item-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`, regularizeWarehouseAutocomplete: `#warehouse`, @@ -303,7 +303,7 @@ export default { createButton: `${components.vnSubmit}` }, ticketDescriptor: { - moreMenu: `vn-ticket-descriptor > vn-card > div vn-icon-menu > div > vn-icon`, + moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`, moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`, acceptDeleteTicketButton: `vn-ticket-descriptor button[response="ACCEPT"]`, @@ -338,7 +338,7 @@ export default { saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover', saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]', saleButton: `vn-left-menu a[ui-sref="ticket.card.sale"]`, - descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, + descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, newItemButton: 'vn-float-button[icon="add"]', firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`, firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(3) > img', diff --git a/front/core/components/array-model/array-model.js b/front/core/components/array-model/array-model.js index 00f7ea9a41..e1bbb7eea8 100644 --- a/front/core/components/array-model/array-model.js +++ b/front/core/components/array-model/array-model.js @@ -154,7 +154,7 @@ export default class ArrayModel extends ModelProxy { let aType = typeof a; - if (aType === typeof b) + if (aType === typeof b) { switch (aType) { case 'string': return a.localeCompare(b); @@ -166,6 +166,7 @@ export default class ArrayModel extends ModelProxy { if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime(); } + } if (a === undefined) return -1; @@ -183,11 +184,12 @@ export default class ArrayModel extends ModelProxy { let mergedWhere = []; let wheres = [dst.where, src.where]; - for (let where of wheres) + for (let where of wheres) { if (Array.isArray(where)) mergedWhere = mergedWhere.concat(where); else if (where) mergedWhere.push(where); + } switch (mergedWhere.length) { case 0: diff --git a/front/core/components/button-menu/button-menu.html b/front/core/components/button-menu/button-menu.html index a4a46f7fe7..80323a9d9b 100644 --- a/front/core/components/button-menu/button-menu.html +++ b/front/core/components/button-menu/button-menu.html @@ -1,13 +1,13 @@
+ on-select="$ctrl.onDropDownSelect(value)" + ng-click="$ctrl.onDropDownClick($event)">
\ No newline at end of file diff --git a/front/core/components/button-menu/button-menu.js b/front/core/components/button-menu/button-menu.js index dd9b5b133d..41f26cfbe4 100644 --- a/front/core/components/button-menu/button-menu.js +++ b/front/core/components/button-menu/button-menu.js @@ -8,6 +8,7 @@ export default class ButtonMenu extends Input { super($element, $scope); this.$transclude = $transclude; this.input = this.element.querySelector('.mdl-button'); + $element.on('click', e => this.onClick(e)); } get model() { @@ -42,11 +43,16 @@ export default class ButtonMenu extends Input { } onClick(event) { + if (event.defaultPrevented) return; event.preventDefault(); this.emit('open'); this.showDropDown(); } + onDropDownClick(event) { + event.preventDefault(); + } + onDropDownSelect(value) { this.field = value; this.emit('change', {value}); @@ -70,7 +76,7 @@ export default class ButtonMenu extends Input { 'limit', 'searchFunction' ]); - this.$.dropDown.show(this.input); + this.$.dropDown.show(this.element); } } ButtonMenu.$inject = ['$element', '$scope', '$transclude']; diff --git a/front/core/components/button-menu/style.scss b/front/core/components/button-menu/style.scss index 740822cde7..53dbb963a3 100644 --- a/front/core/components/button-menu/style.scss +++ b/front/core/components/button-menu/style.scss @@ -1,17 +1,19 @@ -vn-button-menu{ +vn-button-menu { position: relative; + cursor: pointer; + .button-menu__button { padding: 0 10px; } - vn-label{ + vn-label { float: left; margin-top: 1px; } - vn-icon{ + vn-icon { float: left; margin-top: 3px; } - vn-icon.button-menu__arrow_down{ + vn-icon.button-menu__arrow_down { margin: 6px 0 0 5px; } } \ No newline at end of file diff --git a/front/core/components/drop-down/drop-down.js b/front/core/components/drop-down/drop-down.js index c24f1c8c69..123df19942 100755 --- a/front/core/components/drop-down/drop-down.js +++ b/front/core/components/drop-down/drop-down.js @@ -110,8 +110,8 @@ export default class DropDown extends Component { show(parent, search) { this._activeOption = -1; this.search = search; - this.buildList(); this.$.popover.show(parent || this.parent); + this.buildList(); } /** @@ -218,6 +218,7 @@ export default class DropDown extends Component { } onLoadMoreClick(event) { + if (event.defaultPrevented) return; event.preventDefault(); this.model.loadMore(); } @@ -225,7 +226,10 @@ export default class DropDown extends Component { onContainerClick(event) { if (event.defaultPrevented) return; let index = getPosition(this.ul, event); - if (index != -1) this.selectOption(index); + if (index != -1) { + event.preventDefault(); + this.selectOption(index); + } } onDocKeyDown(event) { diff --git a/front/core/components/icon-menu/icon-menu.html b/front/core/components/icon-menu/icon-menu.html index 8ace39c5df..f59f241258 100644 --- a/front/core/components/icon-menu/icon-menu.html +++ b/front/core/components/icon-menu/icon-menu.html @@ -1,14 +1,11 @@
- - - + + + on-select="$ctrl.onDropDownSelect(value)" + ng-click="$ctrl.onDropDownClick($event)">
\ No newline at end of file diff --git a/front/core/components/icon-menu/style.scss b/front/core/components/icon-menu/style.scss index 1541965082..06f66127f6 100644 --- a/front/core/components/icon-menu/style.scss +++ b/front/core/components/icon-menu/style.scss @@ -1,4 +1,6 @@ vn-icon-menu { + cursor: pointer; + vn-drop-down { font-family: 'vn-font' } diff --git a/front/core/components/popover/style.scss b/front/core/components/popover/style.scss index b445544396..b912adb9d2 100644 --- a/front/core/components/popover/style.scss +++ b/front/core/components/popover/style.scss @@ -6,6 +6,7 @@ left: 0; right: 0; bottom: 0; + color: initial; opacity: 0; transform: translateY(-.6em); diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index edca86f951..6ea9f7ae0a 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -188,59 +188,70 @@ vn-main-block { } .vn-descriptor { - .header { + box-shadow: 0 .1em .2em rgba(1, 1, 1, .2); + + & > .header { + display: flex; background: $main-01; color: white; justify-content: space-between; align-items: stretch; + color: white; - & > vn-icon { - padding: .1em; - font-size: 2.5em; - } - & > a , & > vn-icon-menu { + & > * { + min-width: 1.8em; @extend %clickable; display: flex; align-items: center; + justify-content: center; padding: .5em; - color: white; - text-decoration: none; & > vn-icon { font-size: 1.8em; } - - & vn-drop-down{ - color: initial; - } - } - } - .footer { - text-align: center; - & > vn-icon { - color: #666; - opacity: .4; - padding: 0 5% 0 5%; - font-size: 1.5em; - } - & > vn-icon.bright { - color: $main-01; - opacity: 1; } } + & > .body { + @extend .pad-small; - .quicklinks { - justify-content: center; - align-items: center; - - & > a { + & > * { + @extend .pad-small; + } + & > .icons { + display: flex; + align-items: center; + justify-content: center; + padding: 0; + & > vn-icon { - font-size: 1.8em; - padding: 0; + @extend .pad-small; + color: #666; + opacity: .4; + font-size: 1.5em; + + &.bright { + color: $main-01; + opacity: 1; + } } - - & > vn-icon i { - line-height: 36px + } + & > .quicklinks { + display: flex; + align-items: center; + justify-content: center; + padding: 0; + + & > a { + @extend .pad-small; + + & > vn-icon { + font-size: 1.8em; + padding: 0; + + & > i { + line-height: 36px + } + } } } } diff --git a/front/salix/styles/summary.scss b/front/salix/styles/summary.scss index d636f4c292..efd6839941 100644 --- a/front/salix/styles/summary.scss +++ b/front/salix/styles/summary.scss @@ -49,13 +49,8 @@ vn-label-value > section { margin-bottom: .3em; - & > vn-label { - display: block; - font-size: .9em; - - &::after { - content: initial; - } + & > vn-label::after { + content: initial; } } } diff --git a/modules/agency/front/descriptor/index.html b/modules/agency/front/descriptor/index.html index 6a225d8c62..e256984b3c 100644 --- a/modules/agency/front/descriptor/index.html +++ b/modules/agency/front/descriptor/index.html @@ -1,4 +1,4 @@ - + - +
+
- - - - +
+
+
+
{{$ctrl.claim.id}}
@@ -29,32 +29,32 @@ - - - - - - - - - - - - - - - - - +
+ +
+
diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index aacf522dcc..abb3f39b6b 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -1,5 +1,5 @@ - - +
+
@@ -16,76 +16,78 @@ on-change="$ctrl.onMoreChange(value)" on-open="$ctrl.onMoreOpen()"> - -
-
{{$ctrl.client.name}}
- - - - - - - - - -
- - - - - - - - - - - - - - - + +
\ No newline at end of file diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 2742b5f26a..09df4d5205 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -1,5 +1,5 @@ - - +
+
@@ -16,9 +16,9 @@ on-change="$ctrl.onMoreChange(value)" on-open="$ctrl.onMoreOpen()"> - - - +
+
+
- +

Visible

@@ -41,7 +41,9 @@

{{$ctrl.item.available}}

- +
+
+
{{$ctrl.item.id}}
@@ -54,11 +56,9 @@ label="{{tag.tag.name}}" value="{{tag.value}}"> - - - - - + +
+
- +
+
@@ -16,94 +16,96 @@ on-change="$ctrl.onMoreChange(value)" on-open="$ctrl.onMoreOpen()"> - -
-
{{::$ctrl.client.name}}
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - + +
diff --git a/modules/order/front/descriptor/index.html b/modules/order/front/descriptor/index.html index 6931f6dc60..51776be311 100644 --- a/modules/order/front/descriptor/index.html +++ b/modules/order/front/descriptor/index.html @@ -1,66 +1,68 @@ - - +
+
- - -
- - - - - - - - - - - - - - - - - - +
- - - - - - - - - - - - - - - +
+
+ + + + + + + + + + + + + + + + + + +
+ +
+