Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
weather
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
weather
Commits
a8218202
Commit
a8218202
authored
Dec 27, 2016
by
Zach Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
weather alerts
parent
d6167b70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
weather/client/main.css
weather/client/main.css
+6
-0
weather/client/views/weather/weather.html
weather/client/views/weather/weather.html
+13
-1
weather/client/views/weather/weather.js
weather/client/views/weather/weather.js
+2
-4
No files found.
weather/client/main.css
View file @
a8218202
...
...
@@ -30,6 +30,12 @@
color
:
#fff
;
}
.alert-card.mdl-card
{
margin
:
auto
;
width
:
auto
;
background
:
#ee1111
;
}
.forecast-grid.mdl-grid
{
}
...
...
weather/client/views/weather/weather.html
View file @
a8218202
<template
name=
"weather"
>
<div
class=
"mdl-grid"
>
{{#if weatherData.alerts.title}}
<div
class=
"mdl-cell mdl-cell--12-col"
>
<div
class=
"alert-card weather-card mdl-card mdl-shadow--4dp"
>
<div
class=
"mdl-card__title"
>
<h1
class=
"mdl-card__title-text"
><a
href=
"{{weatherData.alerts.url}}"
>
{{weatherData.alerts.title}}
</a>
until {{formatTimestamp weatherData.alerts.expires}}
<br
/></h1>
</div>
<div
class=
"mdl-card__supporting-text"
>
{{waatherData.alerts.description}}
</div>
</div>
</div>
{{/if}}
<div
class=
"mdl-cell mdl-cell--12-col"
>
<div
class=
"weather-card mdl-card mdl-shadow--4dp"
>
<div
class=
"mdl-card__title"
>
...
...
@@ -13,7 +25,7 @@
</div>
<div
class=
"detail-size"
>
Feels like {{roundNumber weatherData.data.currently.apparentTemperature}}
<i
class=
"wi wi-fahrenheit"
></i>
<br
/><br
/><i
class=
"wi wi-{{precipitationIcons
}}"
></i>
{{precipitationWords
}}
<i
class=
"wi wi-wind wi-towards-{{windDirectionClass}}"
></i>
{{roundNumber weatherData.data.currently.windSpeed}}mph {{windDirection}}
<br
/><br
/><i
class=
"wi wi-{{precipitationIcons
weatherData.data.currently.precipProbability}}"
></i>
{{precipitationWords weatherData.data.currently.precipProbability
}}
<i
class=
"wi wi-wind wi-towards-{{windDirectionClass}}"
></i>
{{roundNumber weatherData.data.currently.windSpeed}}mph {{windDirection}}
<!-- TODO: Change the icon based on time -->
<br
/><br
/><i
class=
"wi wi-sunset"
></i>
{{formatTimestamp weatherData.data.currently.time}}
</div>
...
...
weather/client/views/weather/weather.js
View file @
a8218202
...
...
@@ -5,10 +5,9 @@ Template.weather.helpers({
return
weatherData
;
},
//Convert precipitation percentage to words
precipitationWords
:
function
()
{
precipitationWords
:
function
(
precipProb
)
{
weatherDataDependency
.
depend
();
if
(
weatherData
===
undefined
)
return
"
...
"
;
var
precipProb
=
weatherData
.
data
.
currently
.
precipProbability
;
if
(
precipProb
===
0
)
return
"
No Rain Expected
"
;
if
(
precipProb
>
50
&&
precipProb
<
95
)
return
"
Potential for Rain
"
;
if
(
precipProb
>
95
)
return
"
Bring an Umbrella
"
;
...
...
@@ -16,10 +15,9 @@ Template.weather.helpers({
return
precipProb
+
"
% Precipitation
"
;
// Otherwise, return the percentage
},
//Convert precipitation percentage to icons
precipitationIcons
:
function
()
{
precipitationIcons
:
function
(
precipProb
)
{
weatherDataDependency
.
depend
();
if
(
weatherData
===
undefined
)
return
"
...
"
;
var
precipProb
=
weatherData
.
data
.
currently
.
precipProbability
;
if
(
precipProb
===
0
)
return
"
cloud
"
;
if
(
precipProb
>
50
&&
precipProb
<
95
)
return
"
showers
"
;
if
(
precipProb
>
95
)
return
"
umbrella
"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment