Custom availability states and legend

mdowsett - September 10, 2008 - 13:08
Project:Availability Calendars
Version:6.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:nicholas.alipaz
Status:active
Description

It'd be nice to be able to set the colors of the statuses in the UI...I had changed it the css file and then upgraded and of course lost those changes.

Great module!

#1

geodaniel - September 10, 2008 - 15:41
Title:customizable in the UI» Custom availability states and legend

I'm planning to make the statuses customisable so you could have more than just available, not available and maybe available. With each of those you could specify a colour, or at least a style to use from a stylesheet (haven't thought that through fully yet).

We'd also build the legend from that list. Going to close #306464: legend and merge it into this one.

#2

nicholas.alipaz - August 1, 2009 - 05:19
Version:5.x-1.x-dev» 6.x-1.x-dev
Assigned to:Anonymous» nicholas.alipaz

Legend has been fixed in 6.x using latest dev, I will not be backporting. Will work on configurable states.

#3

aacraig - November 14, 2009 - 10:15

Where are you on this? This is another job that I need to implement for a client. Since it's a paid job, I can work on this task right away, unless you've got a reason not to.

I would like to tie this into the work I'm proposing to do on #331151: Ability to use javascript to select availability dates? as well.

#4

nicholas.alipaz - November 14, 2009 - 17:09

that would be great if you have time. I have been too busy to look at this.

#5

aacraig - November 19, 2009 - 13:03

Great. I will start working on a patch this week.

#6

aacraig - November 24, 2009 - 09:28

Here's a patch to add customizable labels to Availability Calendars.

If you don't set up custom labels, the default labels are used, as before.

Custom labels can be styled using CSS classes derived from the names of the labels.
You can see the generated style for your label in the administration form, but it is simply str_replace(" ", "-", strtolower($label)).
Ex. "My Label" => "my-label"

Default labels keep the CSS classes they have always had.

A word for production sites that wish to use custom labels.
In your database, you will have days marked as follows:
0 => 'Available'
1 => 'Fully booked'
2 => 'Provisionally booked'

In order to ensure a smooth transition, make your custom label ids match up with your existing data. So, if you want to create a custom label for days marked "Fully Booked", create that label before creating any others. Create the "Provisionally booked" replacement label next. Finally, create the "Available" substitute and set that label as the default.

For fresh installs, you don't need to worry about this.

New requirement
In order to make the interface nice, I have used the AHAH Helper module, so you must download and install that module.

AttachmentSize
availability_calendars_custom_options.patch 17.28 KB

#7

nicholas.alipaz - November 24, 2009 - 17:29

This doesn't seem to be patched against latest dev, any way to correct this? Here are the rejects I got:

File to patch: availability_calendars.info
patching file availability_calendars.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file availability_calendars.info.rej

File to patch: availability_calendars.module
patching file availability_calendars.module
Hunk #1 succeeded at 59 (offset 7 lines).
Hunk #2 succeeded at 377 (offset 13 lines).
Hunk #3 succeeded at 432 (offset 16 lines).
Hunk #4 FAILED at 505.
Hunk #5 succeeded at 588 (offset 20 lines).
Hunk #6 succeeded at 635 (offset 20 lines).
Hunk #7 FAILED at 658.
2 out of 7 hunks FAILED -- saving rejects to file availability_calendars.module.rej

BTW, this is a pretty extensive change, so will certainly require some additional testing before we commit it, but I definitely like the concept.

AttachmentSize
availability_calendars.info.rej_.txt 571 bytes
availability_calendars.module.rej_.txt 3.89 KB

#8

aacraig - November 28, 2009 - 10:09

Sorry about that.

Here's an updated patch.

AttachmentSize
availability_calendars_custom_options.patch 30.24 KB

#9

nicholas.alipaz - November 30, 2009 - 17:27

I will test the patch today, hopefully others will join.

As for the original post:

It'd be nice to be able to set the colors of the statuses in the UI...I had changed it the css file and then upgraded and of course lost those changes.

Great module!

The css issue can be overcome by making a copy of the "offending css" in your theme's stylesheet or other stylesheet not ever being changed on upgrades and changing it there. I don't believe that an interface for this is really warranted, but others please give opinions if you like.

 
 

Drupal is a registered trademark of Dries Buytaert.