This is Dashing widget to display countdown to next free day like weekend or bank holiday. It works similarly to Clock with time refreshed every 0.5 seconds.
##Usage
The widget uses Holidays gem and JQuery JPlayer for sound notifications. Put it to /assets/javascripts/jplayer
directory.
Put the freeday_countdown.rb
file in your /jobs
folder, freeday_countdown_settings.json
to /assets/config
. Put freeday_countdown.coffee
, freeday_countdown.html
and freeday_countdown.scss
to /widgets/freeday_countdown
.
Make sure directory /assets/config
and /assets/sounds
is accessible by Dashing user.
To include the widget in a dashboard, add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="freeday_countdown_lt" data-view="FreedayCountdown" data-sound="/assets/sounds/Rudimental-Home.mp3"></div>
<i class="icon-time icon-background"></i>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="freeday_countdown_gb" data-view="FreedayCountdown" data-sound="nosound" data-time-offset="2"></div>
<i class="icon-time icon-background"></i>
</li>
Widget ID should start with freeday_countdown_
. Region ID from settings file is appended.
##Settings
Amend /assets/config/freeday_countdown_settings.json
to set workday start and end, lunch duration accordingly to your region.
Put sound file you like to /assets/sounds
and use it in widget data-sound
attribute value or amend @handleSound CoffeeScript function to use it. I'm using /assets/sounds/Rudimental-Home.mp3
in my example. If you do not wish to hear any sound, specify nosound
. I did not try that, but specifying any other URL, e.g. Youtube, should work as well.
If different time zone region widgets are used, specify data-time-offset
, to make base point of time calculations the same.
There is no need to restart service if job is already running and settings file is amended.