Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem:
We need to show annual holidays on our calendar without creating a bunch of nodes.
Suggestion:
A single line of code would add a class to each td of the calendar, which could be very flexibly targeted with css.
Examples:
1. to target a single day:
.calendar-calendar td.Jan-12 {}
2. to target a single day only on a mini-calendar view:
.calendar-calendar td.mini.Jan-12 {}
3. to target the fourth Thursday in a month would be more difficult but still possible:
td.Nov-22.thu, td.Nov-23.thu, td.Nov-24.thu, td.Nov-25.thu, td.Nov-26.thu, td.Nov-27.thu, td.Nov-28.thu {}
Comment | File | Size | Author |
---|---|---|---|
#3 | us_holidays.tgz | 14.8 KB | dnotes |
#2 | 679496_css_classes_per_day_oneline.patch | 732 bytes | dnotes |
#1 | 679496_css_classes_per_day.patch | 673 bytes | dnotes |
calendar.inc_classes_per_day.patch | 946 bytes | dnotes | |
Comments
Comment #1
dnotes CreditAttribution: dnotes commentedWell, half a year later I realize that my patch was made from the wrong folder and wouldn't apply with drush make... chagrin. Here's one that should.
Comment #2
dnotes CreditAttribution: dnotes commentedI realized today that the author's intention was to use lowercase css, so I've re-rolled. This has the added benefit of being less than one line of change, so there's no chance of messing up other patches along the way.
Comment #3
dnotes CreditAttribution: dnotes commentedIf you'd like a sample of what this allows one to do with CSS, this folder should give you all the US national holidays. I didn't spend much time on it, and it's not that pretty, but it'll give you an idea.
Comment #4
jessico CreditAttribution: jessico commentedDoes anyone have a similar update for Drupal 7? Thank you for your time!
Comment #5
buddakid CreditAttribution: buddakid commentedI need to add holidays to Pretty Calendar that is used for employment purpose. Content Type is void with Pretty Calendar. Since a few of the designated holidays are year by year case, it would be better to add a class to each cell of the calendar, which could be very flexibly targeted with css. It will allow me to modify the holidays year to year. Idially, there is a background image shown, or font color changed on a holiday. (standard.css)
The code on this page is for the Standard Calendar which is different from that of the Pretty Calendar. http://drupal.org/node/679496#comment-6669698
My guess is to add lines in between this portion, but I'm not sure how to do that.:
Can someone give me a hand, with the css too? Thanks.
Comment #6
buddakid CreditAttribution: buddakid commentedOop. I thought I would have opened a new issue, not under an old issue. I'm sorry I mess it up. Can admin delete this one for me? I'm going to try opening a new thread. Thanks.
Comment #7
buddakid CreditAttribution: buddakid commentedHere I change back the issue title. Sorry for the mess. I'm not familiar with posting.
Comment #8
apadernoI am closing this issue, since it's for a Drupal version no longer supported.