forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlazyframe-make-weather-page.diff
63 lines (62 loc) · 2.11 KB
/
lazyframe-make-weather-page.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff --git a/src/Controller/WeatherController.php b/src/Controller/WeatherController.php
new file mode 100644
index 0000000..91c5195
--- /dev/null
+++ b/src/Controller/WeatherController.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\Routing\Annotation\Route;
+
+class WeatherController extends AbstractController
+{
+ /**
+ * @Route("/weather", name="app_weather")
+ */
+ public function weather()
+ {
+ return $this->render('weather/index.html.twig');
+ }
+}
diff --git a/templates/base.html.twig b/templates/base.html.twig
index f0baa21..15f533b 100644
--- a/templates/base.html.twig
+++ b/templates/base.html.twig
@@ -28,6 +28,11 @@
</a>
<ul class="navbar-nav">
+ <li class="nav-item">
+ <a class="nav-link" href="{{ path('app_weather') }}">
+ <span class="fas fa-sun"></span>
+ </a>
+ </li>
<li class="nav-item">
<a class="nav-link" href="{{ path('app_cart') }}">
Shopping Cart ({{ count_cart_items() }})
diff --git a/templates/weather/index.html.twig b/templates/weather/index.html.twig
new file mode 100644
index 0000000..99a3a67
--- /dev/null
+++ b/templates/weather/index.html.twig
@@ -0,0 +1,18 @@
+{% extends 'base.html.twig' %}
+
+{% block body %}
+ <h1>The Weather!</h1>
+
+ <a class="weatherwidget-io" href="https://forecast7.com/en/40d71n74d01/new-york/" data-label_1="NEW YORK" data-label_2="WEATHER" data-theme="original" >NEW YORK WEATHER</a>
+ <script>
+ !function (d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (!d.getElementById(id)) {
+ js = d.createElement(s);
+ js.id = id;
+ js.src = 'https://weatherwidget.io/js/widget.min.js';
+ fjs.parentNode.insertBefore(js, fjs);
+ }
+ }(document, 'script', 'weatherwidget-io-js');
+ </script>
+{% endblock %}