Copied to clipboard

Flag this post as spam?

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


  • Carlos 338 posts 472 karma points
    Nov 20, 2013 @ 20:08
    Carlos
    0

    Creating 2 lists and then determining which to choose

    I have a tree structure that uses 2 different types of "Detail Page" nodes.  One has dates and one has non-date "Detail Page" nodes.  I need to determine which list to show depending on if the children have the date property or not of the parent node that has the doctype of 'ListParent'.

    I am able to create a list of the nodes, BUT I need to determine which list to show.

    This is what I ultimate want:

    Parent Node 1 (Doctype of 'ListParent')
     - Node One (non date)
     - Node Two(non date)
     - Node Three(non date)

    Parent Node 2 (Doctype of 'ListParent')
     - Node One (date)
     - Node Two(date)
     - Node Three(date)

    I am REALLY close with my code but I just need a little help determining which to show.  This is what I have so far below. I just need the IF statement to determine which list to show.

    Any help is GREATLY appreciated.

    @using umbraco.MacroEngines
    @inherits umbraco.MacroEngines.DynamicNodeContext
    
    @{
    
    
        if(@Model.Descendants().NodeTypeAlias == "DMNSEvent"){@*Not Working*@
            @pageListingSorted()
        }
        else{
                <P>not sorted</P>
        @pageListing()  
        }
    
      }
    
    @helper pageListing(){  
      foreach(var item in @Model.Children.Where("!hideFromAllMenus")){
         var listImage = Library.MediaById(item.landingPageImage);
        <div class="boxItem grid_4">
    
              @if(@item.HasValue("landingPageImage")){
                <a href="@item.Url">
                <img src="/imagegen.ashx?width=224&[email protected]" style="margin-left:-60px" />
                </a>
                <div class="boxButtons"></div>
                     if (!String.IsNullOrWhiteSpace(item.buyNowLink))
                    {
                       <a href="@item.buyNowLink" class="buyNowBtn" title="Buy tickets to @item.Name"  onclick="pageTracker._link('@item.buyNowLink'); return false;">Buy Now</a>
                    }
    
                    <a href="@item.Url" class="learnMoreBtn">Learn More</a>
              }
              <h3>
                    @if (!String.IsNullOrWhiteSpace(item.altPageTitle))
                    {
                       <a href="@item.Url"> @item.altPageTitle</a>
                    }
                    else
                    {
                       <a href="@item.Url"> @item.Name</a>
                    }
                </h3>
    
    
            </div>
    
       }
    
    }
    @*END PAGE LISTING HELPER*@
    
    
    @helper pageListingSorted(){
        foreach(var item in @Model.Children.Where("!hideFromAllMenus").Where("calendarEventDateTime != null").OrderBy("calendarEventDateTime")){
         var listImage = Library.MediaById(item.landingPageImage);
            <div class="boxItem grid_4">
    
              @if(@item.HasValue("landingPageImage")){
                <a href="@item.Url">
                    @*--Added margin negative left for original images - Take out on Live--*@
                <img src="/imagegen.ashx?width=224&[email protected]" style="margin-left:-60px" />
                </a>
                <div class="boxButtons"></div>
                     if (!String.IsNullOrWhiteSpace(item.buyNowLink))
                    {
                       <a href="@item.buyNowLink" class="buyNowBtn" title="Buy tickets to @item.Name"  onclick="pageTracker._link('@item.buyNowLink'); return false;">Buy Now</a>
                    }
    
                    <a href="@item.Url" class="learnMoreBtn">Learn More</a>
              }
              <h3>
                    @if (!String.IsNullOrWhiteSpace(item.altPageTitle))
                    {
                       <a href="@item.Url"> @item.altPageTitle</a>
                    }
                    else
                    {
                       <a href="@item.Url"> @item.Name</a>
                    }
                </h3>
                 @*Event Status*@
                @if (item.soldOut)
                {
                    <p class="statusAlert">Sold Out</p>
                }
                else if (item.cancelled)
                {
                    <p class="statusAlert">Cancelled</p>
                }
                else if (item.rescheduled)
                {
                 <p class="statusAlert">Rescheduled</p>
                }
                else
                {
                    <text></text>
                }
                 @if (!String.IsNullOrWhiteSpace(item.eventTimeHeader))
                {
                    <div class="dateTimeHeader">@item.eventTimeHeader</div>
                } 
    
            </div>
        }
    
    }@*END PAGE LISTING SORTED HELPER*@
    
    
    
    
    
    
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies