Skip to content

Commit d75b44e

Browse files
SP-68 Bugfix Icon sollte auch angezeigt werden, wenn keine Überschrift angezeigt werden soll.
0 parents  commit d75b44e

File tree

14 files changed

+680
-0
lines changed

14 files changed

+680
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace nnwebEmotionHoverIcon\ComponentHandler;
4+
5+
use Shopware\Bundle\EmotionBundle\ComponentHandler\ComponentHandlerInterface;
6+
use Shopware\Bundle\EmotionBundle\Struct\Collection\PrepareDataCollection;
7+
use Shopware\Bundle\EmotionBundle\Struct\Collection\ResolvedDataCollection;
8+
use Shopware\Bundle\EmotionBundle\Struct\Element;
9+
use Shopware\Bundle\StoreFrontBundle\Struct\ShopContextInterface;
10+
11+
class nnwebEmotionHoverIconComponentHandler implements ComponentHandlerInterface {
12+
13+
public function supports(Element $element) {
14+
return $element->getComponent()->getTemplate() === 'component_nnweb_emotion_hover_icon';
15+
}
16+
17+
public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context) {
18+
$productNumber = $element->getConfig()->get('nnwebEmotionHoverIcon_link_artikel');
19+
$collection->getBatchRequest()->setProductNumbers($element->getId(), [$productNumber]);
20+
}
21+
22+
public function handle(ResolvedDataCollection $collection, Element $element, ShopContextInterface $context) {
23+
$product = current($collection->getBatchResult()->get($element->getId()));
24+
if (!empty($product)) {
25+
$element->getData()->set('nnwebEmotionHoverIcon_link_produkt_id', $product->getId());
26+
}
27+
}
28+
}

README.md

60 Bytes

SW_5nnwebEmotionHoverIcon

Resources/services.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<container xmlns="http://symfony.com/schema/dic/services"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
4+
5+
<services>
6+
<!-- Add emotion component auto loader -->
7+
<service id="nnweb_emotion_hover_icon.emotion_view_subscriber" class="Shopware\Components\Emotion\EmotionComponentViewSubscriber" public="true">
8+
<argument>%nnweb_emotion_hover_icon.plugin_dir%</argument>
9+
<tag name="shopware.event_subscriber" />
10+
</service>
11+
12+
<service id="nnweb_emotion_hover_icon.nnweb_emotion_hover_icon_component_handler" class="nnwebEmotionHoverIcon\ComponentHandler\nnwebEmotionHoverIconComponentHandler" public="true">
13+
<tag name="shopware_emotion.component_handler"/>
14+
</service>
15+
</services>
16+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
//{block name="backend/Emotion/app" append}
2+
Ext.define('Shopware.apps.nnwebEmotionHoverIcon.store.HeadlineTagStore', {
3+
extend : 'Ext.data.Store',
4+
fields : [ {
5+
name : 'id',
6+
type : 'integer'
7+
}, {
8+
name : 'name',
9+
type : 'string'
10+
},
11+
{
12+
name : 'value',
13+
type : 'string'
14+
}],
15+
data : [ {
16+
id : 1,
17+
name : "H1",
18+
value : "h1"
19+
}, {
20+
id : 2,
21+
name : "H2",
22+
value : "h2"
23+
}, {
24+
id : 3,
25+
name : "H3",
26+
value : "h3"
27+
}, {
28+
id : 4,
29+
name : "H3",
30+
value : "h3"
31+
}, {
32+
id : 5,
33+
name : "H4",
34+
value : "h4"
35+
}, {
36+
id : 6,
37+
name : "H5",
38+
value : "h5"
39+
}, {
40+
id : 7,
41+
name : "H6",
42+
value : "h6"
43+
}]
44+
});
45+
46+
Ext.define('Shopware.apps.nnwebEmotionHoverIcon.store.LinkTargetStore', {
47+
extend : 'Ext.data.Store',
48+
fields : [ {
49+
name : 'id',
50+
type : 'integer'
51+
}, {
52+
name : 'name',
53+
type : 'string'
54+
},
55+
{
56+
name : 'value',
57+
type : 'string'
58+
}],
59+
data : [ {
60+
id : 1,
61+
name : "Selbes Fenster",
62+
value : "_self"
63+
}, {
64+
id : 2,
65+
name : "Neues Fenster",
66+
value : "_blank"
67+
}]
68+
});
69+
70+
Ext.define('Shopware.apps.nnwebEmotionHoverIcon.store.HintergrundPositionStore', {
71+
extend : 'Ext.data.Store',
72+
fields : [ {
73+
name : 'id',
74+
type : 'integer'
75+
}, {
76+
name : 'name',
77+
type : 'string'
78+
},
79+
{
80+
name : 'value',
81+
type : 'string'
82+
}],
83+
data : [ {
84+
id : 1,
85+
name : "links oben",
86+
value : "left top"
87+
}, {
88+
id : 2,
89+
name : "links mittig",
90+
value : "left center"
91+
}, {
92+
id : 3,
93+
name : "links unten",
94+
value : "left bottom"
95+
}, {
96+
id : 4,
97+
name : "mittig oben",
98+
value : "center top"
99+
}, {
100+
id : 5,
101+
name : "mittig mittig",
102+
value : "center center"
103+
}, {
104+
id : 6,
105+
name : "mittig unten",
106+
value : "center bottom"
107+
}, {
108+
id : 7,
109+
name : "rechts oben",
110+
value : "right top"
111+
}, {
112+
id : 8,
113+
name : "rechts mittig",
114+
value : "right center"
115+
}, {
116+
id : 9,
117+
name : "rechts unten",
118+
value : "right bottom"
119+
}]
120+
});
121+
// {/block}

