Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #428 from bolt/feature/make-weather-widget-work
Make Weather widget work
- Loading branch information
Showing
4 changed files
with
101 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
<div class="card mb-4"> | ||
<div class="image card-img-top" | ||
style="background-image: url(https://source.unsplash.com/400x240/?rain,sun,snow,storm,weather,sunny); height: 200px; padding-top: 60px;"> | ||
<center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4); color: #FFF;'> | ||
<span>Sunny, with occasional clouds</span><br> | ||
<span style="font-size: 200%;"><i class="fas fa-sun"></i> 18 ° C</span><br> | ||
<span>Den Haag, Netherlands</span> | ||
style="background-image: url(https://source.unsplash.com/400x240/?{{ location.city|url_encode }},{{ location.region|url_encode }},{{ location.country|url_encode }}); height: 200px; padding-top: 60px;"> | ||
<center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6); color: #FFF;'> | ||
<span style="font-size: 125%;">{{ weather.weather|first['description']|capitalize }} in {{ weather.name }}, {{ location.country }}</span><br> | ||
<span style="font-size: 200%;"> | ||
<img src='http://openweathermap.org/img/w/{{ weather.weather|first['icon'] }}.png'> | ||
{{ weather.main.temp|number_format(1) }} ° C</span><br> | ||
</center> | ||
</div> | ||
<div class="card-body"> | ||
<a> | ||
<i class="fa fa-socks"></i> | ||
This is a random widget | ||
Current weather, by OpenWeatherMap | ||
</a> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bolt\Tests\Widget; | ||
|
||
use Bolt\Widget\BaseWidget; | ||
use Bolt\Widget\Injector\AdditionalTarget; | ||
use Bolt\Widget\Injector\RequestZone; | ||
use Bolt\Widget\TwigAware; | ||
|
||
class DummyWidget extends BaseWidget implements TwigAware | ||
{ | ||
protected $name = 'Dummy Widget'; | ||
protected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP; | ||
protected $priority = 200; | ||
protected $template = '@bolt/widgets/weather.twig'; | ||
protected $zone = RequestZone::BACKEND; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters