Posted by Junro on March 22, 2009 at 9:45pm
5 followers
Jump to:
| Project: | User Relationships |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | alex.k |
| Status: | closed (fixed) |
Issue Summary
Hello, I can't fing how to change the css of the user relationship list page.
I don't have any CSS files in the module.
I tried:
.user-relationship-list {
width: 90%;
border: 2px solid #2E2EFE;
}
.user-relationship table {
width: 90%;
border: 2px solid #2E2EFE;
}
but no effect.
I think the table has currently no id or class, so we can't customize the user relationship list page. But maybe I'm wrong...
Any king of help will be welcome ^^
Comments
#1
Are you using the Firefox Web Developer module? With it you can identify the precise class being used by user-relationships to style what you want to change. Once you find the style, add it to the local.css file in your default theme folder. It will override the style being used by User Relationships.
I've been doing a lot of this very thing for the past couple of weeks and it works like a charm.
Good luck!
#2
Sure i'm using Firefox Web Developer module, I can find ID or Class for blocks I think, but not for the user relationship list page (.../relationships).
I'm pretty sure there is no ID or Class for the table in this page.
Maybe I miss something...
#3
My implementation looks like yours. There's no class or id on the relationships list table.
It is wrapped in a div "content-content", but adding a new class "#content-content table" will ultimately impact every table that appears in the main body of your site. If you don't want to use that, you'll probably have to find the module code that generates your table and make the adjustment there. It's not the best of options, but because without the class/id I'm thinking you're sort of stuck...
Maybe someone else has a better idea...
#4
ok thanks ^^
This is simple, it was exactly the same problem with Privatemsg
see Per thread/Multiple thread actions or How to change Message list CSS?
It will be cool that user-relationship mantainers made a patch like privatemsg mantainers have made. :)
#5
The relationships page and table is displayed via the Drupal template file that is located in the User Relationships module directory:
user_relationships/user_relationships_ui/templates/user_relationships.tpl.php
The proper way to customize this page is to copy this template file to your theme directory and apply any changes you want. Since you will have a copy of the template file in your template directory it will override the default template that is in the User Relationships module directory.
So if for example you wanted to add a CSS class to the table generated by the default template you would change:
printtheme('table', array(), $rows) .
theme('pager', NULL, $relationships_per_page);
to
printtheme('table', array(), $rows, array('class' => 'table-css-class', 'id' => 'table-css-id')) .
theme('pager', NULL, $relationships_per_page);
The above class and id names are just examples of course.
See http://api.drupal.org/api/function/theme_table/6 for more details on how you would add additional HTML attributes such as class or id to the table, table rows, table cells, etc.
See http://drupal.org/node/341628 for more details about the Drupal theming system especially how to override default templates.
#6
Thanks @jaydub for detailed instructions. To help this particular case I did add classes to these tables, as it seems something that many themers can use. The changeset has been committed to CVS. Tables listing My relationships (all and of a particular type) will get a class user-relationships-listing-table, and table listing pending relationship requests gets a class user-relationships-pending-listing-table.
If you make changes that add other useful classes, please post them as a patch so we can look at integrating them into the module for everyone else to benefit.
#7
Thanks, very well explain! :)
#8
Automatically closed -- issue fixed for 2 weeks with no activity.