Created
October 27, 2017 10:01
-
-
Save ps-team/44635ac72a7cec88647210b9c8612074 to your computer and use it in GitHub Desktop.
Events list item template with multiple categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2 class="sys_subitem-heading sys_events-subheading"><a href="@CurrentNode.Path">@CurrentNode.Title</a></h2> | |
<div class="sys_subitem-summary sys_events-summary"> | |
@if(CurrentNode.Data.Property_TaxonomyCategories.ToString() != ""){ | |
string[] eventCategoriesTax = CurrentNode.Data.Property_TaxonomyCategories.ToString().Split(','); | |
string lastCategory = eventCategoriesTax[eventCategoriesTax.Length - 1]; | |
string eventCategoriesString = ""; | |
foreach (string eventCategory in eventCategoriesTax) { | |
if(eventCategory.Contains("0/4/11/12")) { | |
var currentTaxNode = CurrentContext.Taxonomy.GetByKey(eventCategory.Replace(",","")); | |
if(currentTaxNode != null) { | |
var eventCategoryUrl = "?TaxonomyKey=" + currentTaxNode.Key; | |
if (eventCategory.Contains(lastCategory)) { | |
eventCategoriesString += "<a href=\""+ @eventCategoryUrl +"\">" + currentTaxNode.Value + "</a>"; | |
}else{ | |
eventCategoriesString += "<a href=\""+ @eventCategoryUrl +"\">" + currentTaxNode.Value + "</a>, "; | |
} | |
} | |
} | |
} | |
<div class="sys_events-category">@Html.Raw(eventCategoriesString)</div> | |
} | |
<dl> | |
<dt class="sys_events-time">Date</dt> | |
<dd class="sys_events-time">@CurrentNode.Data.StartDate.ToString("d/M/yyyy")</dd> | |
<dt class="sys_events-time">Time</dt> | |
<dd class="sys_events-time">@CurrentNode.Data.StartDate.ToString("HH:MM") - @CurrentNode.Data.EndDate.ToString("HH:MM")</dd> | |
@if(CurrentNode.Data.Location.ToString() != ""){ | |
<dt class="sys_events-location">Location: </dt> | |
<dd class="sys_events-location">@CurrentNode.Data.Location</dd> | |
} | |
</dl> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment