CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • General Discussion (please no support requests here!) (Moderator: Michał Mach) »
  • CiviCRM Admin Theme Tips & Tricks
Pages: [1]

Author Topic: CiviCRM Admin Theme Tips & Tricks  (Read 9574 times)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
CiviCRM Admin Theme Tips & Tricks
May 13, 2010, 10:58:29 am
After struggling with the question of how to impliment a civicrm admin theme, I've finally found a solution that works perfectly for me, so I wanted to share it.  Feel free to post here and add your own ideas.

The problem is that there's no way for drupal to "know" that you are on a civi admin page (as opposed to a civi front-end page like an event registration).

Since my use-case doesn't require an entirely new theme, but only a few modifications to the regular theme, I was able to solve this problem using pure CSS:  The trick is to use the adjacent sibling (+) selector to determine whether or not the civicrm admin menu is present:

Code: [Select]
  #civicrm-menu+#page {
margin-top:23px;  /*add space for civi menubar*/
position:relative;  /*makes all absolutely-positioned elements in page shift down too*/
background:white;  /*get rid of our background pattern, we're all business on this page*/
        }

#civicrm-menu+#page #header { /*only affects header when civi menu is present*/
height:100px; /*make it smaller than normal*/
}

       #civicrm-menu+#page anyelement {  /*you can change any element on the page when civi menu is present*/
       dosomething;
       }

Try asking your question on the new CiviCRM help site.

Andrew Perry

  • I post occasionally
  • **
  • Posts: 98
  • Karma: 1
  • Building empowering tools that comply with rules
    • Community Builders Australia
  • CiviCRM version: 3.x, 4.x
  • CMS version: Joomla 1.0.x, 1.5.x -> Drupal 6.x, 7.x, WordPress
  • MySQL version: 5.1, 5.5, 5.6
  • PHP version: 5.2, 5.3, 5.4
Re: CiviCRM Admin Theme Tips & Tricks
December 06, 2010, 06:12:37 pm
Although you may have already found it, or it may not be required for your implementation, there is a great module called civicrm_theme that lets you specify the front end and administration CiviCRM themes to use.

Often the front end theme will be the same as for the rest of the site, but if you want to try something special for CiviCRM administration like rayogram's http://www.rayogram.com/simplycivi, then you'll want to use the http://drupal.org/project/civicrm_theme drupal module.
Community Builders Australia Pty Ltd
www.communitybuilders.com.au

planigan

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
    • Allegheny CleanWays
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 6.24
  • MySQL version: 5.0.90
  • PHP version: 5.2.13
Re: CiviCRM Admin Theme Tips & Tricks
February 13, 2011, 10:27:21 pm
That is a great CSS tip!

Cyberflyer

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 2
  • It's a piece of cake, Ezra!!
    • North Star Community Foundation
  • CiviCRM version: 4.5.6
  • CMS version: Drupal 7.34 / Commons 7.x-3.20
  • MySQL version: 5.5.13
  • PHP version: 5.4.38
Re: CiviCRM Admin Theme Tips & Tricks
August 21, 2012, 03:34:22 pm
I am running Drupal Commons and using a version of the Fusion Theme  (Commons Origins)

The #page Div is not adjacent to the #civicrm-menu UL.  There are two divs between them.

So the adjacent selector does not work.

I tried chaining them through the intermediate divs, but that still did not work.

Any thoughts on how I get the page to move down 27 pixels to allow for the menu?

Is there a javascript that does this kind of thing that is not being used?

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: CiviCRM Admin Theme Tips & Tricks
August 22, 2012, 02:25:59 pm
If they are siblings, just keep using the sibling selector so

#civicrm-menu + div#something + div#another + #page

If they are parents of the #page, then just target the parent

But really, this suggestion was pre-civicrm_theme module - I think that's the recommended solution now.
Try asking your question on the new CiviCRM help site.

Cyberflyer

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 2
  • It's a piece of cake, Ezra!!
    • North Star Community Foundation
  • CiviCRM version: 4.5.6
  • CMS version: Drupal 7.34 / Commons 7.x-3.20
  • MySQL version: 5.5.13
  • PHP version: 5.4.38
Re: CiviCRM Admin Theme Tips & Tricks
August 24, 2012, 10:12:31 pm
I tried chaining them as you suggested and it did not work, although I did not put the element, just the class names.

In any event, I hacked around in the CSS and made a place for it in the normal theme by moving everything down.

Now it just appears in the unused space in the header above the logo.  Not the best, perhaps, but I don't want to hack any more on this, as there are more difficult and important problems getting CiviCRM to work with Drupal Commons.

Thanks for the time of the reply.  Might help others.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • General Discussion (please no support requests here!) (Moderator: Michał Mach) »
  • CiviCRM Admin Theme Tips & Tricks

This forum was archived on 2017-11-26.