How to customize the Toolbar

Permalink
I've tried searching for some related posts but found nothing. Is there a way to edit the items that display in the toolbar in 5.5? Like the Dashboard button, can I add other buttons? It would be nice to add shortcuts for page editors so they dont have to nose-around the actual dashboard.

Specifically, adding a direct link to Composer would be nice. Yes, I know it isn't hard to get there, but I have very "simple" clients who like things as simple as possible.

Any ideas?

 
kokomodrums replied on at Permalink Reply
bump
mkly replied on at Permalink Reply
mkly
Yes. Write some javascript(jQuery) to append an li to #ccm-main-nav.

Typically I would have just written you a quick code snippet, but since you bumped I'm just going to leave it at that. I'm not personally a big fan of the types of people who bump in forums.
kokomodrums replied on at Permalink Reply
Hey, that's a great start anyways. Sorry for the impatience, I just thought if I hadn't got at least one response within a week, it must have gotten lost in the tides.

Thanks for the start!

[Edit] Related question: jQuery is included with C5, right? So I could use jQuery code without having to include the library manually?
NBardales replied on at Permalink Reply
NBardales
Yes, it's included, you don't have to include a link to the jQuery library
kokomodrums replied on at Permalink Reply
Ok here is what I did. I added this code:

<script>
$('#ccm-main-nav').append('<li><a href="/concrete/index.php/dashboard/composer/write/">New Post</a></li>');
</script>


first, to my custom theme's header.php file. No luck. Then tried the theme's page type file. No luck again.

Maybe my code is wrong, maybe putting it in the wrong place...

Any ideas?
mkly replied on at Permalink Reply
mkly
<script>
$(function() {
  $('#ccm-main-nav').append('<li><a href="/concrete/index.php/dashboard/composer/write/">New Post</a></li>');
});
</script>


Maybe try that? I think there might be a situation where the nav bar is created with javascript and if you append before it gets created you run into trouble. I'll look and see if there is a event to attach that to.
kokomodrums replied on at Permalink Reply
Ok--where should I put it exactly?
Sadu replied on at Permalink Reply
Sadu
I found this works as a way of forcing the code to run after the nav has been created...
<script>
$(document).bind("ready", function () {
  $('#ccm-main-nav').append('<li><a href="/concrete/index.php/dashboard/composer/write/">New Post</a></li>');
});
</script>
jhon replied on at Permalink Reply
Thanks dude! This works for me!
matchmate replied on at Permalink Reply
I have the same questions , please BARE with me I am newbi.

Thanks
kokomodrums replied on at Permalink Best Answer Reply
I figured out a "work-around". This method doesn't add a link to the toolbar, it uses js to show/hide a new link and stick it on "top" of the toolbar. Fairly easy to implement, here is how I did it:

- First, you need to add a link to the composer somewhere in your document. I put it in my themes's header.php right after the <body> tag

<a href="/{YOUR_CONCRETE_DIRECTORY}/index.php/dashboard/composer/write/"><div id="c5composerlink">New Post</div></a>


- Now, because you only want this link to be shown when someone who can add content is logged in, you need to add this to your main.css file

#c5composerlink {display:none;}


- Ok, now the link is on the page but it is not being displayed at all. So you need to create some js code that will display the link only if someone who can add content is logged in. So add this code in your theme's header.php. I put it in the <head> element before the <script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<?php Loader::element('header_required'); ?>

<?php
$cp = new Permissions($c);
if($cp->canAdmin() && $cp->canAddSubContent()){
echo '
<style type="text/css">
<!--
#c5composerlink {
/*** Necessary code ***/   
   display:block;
   position:fixed;
   top:0;
   left:40%;
   z-index:101; /*** C5s toolbars z-index is 100 ***/
/*** Just for style ***/
   width:130px;


Of course you can modify this many different ways. I thought about putting the link somewhere else on the page in case it ever covers up something on the toolbar I don't know about yet. You could put the link right under the toolbar (actually on the page, above the header).

If anyone sees any problems this could cause, or better ways of implementing, feel free to let me know!