Resources/views/backend/emotion/nnweb_emotion_hover_icon/view/detail/elements/nnweb_emotion_hover_icon.js

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// {namespace name="backend/emotion/view/components/nnweb_emotion_hover_icon"}
2+
//{block name="emotion_components/backend/nnweb_emotion_hover_icon"}
3+
Ext.define('Shopware.apps.Emotion.view.components.nnwebEmotionHoverIcon', {
4+
5+
extend: 'Shopware.apps.Emotion.view.components.Base',
6+
7+
alias: 'widget.emotion-components-nnweb-emotion-hover_icon',
8+
9+
/**
10+
* The constructor method of each component.
11+
*/
12+
initComponent: function () {
13+
var me = this;
14+
15+
me.callParent(arguments);
16+
}
17+
18+
});
19+
//{/block}

Resources/views/frontend/_public/src/js/nnweb_emotion_hover_icon.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
.transition {
2+
transition:all 0.6s ease;
3+
}
4+
5+
.nnweb_emotion_hover_icon {
6+
display:block;
7+
position:relative;
8+
height:100%;
9+
width:100%;
10+
overflow:hidden;
11+
.transition;
12+
13+
.background-image {
14+
display:block;
15+
position:absolute;
16+
top:0;
17+
left:0;
18+
height:100%;
19+
width:100%;
20+
background-repeat:no-repeat;
21+
background-size:cover;
22+
background-position:center center;
23+
overflow:hidden;
24+
.transition;
25+
}
26+
27+
.wrapper {
28+
display:flex;
29+
flex-direction:column;
30+
justify-content:center;
31+
align-items:stretch;
32+
position:absolute;
33+
height:100%;
34+
width:100%;
35+
top:100%;
36+
left:0;
37+
overflow:hidden;
38+
.transition;
39+
40+
.background-color {
41+
display:block;
42+
position:absolute;
43+
height:100%;
44+
width:100%;
45+
top:0;
46+
left:0;
47+
}
48+
49+
.wrap-icon,
50+
.headline,
51+
p {
52+
display:block;
53+
position:relative;
54+
z-index:1;
55+
color:inherit;
56+
.transition;
57+
text-align:center;
58+
box-sizing:border-box;
59+
padding:.5rem 1rem;
60+
line-height:1.5;
61+
margin:10% 0 0;
62+
.transition;
63+
}
64+
65+
.wrap-icon {
66+
height:25%;
67+
display:flex;
68+
justify-content:center;
69+
align-items:center;
70+
padding-bottom:1rem;
71+
72+
img {
73+
height:100%;
74+
}
75+
}
76+
77+
.headline {
78+
font-size:1.5rem;
79+
}
80+
81+
p {
82+
font-size:1rem;
83+
}
84+
}
85+
86+
&:hover {
87+
88+
.background-image {
89+
top:-50%;
90+
}
91+
92+
.wrapper {
93+
top:0;
94+
95+
96+
.wrap-icon,
97+
.headline,
98+
p {
99+
margin:0;
100+
}
101+
}
102+
}
103+
}
104+
105+
@media @touch {
106+
.transition {
107+
transition:none;
108+
}
109+
110+
.nnweb_emotion_hover_icon {
111+
.transition;
112+
113+
.background-image {
114+
.transition;
115+
}
116+
117+
.wrapper {
118+
box-sizing:border-box;
119+
padding:1rem;
120+
top:0;
121+
.transition;
122+
123+
.background-color {
124+
box-sizing:border-box;
125+
background-clip:content-box;
126+
padding:1rem;
127+
opacity:0.8;
128+
}
129+
130+
.wrap-icon,
131+
.headline,
132+
p {
133+
margin:0;
134+
.transition;
135+
}
136+
}
137+
138+
&:hover {
139+
.background-image {
140+
top:0;
141+
}
142+
}
143+
}
144+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@touch: ~"(max-width:1023px)";
2+
3+
@import "widgets";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "_widgets/nnweb_emotion_hover_icon";

0 commit comments

Comments
 (0)