#45 Add css classes to indicate the current room_id

open
nobody
None
1
2014-02-07
2014-02-07
Anonymous
No

Hi, it should be very helpful to have classes that indicate the room curretly loaded. It's quite easy to do :

I modified the last version of MRBS (1.4.10) in order to add classes to the BODY element as well as the DIV and TD of the main table.

General view, added to the BODY element :
changing the line 66 in header.inc from the Themes directory :
echo "<body class="\\"room_".$room."" non_js="" ".htmlspecialchars($page)."\\"="">\n";

Specific, in tables. Here is the 'diff' export I made after I modified the functions_table.inc file :

356a357,361
>    // AJOUT - LOCAUX MOTIV' : nom de classe = id de la salle
>    if (isset($cell[$n]['room_id']) & $cell[$n]['room_id']!=='')
>       {
>         $class .= " room_" . $cell[$n]['room_id'];
>       }
416a422,427
>    // AJOUT - LOCAUX MOTIV' : nom de classe = id de la salle
>    if (isset($cell[$n]['room_id']) & $cell[$n]['room_id']!=='')
>       {
>         $class .= " room_" . $cell[$n]['room_id'];
>       }
>
421c432
<       $html .= "<div class=\"celldiv slots1\">\n";     // we want clipping of overflow
---
>       $html .= "<div class=\"celldiv $class_div slots1\">\n";     // we want clipping of overflow
484a496,502
>    // AJOUT - LOCAUX MOTIV' : nom de classe = id de la salle
>    $class_div = '';
>    if (isset($cell[0]['room_id']) & $cell[0]['room_id']!=='')
>       {
>         $class_div = " room_" . $cell[0]['room_id'];
>       }
>
530c548
<         $html .= "<div data-id=\"$id\" class=\"celldiv slots" .
---
>         $html .= "<div data-id=\"$id\" class=\"celldiv $class_div slots" .

(Locaux Motiv' is my structure name)
Nota : I just tested my proposal on a view with one record by TD, not many.

Voila.

I hope that could be helpful and used in the next versions of mrbs.

Cheers

Adrien Lasserre
adrien.lasserre@gmail.com

Discussion

  • Can you explain a little more about how this would be used? I assume you want to apply styling dependent on the room, but I'm wondering how that interacts with the styling by type?

    Could you give an example?

    Campbell

     


Anonymous


Cancel   Add attachments