File tree Expand file tree Collapse file tree 6 files changed +140
-1
lines changed
code/Magento/Ui/view/base/web/js/grid
design/adminhtml/Magento/backend/Magento_Ui/web/css/source Expand file tree Collapse file tree 6 files changed +140
-1
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,16 @@ define([
10
10
11
11
return Column . extend ( {
12
12
defaults : {
13
+ bodyTmpl : 'ui/grid/columns/image-preview' ,
13
14
previewImageSelector : '[data-image-preview]' ,
14
15
visibleRecord : null ,
15
16
height : 0 ,
16
17
displayedRecord : { } ,
17
18
lastOpenedImage : null ,
19
+ fields : {
20
+ previewUrl : 'preview_url' ,
21
+ title : 'title'
22
+ } ,
18
23
modules : {
19
24
masonry : '${ $.parentName }' ,
20
25
thumbnailComponent : '${ $.parentName }.thumbnail_url'
@@ -154,6 +159,26 @@ define([
154
159
return this . visibleRecord ( ) === record . _rowIndex || false ;
155
160
} ,
156
161
162
+ /**
163
+ * Returns preview image url for a given record.
164
+ *
165
+ * @param {Object } record
166
+ * @return {String }
167
+ */
168
+ getUrl : function ( record ) {
169
+ return record [ this . fields . previewUrl ] ;
170
+ } ,
171
+
172
+ /**
173
+ * Returns image title for a given record.
174
+ *
175
+ * @param {Object } record
176
+ * @return {String }
177
+ */
178
+ getTitle : function ( record ) {
179
+ return record [ this . fields . title ] ;
180
+ } ,
181
+
157
182
/**
158
183
* Get styles for preview
159
184
*
Original file line number Diff line number Diff line change 9
9
10
10
return Column . extend ( {
11
11
defaults : {
12
+ bodyTmpl : 'ui/grid/columns/image' ,
12
13
modules : {
13
14
previewComponent : '${ $.parentName }.preview'
14
15
} ,
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ define([
8
8
'use strict' ;
9
9
10
10
return Column . extend ( {
11
+ defaults : {
12
+ bodyTmpl : 'ui/grid/columns/overlay'
13
+ } ,
14
+
11
15
/**
12
16
* If overlay should be visible
13
17
*
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ define([
13
13
14
14
return Listing . extend ( {
15
15
defaults : {
16
- template : 'Magento_Ui /grid/masonry' ,
16
+ template : 'ui /grid/masonry' ,
17
17
imports : {
18
18
rows : '${ $.provider }:data.items' ,
19
19
errorMessage : '${ $.provider }:data.errorMessage'
Original file line number Diff line number Diff line change 4
4
// */
5
5
6
6
@import ' module/_data-grid.less' ;
7
+ @import ' module/_masonry-grid.less' ;
Original file line number Diff line number Diff line change
1
+ // /**
2
+ // * Copyright © Magento, Inc. All rights reserved.
3
+ // * See COPYING.txt for license details.
4
+ // */
5
+ @admin__masonry_grid_image__space : 20px ;
6
+ @admin__masonry_grid_background_color : #fff ;
7
+ @admin__masonry_overlay_background_color : #507dc8 ;
8
+
9
+ & when (@media-common = true ) {
10
+ .masonry-image {
11
+ &-grid {
12
+ margin : @admin__masonry_grid_image__space / 2 - (@admin__masonry_grid_image__space / 2 );
13
+ overflow : hidden ;
14
+ position : relative ;
15
+
16
+ .no-data-message-container ,
17
+ .error-message-container {
18
+ font-size : @data-grid__no-records__font-size ;
19
+ padding : @data-grid__no-records__padding ;
20
+ text-align : center ;
21
+ }
22
+ }
23
+
24
+ &-column {
25
+ background-color : @admin__masonry_grid_background_color ;
26
+ float : left ;
27
+ margin : @admin__masonry_grid_image__space / 2 ;
28
+ overflow : hidden ;
29
+
30
+ img {
31
+ cursor : pointer ;
32
+ height : 100% ;
33
+ width : 100% ;
34
+ }
35
+ }
36
+
37
+ &-overlay {
38
+ background-color : @admin__masonry_overlay_background_color ;
39
+ color : @admin__masonry_grid_background_color ;
40
+ opacity : 1 ;
41
+ padding : .5rem ;
42
+ position : absolute ;
43
+ text-align : center ;
44
+ width : 80px ;
45
+ z-index : 10 ;
46
+ }
47
+
48
+ &-preview {
49
+ background-color : @admin__masonry_grid_background_color ;
50
+ display : table ;
51
+ left : 0 ;
52
+ position : absolute ;
53
+ right : 0 ;
54
+ width : 100% ;
55
+
56
+ .container {
57
+ margin : auto ;
58
+ max-width : 880px ;
59
+ padding-top : 10px ;
60
+
61
+ .action-buttons {
62
+ text-align : right ;
63
+
64
+ .action {
65
+ &-close {
66
+ padding : 30px ;
67
+ position : static ;
68
+ }
69
+
70
+ &-previous ,
71
+ &-next {
72
+ background : transparent ;
73
+ border : none ;
74
+ margin : 0 ;
75
+ white-space : nowrap ;
76
+ }
77
+
78
+ &-close ,
79
+ &-previous ,
80
+ &-next {
81
+ font-size : 2rem ;
82
+ }
83
+ }
84
+ }
85
+
86
+ .preview-row-content {
87
+ display : flex ;
88
+
89
+ & :after {
90
+ clear : both ;
91
+ content : ' ' ;
92
+ display : table ;
93
+ }
94
+
95
+ img .preview {
96
+ display : block ;
97
+ flex-basis : 300px ;
98
+ float : left ;
99
+ margin-bottom : 20px ;
100
+ max-height : 500px ;
101
+ max-width : 60% ;
102
+ width : auto ;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
You can’t perform that action at this time.
0 commit comments