fix generic
This commit is contained in:
parent
03046dce6b
commit
8458eb0d4f
2 changed files with 20 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<div id="homepage">
|
<div id="homepage">
|
||||||
<div class="tile is-vertical is-ancestor">
|
<div class="tile is-vertical is-ancestor">
|
||||||
<%= render '/tiles/blokmap.*' %>
|
<%= if studytime? then render '/tiles/blokmap.*'end %>
|
||||||
<div class="tile is-parent is-12">
|
<div class="tile is-parent is-12">
|
||||||
<div class="tile is-child box highlighted">
|
<div class="tile is-child box highlighted">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
module TimeHelper
|
module TimeHelper
|
||||||
def christmastime?
|
def christmastime?
|
||||||
Time.now.month == 12
|
timehelper([[Time.new(Time.now.year,12,6),Time.new(Time.now.year,12,31)]])
|
||||||
|
end
|
||||||
|
|
||||||
|
def studytime?
|
||||||
|
year = Time.now.year
|
||||||
|
timehelper([
|
||||||
|
[Time.new(year,12,14), Time.new(year,12,31)],
|
||||||
|
[Time.new(year,1,1), Time.new(year,2,7)],
|
||||||
|
[Time.new(year,5,15), Time.new(year,6,30)],
|
||||||
|
[Time.new(year,8,5), Time.new(year,9,10)],
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
def timehelper(ranges)
|
||||||
|
ranges.any? {|range| periodhelper(*range)}
|
||||||
|
end
|
||||||
|
|
||||||
|
def periodhelper(startdate, enddate)
|
||||||
|
Time.now.between?(startdate, enddate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue