Last active
August 29, 2015 13:56
-
-
Save amiel/9282930 to your computer and use it in GitHub Desktop.
HTMLCalendar date presenter example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCustomDatePresenter < HTMLCalendar::DatePresenter | |
# Available methods: `date` and `template` | |
# The only required method | |
def html_classes | |
if monday? | |
['a-case-of-the-mundays'] | |
else | |
[] | |
end | |
end | |
private | |
def monday? | |
date.wday == 1 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section> | |
<%= html_calendar Date.current, presenter: MyCustomDatePresenter %> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment