Skip to content

Commit

Permalink
Updates to index weather record snapshots. Monthly AJAX enable
Browse files Browse the repository at this point in the history
Updates #104 for some new keys

Updates #65 - still not sure how to make this space dynamic but at least this commit removes UV which not everyone has.
  • Loading branch information
poblabs committed May 28, 2019
1 parent d640f56 commit 9be342b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 48 deletions.
86 changes: 41 additions & 45 deletions skins/Belchertown/index.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -386,61 +386,57 @@

<!-- Start of third row -->
<div class="row eq-stats-row">
<!-- Station history -->
#if $Extras.has_key('earthquake_enabled') and $Extras.earthquake_enabled == '1'
<div class="col-sm-9 stn-quick-stats">
#else
<div class="col-sm-12 stn-quick-stats">
#end if

<!-- Quick today stats -->
<!-- Today Snapshot Stats -->
<div class="row">
<div class="row">
<div class="snapshot-records-text">
$obs.label.weather_snapshots <a href="records">$obs.label.weather_snapshots_link</a>
</div>

<div class="col-sm-6 stn-quick-stats">
<div class="stats-title">
<span class="snapshot-records-today-header"></span><!-- JS and AJAX -->
</div>
<table>
<tr>
<td><b>$obs.label.snapshot_high:</b></td> <td><span class="dailystatshigh">$day.outTemp.max</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_low:</b></td> <td><span class="dailystatslow">$day.outTemp.min</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_today_high_wind:</b></td> <td><span class="dailystatswind">$day.wind.max</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_today_high_uv:</b></td> <td><span class="dailystatsuv">$day.UV.max</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_today_rain:</b></td> <td><span class="dailystatsrain">$day.rain.sum</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_today_rainrate:</b></td> <td><span class="dailystatsrainrate">$day.rainRate.max</span></td><!-- AJAX -->
</tr>
</table>
<div class="snapshot-records-text">
$obs.label.weather_snapshots <a href="records">$obs.label.weather_snapshots_link</a>
</div>

<div class="col-sm-6 stn-quick-stats">
<div class="stats-title">
<span class="snapshot-records-today-header"></span><!-- JS and AJAX -->
</div>
<table>
<tr>
<td><b>$obs.label.snapshot_high:</b></td> <td><span class="dailystatshigh">$day.outTemp.max</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_low:</b></td> <td><span class="dailystatslow">$day.outTemp.min</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_today_avg_wind:</b></td> <td><span class="dailystatswindavg">$day.wind.avg</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_today_high_wind:</b></td> <td><span class="dailystatswindmax">$day.wind.max</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_today_rain:</b></td> <td><span class="dailystatsrain">$day.rain.sum</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_today_rainrate:</b></td> <td><span class="dailystatsrainrate">$day.rainRate.max</span></td><!-- AJAX -->
</tr>
</table>
</div>


