Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • DonZalmrol 220 posts 833 karma points
    May 05, 2015 @ 13:57
    DonZalmrol
    0

    Grid sidenavigation

    So I have another question. In my classical layout I have a sidebar navigation on each page. Is it possible to do this in the grid as well?

    So I'll have the option to add the navigation in the sidebar like a macro?

    This is how it is now, but if you browse the page, you have long bit added whitespace due to the grid set up (it's set to 8 and the side nav to 4). http://www.don-zalmrol.be/blah-blah/

    Thanks!

    Laurens

    enter image description here

  • Mehul Gajjar 48 posts 172 karma points
    May 05, 2015 @ 14:19
    Mehul Gajjar
    0

    Hi,

    make your menu in partial view and add in macro.

    and used this macro in grid layout.

    Hope this is helpful

    Regards,

    Mehul Gajjar.

  • DonZalmrol 220 posts 833 karma points
    May 05, 2015 @ 16:13
    DonZalmrol
    0

    Thx, that's made it work. But for some reason now, my grid is showing outside my website.

    The grid has a combined number of 12 columns and the layout has a 2 column setting (4 and 8 = 12). Then I have my rows which have their own respected sizes for the sidenav macro and other stuff like content, images, etc...

    http://www.don-zalmrol.be/blah/

    enter image description here enter image description here

  • Mehul Gajjar 48 posts 172 karma points
    May 06, 2015 @ 07:33
    Mehul Gajjar
    0

    Hi,

    As in your grid layout 4 rows created Full , Half , Photo+Content and macro.

    kindly click on macro row and increase the number of cell same as full row.

    Regards,

    Mehul Gajjar

  • DonZalmrol 220 posts 833 karma points
    May 06, 2015 @ 09:08
    DonZalmrol
    0

    Hi Mehul,

    I've did it just now. But the page got wider instead of smaller :) All my rows are now set to 12 columns in total.

    Seems it's something to do with the row size.

    This is my template code, which is as you can see just basic stuff.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    

    @{ Layout = "Master.cshtml"; }

    <div class="container">
    
        <div class="row">               
    
            <div class="wow fadeInDown">
    
                @CurrentPage.GetGridHtml("bodyText")
            </div>
    
        </div>
    
    </div>
    

  • John Churchley 272 posts 1258 karma points c-trib
    May 06, 2015 @ 13:26
    John Churchley
    0

    Hi Laurens, 

    Your code suggests your nesting div (within GetGridHtml which by default is bootstrap3.cshtml) with a class of container within another div with class of container. As the container class defines a width of 1170px for large widths in bootstrap 3 there lies your issue. One way around this would be to create a customer grid partial within the grid folder then use it by @CurrentPage.GetGridHtml("bodyText", customgridpartial). Try copy and pasting the bootstrap3.cshtml and then remove the container div to start then by changing the grid settings you should be able to get it to work.

    Good luck!

    JC

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    May 06, 2015 @ 15:09
    Rune Hem Strand
    100

    Hi Laurens

    You might consider removing the container and row elements from your master.cshtml

        <div class="wow fadeInDown">
              @CurrentPage.GetGridHtml("bodyText")
        </div>
    

    The Grid layout renderer will create the necessary .container and .row elements to wrap your content correctly.

    /Rune

  • DonZalmrol 220 posts 833 karma points
    May 06, 2015 @ 15:30
    DonZalmrol
    0

    Hi Rune, I've removed it, the styling is now a little bit different. But still showing out of the page.

    I'll take a look at J.C's suggestion about the own styling layout.

  • DonZalmrol 220 posts 833 karma points
    May 06, 2015 @ 16:08
    DonZalmrol
    0

    J.C what do I need to do exactly?

    Do I need to:

    1. Create a new partial view under Partial views -> Grid -> customgridpartial.cshtml
    2. Copy all the contents of bootstrap3.cshtml to the customgridpartial.cshtml
    3. Remove all the class items
  • DonZalmrol 220 posts 833 karma points
    May 07, 2015 @ 08:51
    DonZalmrol
    0

    Ok, so I've changed the grid setttings in the bootstrap file. I've just created a new one and changed the div's to the ones I use.

    http://www.don-zalmrol.be/blah/

    The page is now showing it much better, but there are still some issues in it. Main concern now is that the sidenavigation is listed ontop of my content instead of besides it.

    enter image description here enter image description here enter image description here enter image description here

    Bootstrap code:

    @inherits UmbracoViewPage<dynamic>
    

    @using Umbraco.Web.Templates @using Newtonsoft.Json.Linq

    @* Razor helpers located at the bottom of this file *@

    @if (Model != null && Model.sections != null) { var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;

    <div class="content">
        @if (oneColumn)
        {
            foreach (var section in Model.sections)
            {
                <div class="container">
                    @foreach (var row in section.rows)
                    {
                        @renderRow(row, true);
                    }
                </div>
            }   
        }
    
        else
        { 
            <div class="container">
                <div class="row">
                    @foreach (var s in Model.sections)
                    {
                        <div class="col-xs-12">
                            <div class="[email protected] wow fadeInDown">
                                @foreach (var row in s.rows)
                                {
                                    @renderRow(row, false);
                                }
                            </div>
                        </div>
                    }
                </div>
            </div>   
        }
    </div>
    

    }

    @helper renderRow(dynamic row, bool singleColumn) {

    @Umbraco.If(singleColumn, "
    ")
    @foreach ( var area in row.areas ) {
    @foreach (var control in area.controls) { if (control !=null && control.editor != null && control.editor.view != null ) { } }
    }
    @Umbraco.If(singleColumn, "
    ")
    }

    @functions { public static MvcHtmlString RenderElementAttributes(dynamic contentItem) { var attrs = new List

        if(cfg != null)
            foreach (JProperty property in cfg.Properties())
            {
                attrs.Add(property.Name + "=\"" + property.Value.ToString() + "\"");
            }
    
        JObject style = contentItem.styles;
    
        if (style != null)
        { 
            var cssVals = new List<string>();
    
            foreach (JProperty property in style.Properties())
                cssVals.Add(property.Name + ":" + property.Value.ToString() + ";");
    
            if (cssVals.Any())
                attrs.Add("style=\"" + string.Join(" ", cssVals) + "\"");
        }
    
        return new MvcHtmlString(string.Join(" ", attrs));
    }
    

    }

  • DonZalmrol 220 posts 833 karma points
    May 07, 2015 @ 10:32
    DonZalmrol
    0

    Little update, I'm getting there.

    The layout is starting to look like a "regular" page. But now I need to lower the content a bit so it isn't stuck at the top nav bar.

    http://www.don-zalmrol.be/blah/

    enter image description here

  • DonZalmrol 220 posts 833 karma points
    May 08, 2015 @ 15:56
    DonZalmrol
    0

    Ok, fixed :)

    Seemed that I needed to put the

    tags in the template itself and not in the partialview.

    Thank you all for your help!

  • John Churchley 272 posts 1258 karma points c-trib
    May 08, 2015 @ 18:13
    John Churchley
    0

    Hi Laurens, been busy the last couple of days glad you got it sorted! 

Please Sign in or register to post replies

Write your reply to:

Draft