Advertisement
Guest User

Untitled

a guest
Mar 17th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
  11.  
  12. @{
  13. var tagList = Umbraco.TagQuery.GetAllContentTags().OrderBy(t => t.Text);
  14. string tag = Request.QueryString["tag"];
  15.  
  16. if (!tag.IsNullOrWhiteSpace())
  17. {
  18. var publishedContent = Umbraco.TagQuery.GetContentByTag(tag);
  19.  
  20. if (publishedContent.Count() > 0)
  21. {
  22. @* Show title *@
  23. <div class="media contact-info wow fadeInDown" data-wow-duration="1000ms" data-wow-delay="600ms">
  24. <center>
  25. <div>
  26. <i class="fa fa-tags"></i>
  27. </div>
  28.  
  29. <br />
  30.  
  31. <div class="media-body">
  32. <h2>Tags</h2>
  33. <p>Browse content by tag</p>
  34. </div>
  35. </center>
  36.  
  37. <br />
  38.  
  39. </div>
  40.  
  41.  
  42. @* Show tag titles in tabs *@
  43. <ul class="portfolio-filter text-center">
  44.  
  45. <li><a class="btn btn-default" href="#" data-filter="*">All tags</a></li>
  46.  
  47. @foreach (var tags in tagList)
  48. {
  49. @* Create a selected tag *@
  50. if(@tags.Text == @tag)
  51. {
  52. <li><a href="/tags?tag=@tags.Text" class="btn btn-default active" data-filter=".@tag">@tags.Text (@tags.NodeCount)</a></li>
  53. }
  54.  
  55. @* Show all other tags *@
  56. else
  57. {
  58. <li><a href="/tags?tag=@tags.Text" class="btn btn-default" data-filter=".@tags.Text">@tags.Text (@tags.NodeCount)</a></li>
  59. }
  60. }
  61.  
  62. </ul>
  63.  
  64.  
  65. <div class="row">
  66. <div class="portfolio-items">
  67.  
  68. @* Start picture content *@
  69. @foreach (var item in tagList)
  70. {
  71. @* Put selected tag in the right tag tab *@
  72. if(@item.Text == @tag)
  73. {
  74. @* Show tag content *@
  75. <div class='portfolio-item @tag col-xs-12 col-sm-4 col-md-3'>
  76. <div class="recent-work-wrap">
  77.  
  78. @* IF the project has a picture *@
  79. @if(item.HasValue("pictureOfTheProject"))
  80. {
  81. var featureImage = Umbraco.TypedMedia((int)item.pictureOfTheProject);
  82. <img class="img-responsive" src="@featureImage.GetCropUrl(250, 250)" alt='@item.titleOfTheProject' />
  83.  
  84. <div class="overlay">
  85. <div class="recent-work-inner">
  86.  
  87. <h3><a href="@item.Url">@item.titleOfTheProject</a></h3>
  88.  
  89. <a class="preview" href="@item.Url" rel="prettyPhoto">
  90. <i class="fa fa-eye"></i> View
  91. </a>
  92. </div>
  93. </div>
  94. }
  95.  
  96. @* Else when the project doesnt have a picture, show default one *@
  97. else
  98. {
  99. var noImage = "http://www.don-zalmrol.be/media/1440/no_image_available.png";
  100. <img class="img-responsive" src="@noImage.GetCropUrl(250, 250)" alt="No image" />
  101.  
  102. <div class="overlay">
  103. <div class="recent-work-inner">
  104.  
  105. <h3><a href="@item.Url">@item.titleOfTheProject</a></h3>
  106.  
  107. <a class="preview" href="@item.Url" rel="prettyPhoto">
  108. <i class="fa fa-eye"></i> View
  109. </a>
  110.  
  111. </div>
  112. </div>
  113. }
  114.  
  115. </div>
  116. </div>
  117.  
  118. }
  119.  
  120. @* Put the other tags under there own tab *@
  121. else
  122. {
  123. @* Something needs to be here... *@
  124. }
  125. }
  126. @* End dynamic tags *@
  127.  
  128. </div>
  129. </div>
  130. }
  131.  
  132. @* No content matching the tag? *@
  133. else
  134. {
  135. <p>There isn't any content matching that tag.</p>
  136.  
  137. @Html.Partial("TagList")
  138. }
  139. }
  140.  
  141. @* Show the tag list with amount *@
  142. else
  143. {
  144. @Html.Partial("TagList")
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement