Skip to content

Commit

Permalink
Don't highlight days not in current month
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Jul 26, 2023
1 parent 3924320 commit 568e1cb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/helpers/podcast_planner_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,22 @@ def date_is_in_month?(date, month)

def calendar_day_tag(day:, month:, calendar:, &block)
data = {}
cls = []

if date_is_in_month?(day, month)
data[:controller] = DATE_CONTROLLER
data[:action] = [TOGGLE_ACTION, RECOUNT_ACTION].join(" ")
end

is_new = date_is_in_dates?(day, @planner.dates)
is_existing = date_is_in_dates?(day, @draft_dates)
cls =
is_new = date_is_in_dates?(day, @planner.dates)
is_existing = date_is_in_dates?(day, @draft_dates)
if is_new && is_existing
["bg-danger", "text-light"]
cls = ["bg-danger", "text-light"]
elsif is_new
["bg-primary", "text-light"]
cls = ["bg-primary", "text-light"]
elsif is_existing
["bg-warning"]
else
[]
cls = ["bg-warning"]
end
end

content_tag(:td, class: calendar.td_classes_for(day) + cls, data: data) do
block.call
Expand Down

0 comments on commit 568e1cb

Please sign in to comment.