<!-- Quick this month stats -->
<div class="col-sm-6 stn-quick-stats border-left">
<div class="stats-title">
<span class="snapshot-records-month-header">$current.dateTime.format("%B %Y")</span><!-- AJAX -->
</div>
<table>
<tr>
<td><b>$obs.label.snapshot_high:</b></td> <td>$month.outTemp.max</td>
<td><b>$obs.label.snapshot_low:</b></td> <td>$month.outTemp.min</td>
</tr>
<tr>
<td><b>$obs.label.snapshot_month_high_wind:</b></td> <td>$month.wind.max</td>
<td><b>$obs.label.snapshot_month_high_uv:</b></td> <td>$month.UV.max</td>
</tr>
<tr>
<td><b>$obs.label.snapshot_month_rain:</b></td> <td>$month.rain.sum</td>
<td><b>$obs.label.snapshot_month_rainrate:</b></td> <td>$month.rainRate.max</td>
</tr>
</table>
<!-- This Month Snapshot Stats -->
<div class="col-sm-6 stn-quick-stats border-left">
<div class="stats-title">
<span class="snapshot-records-month-header"></span><!-- JS and AJAX -->
</div>
<table>
<tr>
<td><b>$obs.label.snapshot_high:</b></td> <td><span class="monthstatshigh">$month.outTemp.max</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_low:</b></td> <td><span class="monthstatslow">$month.outTemp.min</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_month_avg_wind:</b></td> <td><span class="monthstatswindavg">$month.wind.avg</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_month_high_wind:</b></td> <td><span class="monthstatswindmax">$month.wind.max</span></td><!-- AJAX -->
</tr>
<tr>
<td><b>$obs.label.snapshot_month_rain:</b></td> <td><span class="monthstatsrain">$month.rain.sum</span></td><!-- AJAX -->
<td><b>$obs.label.snapshot_month_rainrate:</b></td> <td><span class="monthstatsrainrate">$month.rainRate.max</span></td><!-- AJAX -->
</tr>
</table>
</div>
</div>
</div>
Expand Down
14 changes: 11 additions & 3 deletions skins/Belchertown/js/belchertown.js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,24 @@ function update_weewx_data( data ) {
// Daily max gust span
jQuery(".dailymaxgust").html( parseFloat( data["day"]["wind"]["max"] ).toFixed(1) );

// Daily stats section
// Daily Snapshot Stats Section
jQuery(".snapshot-records-today-header").html( moment.unix( data["current"]["epoch"] ).format( '$obs.label.time_snapshot_records_today_header' ) );
jQuery(".snapshot-records-month-header").html( moment.unix( data["current"]["epoch"] ).format( '$obs.label.time_snapshot_records_month_header' ) );
jQuery(".dailystatshigh").html( data["day"]["outTemp"]["max"] );
jQuery(".dailystatslow").html( data["day"]["outTemp"]["min"] );
jQuery(".dailystatswind").html( data["day"]["wind"]["max"] );
jQuery(".dailystatsuv").html( data["day"]["uv"]["max"] );
jQuery(".dailystatswindavg").html( data["day"]["wind"]["average"] );
jQuery(".dailystatswindmax").html( data["day"]["wind"]["max"] );
jQuery(".dailystatsrain").html( data["day"]["rain"]["sum"] );
jQuery(".dailystatsrainrate").html( data["day"]["rain"]["max"] );

// Month Snapshot Stats Section
jQuery(".monthstatshigh").html( data["month"]["outTemp"]["max"] );
jQuery(".monthstatslow").html( data["month"]["outTemp"]["min"] );
jQuery(".monthstatswindavg").html( data["month"]["wind"]["average"] );
jQuery(".monthstatswindmax").html( data["month"]["wind"]["max"] );
jQuery(".monthstatsrain").html( data["month"]["rain"]["sum"] );
jQuery(".monthstatsrainrate").html( data["month"]["rain"]["max"] );

// Sunrise and Sunset
jQuery(".sunrise-value").html( moment.unix( parseFloat(data["almanac"]["sunrise_epoch"]).toFixed(0) ).utcOffset($moment_js_utc_offset).format( "$obs.label.time_sunrise" ) );
jQuery(".sunset-value").html( moment.unix( parseFloat(data["almanac"]["sunset_epoch"]).toFixed(0) ).utcOffset($moment_js_utc_offset).format( "$obs.label.time_sunset" ) );
Expand Down
2 changes: 2 additions & 0 deletions skins/Belchertown/skin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@
weather_snapshots_link = View all weather records here.
snapshot_high = High
snapshot_low = Low
snapshot_today_avg_wind = Average Wind
snapshot_today_high_wind = Highest Wind
snapshot_today_high_uv = Highest UV
snapshot_today_rain = Today's Rain
snapshot_today_rainrate = Highest Rate
snapshot_month_avg_wind = Average Wind
snapshot_month_high_wind = Highest Wind
snapshot_month_high_uv = Highest UV
snapshot_month_rain = Total Rain
Expand Down

0 comments on commit 9be342b

Please sign in to comment.