Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

new tab on tab in system


Go to End


29 Posts   10922 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 January 2009 at 6:30am

There's no reason why they shouldn't be saving to the database. All that class does is toggle their display. It really has nothing to do with how the data is handled. To the CMS, they're really the same as any other formfield.

Am I missing something?

Avatar
theAlien

Community Member, 131 Posts

3 January 2009 at 8:16am

I'm afraid yes...

I've installed verticaltabs in both 2.2.3 and 2.3rc2 (you never know, there might be a change of something crucial), and I made the same PageTest class as I posted before (http://silverstripe.org/customising-the-cms/show/251409?start=8#post251473 - however for 2.2.3 I changed 'public static' back to 'static').

In the CMS I entered some sample-data in the fields, clicked save&publish and checked the database...
but all 4 columns (Apple, Orange etc) are empty (NULL).

Could it be because everything is nested?

Attached Files
Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 January 2009 at 8:43am

Edited: 03/01/2009 8:44am

Doh! My bad. These fields need to know how to save themselves. Turns out I was way over thinking this. Try the new version, attached.

Also added a setOpenTab() method, which will allow you to have one open by default. Entirely optional. You can still use the other way to keep them both closed by default.

		$tabset = new VerticalTabSet(
			new VerticalTab('Fruits', array (
				new TextField('Apple'),
				new TextField('Orange')
			)),
			new VerticalTab('Vegetables', array (
				new TextField('Carrot'),
				new TextField('Celery')
			))
		);
		
		$tabset->setOpenTab('Vegetables');
		
		$fields->addFieldToTab("Root.Content.Main", $tabset);

Attached Files
Avatar
theAlien

Community Member, 131 Posts

3 January 2009 at 9:28am

Edited: 03/01/2009 9:29am

Hi,
That's doing the trick!

In the attachment I'm posting the improved css-file (added some ../../, changed the order of the toggle-open/closed to be in sync with the left bar and set the width to 98% - like the .middleColumn-divs).
I'm working on some alternatives for the darkgrey-bar that are a little less heavy in the cms-layout.
But I'm afraid that has to wait till later tonight.

By the way the setOpenTab() seems to have a problem. But that's a minor detail to me.
(By default they're closed, I can open them both by default by setting privat $open in VerticalTab.php (line 6) to true. Opening just one by default seems not possible)

Attached Files
Avatar
theAlien

Community Member, 131 Posts

3 January 2009 at 5:07pm

Hi,

I've added some layout.
Because of that I had to add a css-class .ContentOpen to line 21 in VerticalTab.php.

About the setOpenTab(): It appears I was making some mysterious mistake that broke it.
After a reinstall it works (don't know why, but it does), but there is a minor layout-issue with the tab that's open by default.
I'll look after it later.

I also added the installation instructions to a README-file.

Well... that's it for now. I'm kinda curious about your website: I think I don't see it in your profile.

Attached Files
Avatar
theAlien

Community Member, 131 Posts

4 January 2009 at 4:27am

OK... the layoutproblem has to be solved in .php/.js (any volunteers?)
If setOpenTab() is not set, every open tab has class="toggle" and every closed tab has class="toggle closed"

If setOpenTab() is set, things change to the unexpected:
Open tab (default open by setOpenTab()) has class="toggle closed"
Closed tab (normal) has class="toggle closed"
Open tab (normal) has class="toggle"

And after closing the tab that's open by default:
Closed tab (default open by setOpenTab()) has class="toggle"
Closed tab (normal) has class="toggle closed"
Open tab (normal) has class="toggle"

The tabs that aren't involved in setOpenTab() aren't affected.

I was working on a CSS-workaround, but just discovered it also affects the toggleOpen/toggleClosed images (I overlooked that before). So here is a CSS-file for everyone who really really wants to use the setOpenTab()-function. It's even without those images, so it's not as nice as the other one (imo), but it's still nice enough.

Attached Files
Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 January 2009 at 5:01pm

Sounds good. Can you post all of your changes? That last one only had the CSS file, and it looks like you've added some images and have changed the javascript?

BTW, my website is sort of still being cooked, but you can take a look at http://www.carlinowebdesign.com

Still populating the SS Extensions section... this will be a good addition, and I'll be sure to give you co-authoring credit.

Avatar
theAlien

Community Member, 131 Posts

7 January 2009 at 2:54pm

Edited: 07/01/2009 2:55pm

Hi,

Looks good!
I like using fonts in a way that almost make them look like a logo. And that's exactly what you did with the combination of blue and white and choosing that font (hurray for sifr). I do also think the way you're pointing people to at least three of the parts of your site is pretty good. An important reason for that is also that the menu is a bit difficult to notice at the place you put it. At least... I got distracted by "popular downloads"...

Back to the module: The download to use is verticaltabset2-layoutversion.zip. However (if you use the toggle open by default-function), there is a slight problem with the css-class of the tab that's toggled open by default. For those who want to use that function, I added a CSS-file (verticaltabsetcsstoggleOpen.zip) that's a little less nice, but still pretty good imo.

So that indeed is just a CSS. You have to replace the default CSS with it.

I would love to be able to change the php in the way that is necessary, let alone the js. However I'm still learning. Right now I'm able to read php pretty well and even make some minor changes to it (I'm not good enough though). For js however there seems to be a learning curve that's a bit to steep for me right now (I'm trying to reach my masters-degree in quite a different (not webdesign etc. related) subject - the learning of and working with SilverStripe is a side-project for the moments I'm done with learning and have to distract my mind, especially just before going to bed).