In each different view (be it month/week/day) the colours of stripes vary depending on which particular types are there. I think that there should be more consistency between the different views and stripes should remain the same colour for a particular node type. This means people will not need to keep refering to the key, and can remember for example that red events are ones they are interested in.
I have achieved this by simply setting the stripe id to that of the node type. This then require you to add to the css a style for each type id eg stripe-## for node type ##. This requires simpler code than that which is currently there, but does have a disadvantage that there will be no colours by default.
Comment | File | Size | Author |
---|---|---|---|
#14 | consistent_color_taxonomy_5.x-1.7.patch | 2.6 KB | jefff-1 |
#2 | consistent_color_taxonomy_patch.patch | 3.28 KB | skor |
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedI agree that it would be nice to have a way to set this up so that you can control what things are displayed in what colors. A related issue is the one that requested that the stripe be based on taxonomy instead of node type.
I'm not sure yet how to accomplish this, so it's still outstanding, just wanted to confirm that it's something I'd like to see, too.
Comment #2
skor CreditAttribution: skor commentedHere's a patch against calendar 5.x-1.4 that does two things.
Sorry it blows away the current node-type capability, but it's a decent starting place.
Comment #3
htxt CreditAttribution: htxt commentedThis is just what I needed, thanks :)
Will this patch go into the dev branch?
Comment #4
skor CreditAttribution: skor commentedI doubt this will be incorporated as is. It's a custom solution that works well on our site, but it should really be generalized before it would be included, possibly made an option.
Comment #5
m1mic CreditAttribution: m1mic commentedsubscribing
Comment #6
gmak CreditAttribution: gmak commentedI've been trying a different approach to this, via PHPTemplate theme functions.
I have this:
Which should work, but I'm having one problem. If there is only one taxonomy term (from the given vocabulary) then I can't seem to get a value for $label. If there is more than one taxonomy term, it gets the $label value.
Can anyone suggest the problem as to why I can't get the 'tid' value if there is only one taxonomy term?
Thanks.
Comment #7
gmak CreditAttribution: gmak commentedI found the problem. For anyone interested, this is the working code.
If anyone can improve/streamline this, I'd appreciate your input.
This solution does not require any changes to the CSS (unless you want to change it). Next, I'm going to work on the Legend.
Comment #8
rubenk CreditAttribution: rubenk commentedsubscribing. I too am one of those that would like a taxonomy (and simultaneous node if possible?) based legend.
Comment #9
jiangxijay CreditAttribution: jiangxijay commentedSubscribe
Comment #10
scottrigbyCould this work for the Event calendar, or only the Calendar module?
I would like to use the event calendar because Calendar module has been presenting problems for me (for instance, if you click on the day, it shows a blank table, even if there's an event on that day - whereas this is fine in Event). This isn't exactly the place to compare Event with Calendar.
My main question is if this could be used for the Event Calendar, and if not - is it possible to modify so it could?
Thanks!
Comment #11
gmak CreditAttribution: gmak commentedThe answer to your question is yes and no.
Yes, you can modify the output from the Event module in the same way. Just find the relevant function in the module and modify it in your template.php file (assuming you're using a phptemplate type template). It is fairly trivial, and you can find lots of theming help on the Drupal site.
And, the 'no', is that this code is from the Calendar module and cannot be used directly.
Comment #12
Mike Sances CreditAttribution: Mike Sances commentedto #7, isn't this a problem if you have a term id greater than 10 (or whatever the max stripe number is). In my case I have term id's above 50 so this results in blank colors. I'll try to work around this; otherwise your code is just what I need, thanks!
Comment #13
jjohnsonBLC CreditAttribution: jjohnsonBLC commentedI thought I'd post my solution to this problem, in case it might help anyone.
I changed my theme_calendar_stripe_stripe function in calendar.theme. I deleted everything in it and replaced it with the following:
This works for me because I only need the color stripe/legend on only one page. I can think of two ways to attempt to make this flexible enough to not mess up other calendars: do a check on the page (if this page, then do this switch statement, else...) or, assuming you don't overlap taxonomy terms, have each case cover two options like:
Comment #14
jefff-1 CreditAttribution: jefff-1 commentedThat is what I was looking for. Thanks.
I just edited your patch to work on calendar module version 5.x-1.7
Comment #15
KarenS CreditAttribution: KarenS commentedNone of this will work in Calendar version 5.2 or 6.2 and I'm not adding new features to 5.1. For the new versions I've added the farbtastic color picker to the settings where you can select a color for each item which will give you consistency and an unlimited number of colors. I'm starting it out with only the option to set a color for each content type, but plan to adapt it later so you can set colors for taxonomy terms.
Obviously anyone who wants to can patch the 5.1 code themselves.
Comment #16
KarenS CreditAttribution: KarenS commentedI mean patch their own copies of the 5.1 code.
Comment #17
petertj CreditAttribution: petertj commentedThank you for adding this! It perfectly solved one of the few remaining client complaints on the calendar.
however, is the legend still being worked on? It doesn't display anything... or is that a separate issue?
(PS - I'm running 6.x-2.0-rc1, not the 5.x shown in this topic.)
Comment #18
KarenS CreditAttribution: KarenS commentedThe legend is working for me, you have to add the legend block to your theme and it will only appear on the main calendar page. If there are problems with it, start a separate issue.
Comment #19
agerson CreditAttribution: agerson commentedIs the color by node type a working feature yet? Would love to see this work for Taxonomy colorizing too. Thanks for your hard work.
Adam