Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » new tab on tab in system

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

Page: 1 2 3 4
Go to End
Author Topic: 6369 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    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?

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    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
  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    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
  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    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
  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    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
  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    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
  • UncleCheese
    Avatar
    4085 Posts

    Re: new tab on tab in system Link to this post

    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.

  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: new tab on tab in system Link to this post

    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).

    6369 Views
Page: 1 2 3 4
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.