News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Childboards as Dropdown

Started by Matthew K., March 12, 2009, 01:04:02 PM

Previous topic - Next topic

SgtMic

I thought it was use one or the other. LOL
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Rumbaar

All you need to do with the code already inserted by the mod is:

Find:
<select name="jumpto" id="jumpto" onchange="if (this.selectedIndex >
Replace
<select class="child_drop" name="jumpto" id="jumpto" onchange="if (this.selectedIndex >
Insert into themes style.css (adjust color and settings to match your themes current 'select' style):
select.child_drop
{
   font-size: 90%;
   font-weight: normal;
   color: green;
   background-color: yellow;
   font-family: verdana, sans-serif;
}


Save it all, fresh the page (making sure to get the new style.css ctrl+F5) and it should be yellow text with green background.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Kreator

Thank you very very much its working now ... though its yellow background with Green text!!

Rumbaar

:) well you can change the style information to your needs.  I'm sure the green isn't the same as you want either.  You can use the #000000 numbers there.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

SgtMic

Hey!! It works. LOL

Thanks Rumbaar.
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

mgrmgr

Thanks for this mod - a nice thing to have.

I read you are trying to make it board dependant - that would help me a lot. Just keep us posted.

Another problem I have: what about "third level" child boards? like

board 1
  sub bord 1.1
  sub board 1.2 (up to here it's ok)
    sub board 1.2.1
    sub board 1.2.2
    sub board 1.2.3

in this case there should also be a drop down list visible in sub board 1.2 - alas the "sub sub boards 1.2.1 - 1.2.3 are displayed "normal" :(

Rumbaar

Yes as a mentioned, I wanted to have it in the MessageIndex.template.php that would affect those sub-child boards.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

mgrmgr

Thank you - that is an incentive to wait for that version :)

C4G-TK

#68
This is a really cool mod.  I'm really liking the things that I have for RC1 in Default.  Unfortunately, there is one little change to the code already from another mod.  I'm using the Colorize Boards mod and I'm wondering how I can use your mod, but allow it to pull the color I assigned to certain child boards from that mod?

In the code that I am supposed to find in your mod, there is one small edit in there which I'm guessing allows this:

Quote
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . $child['topics'] . ', ' . $txt['posts'] . ': ' . $child['posts'] . ')" style="color: '.$child['bcolor']. ';">' . $child['name'] . '</a>';

Is it possible to put this bold edit into your replace code? 

If so, where would I do that?

-img removed-

Rumbaar

You can't, to the best of my knowledge, assign inline style information to select (dropdown) HTML code.  This was the reason I had to use the (New) indicator than say a bolding of the name to indicate new post within a child board.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

C4G-TK

Cool deal.

I have it installed right now and was trying to fool with it a little. 
(Which means I was having fun changing things around blindly watching parse errors on the screen! LOL)

Your mod itself is working fine without me messing with it.   ;D

-img removed-

Rumbaar

I'm not sure if a class could be assigned to each OPTION field and then that could be used to control it's appearance.  I know the whole box can be altered.  I might look into that as well.

Quote from: mgrmgr on March 29, 2009, 08:24:08 AM
Thank you - that is an incentive to wait for that version :)
I wouldn't wait, I'm sure if and when I do it.  it will be easy enough to upgrade to that version.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Tien

How do I change the size of the dropdown box? Or is there anyway that I can set a specific length or size for the dropdown box?

Rumbaar

Try taking a look at the w3schools entry on the SELECT HTML attribute:
http://www.w3schools.com/TAGS/tag_Select.asp

You can possible assign a class and alter the size and attributes of the drop-down box.  I think as for length it's auto sizes to the largest entry.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

C4G-TK

#74
Quote from: C4G-TK on March 29, 2009, 02:02:50 PM
This is a really cool mod.  I'm really liking the things that I have for RC1 in Default.  Unfortunately, there is one little change to the code already from another mod.  I'm using the Colorize Boards mod and I'm wondering how I can use your mod, but allow it to pull the color I assigned to certain child boards from that mod?

In the code that I am supposed to find in your mod, there is one small edit in there which I'm guessing allows this:

Quote
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . $child['topics'] . ', ' . $txt['posts'] . ': ' . $child['posts'] . ')" style="color: '.$child['bcolor']. ';">' . $child['name'] . '</a>';

Is it possible to put this bold edit into your replace code? 

If so, where would I do that?

Quote from: Rumbaar on March 29, 2009, 05:37:39 PM
You can't, to the best of my knowledge, assign inline style information to select (dropdown) HTML code.  This was the reason I had to use the (New) indicator than say a bolding of the name to indicate new post within a child board.

Actually, this has been bothering me because I wanted the Child Boards in the dropdown to show the color that I assigned them and the way they were displayed as if they were a link.  It can be done.

The bolded section from my above quote is from the Colorize Boards modification and what you need to do is add it four times to your code in order for it to display the colors inside the dropdown.

I tried it in firefox and IE7 and it worked correctly.  For those of you who want to use this mod PLUS the colorize boards mod and have the color display on the boardindex correctly and not just as black text, do this:

add the bolded sections to Rumbaar's code here:
Quote
// Populate the dropdown with child boards
               foreach ($board['children'] as $child)
               {
                  // Has it posts awaiting approval?
                  if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']) && $child['new'])
               echo '
                     <option value="?board=', $child['id'], '.0" style="color: '.$child['bcolor']. ';">' , $child['name'] , ' (' , $txt['new'] , ') (!)</option>';
               elseif ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
               echo '
                     <option value="?board=', $child['id'], '.0" style="color: '.$child['bcolor']. ';">' , $child['name'] , ' (!)</option>';
               elseif ($child['new'])
               echo '
                     <option value="?board=', $child['id'], '.0" style="color: '.$child['bcolor']. ';">' , $child['name'] , ' (' , $txt['new'] , ')</option>';
               else
               echo '
                     <option value="?board=', $child['id'], '.0" style="color: '.$child['bcolor']. ';">' , $child['name'] , '</option>';
               }

I hope that I am not out of line by posting this here.  I just wanted people to know that it can and will work if you want to use both mods together.  You just need to make those additions to your code.  I attached an example below of what it will do.  I made one child board the shows red and one that shows green (as assigned in Admin >Boards  and then assigned the color by using the Colorize Boards modification).


-img removed-

Rumbaar

Never out of line, I'll have to revisit the 'new' post indicator and look to just make it bold.  Should be able too, with the same inline styling you've done.  Strange I wonder how I tried before to do it.

Nice work.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Patriot89

I'm using the Default theme and it looks like the attached picture..


Is there a way to fix the black?


Rumbaar

That is not the default theme, as it's not black.  Not sure what you mean, but try looking at your themes style.css information for that section.

What exactly do you want to 'fix' in regards to the black?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Patriot89

It is the default theme, I just changed the colors via the style.css file. The black I would like to be the charcoal color like the rest of that row.


Advertisement: