Advertisement
brentpirolli

Content Channel with Child Items

Apr 27th, 2023
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. <style>
  2. .header-banner { height: 100px; background-size: cover; background-position: center center; background-repeat: no-repeat; }
  3. @media (min-width: 992px) { .header-banner { height: 200px; } }
  4. .card-body { padding: 15px; height: 150px; font-size: 17px; }
  5. @media (min-width: 768px) and (max-width: 991px) { .card-body { padding: 6px; } }
  6. @media (min-width: 992px) and (max-width: 1349px) { .card-body { font-size: 14px; } }
  7. @media (min-width: 1350px) { .card-body { padding: 10px; } }
  8. @media (min-width: 1550px) { .card-body { padding: 15px; font-size: 18px; } }
  9. .card { border: 1px solid rgba(0, 0, 0, .3); position: relative; height: 444px; }
  10. .card h1 { font-size: 20px; font-weight: 600; margin: 4px 0; }
  11. .card h4 { font-size: 16px; font-weight: 200; margin: 4px 0; }
  12. .card-dates { opacity: .6; background-color: #dfdfdf; padding: 5px; }
  13. .card-header { background-color: #eee; padding: 5px; }
  14. .card-summary { height: auto; overflow: hidden; margin: 10px 0; }
  15. .card-link:hover { text-decoration: none; }
  16. .card-image { height: 200px; width: 100%; background-size: cover; background-position: center center; background-repeat: no-repeat; }
  17. .card-image:after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; transition: all .1s ease-in-out; }
  18. .card-image:hover:after { background: rgba(0,0,0,.2); }
  19. .series-title{ margin-bottom: 4px; }
  20. .series-dates { opacity: .6; }
  21. .pager { max-width: 300px; margin: 10px auto; }
  22. .pager li, .pager a { min-width: 100px; }
  23. .pager .previous a, .pager .next a { padding: 12px; background-color: #0090bf; color: #fff; }
  24. .pager li > a:hover, .pager li > a:focus { background-color: #333; }
  25. .pager .previousoff {float: left; line-height: 46px; border: 1px solid #ddd; border-radius: 15px; }
  26. .pager .nextoff {float: right; line-height: 46px; border: 1px solid #ddd; border-radius: 15px; }
  27. .pager .count { min-width: 100px; line-height: 46px; }
  28. </style>
  29.  
  30. {% if Item %}
  31. <article class="series-detail">
  32. {% assign seriesImageGuid = Item | Attribute:'SeriesHeader','RawValue' %}
  33. <div class="header-banner" style="background-image: url('/GetImage.ashx?Guid={{ seriesImageGuid }}');" ></div>
  34. <h1 class="series-title">{{ Item.Title }}</h1>
  35. <script>function fbs_click() { u = location.href; t = document.title; window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); return false; }</script>
  36. <script>function ics_click() { text = `{{ EventItemOccurrence.Schedule.iCalendarContent }}`.replace('END:VEVENT', 'SUMMARY: {{ Event.Name }}\r\nLOCATION: {{ EventItemOccurrence.Location }}\r\nEND:VEVENT'); var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', '{{ Event.Name }}.ics'); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); }</script>
  37. <ul class="socialsharing">
  38. <li style="color: #888;">Share to:</li>
  39. <li>
  40. <a href="https://facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank" class="socialicon socialicon-facebook" title="" data-original-title="Share via Facebook">
  41. <i class="fa fa-fw fa-facebook"></i>
  42. </a>
  43. </li>
  44. <li>
  45. <a href="https://twitter.com/intent/tweet?text=Check%20this%20out:%20{{ 'Global' | Page:'Url' | EscapeDataString }}" target="_blank" class="socialicon socialicon-twitter" title="" data-original-title="Share via Twitter">
  46. <i class="fa fa-fw fa-twitter"></i>
  47. </a>
  48. </li>
  49. <li>
  50. <a href="mailto:?Subject=I%20want%20to%20share%20this%20with%20you&Body=Check%20this%20out:%20{{ 'Global' | Page:'Url' }}" class="socialicon socialicon-email" title="" data-original-title="Share via Email">
  51. <i class="fa fa-fw fa-envelope-o"></i>
  52. </a>
  53. </li>
  54. </ul>
  55. <div class="margin-t-lg">
  56. {{ Item.Content }}
  57. </div>
  58. <div class="row margin-t-lg">
  59. {% assign now = 'Now' | Date:'M/d/yyyy' %}
  60. {% assign pageSize = 6 %}
  61. {% assign pageNum = 'Global' | PageParameter:'p' | Default:'1' | AsInteger %}
  62. {% assign children = Item.ChildItems | OrderBy:'ChildContentChannelItem.StartDateTime desc' %}
  63. {% assign totalCount = children | Size %}
  64. {% assign showCount = 0 %}
  65. {% for count in children %}
  66. {% if count.ChildContentChannelItem.StartDateTime <= now %}
  67. {% assign showCount = showCount | Plus:1 %}
  68. {% endif %}
  69. {% endfor %}
  70. {% assign unpubCount = totalCount | Minus:showCount %}
  71. {% assign skipCount = pageNum | Minus:1 | Times:pageSize | Plus:unpubCount %}
  72. {% assign pageCount = showCount | DividedBy:pageSize | Ceiling %}
  73.  
  74. {% for message in children limit:pageSize offset:skipCount %}
  75. {% assign cardImageGuid = message.ChildContentChannelItem | Attribute:'Image','RawValue' %}
  76. <div class="col-md-4 col-sm-6 margin-b-md">
  77. <a class="card-link" href="/collections/studies/{{ message.ChildContentChannelItem.PrimarySlug }}">
  78. <article class="card">
  79. <div class="card-image" style="background-image: url('/GetImage.ashx?Guid={{ cardImageGuid }}');"></div>
  80. <div class="card-header text-color">
  81. <h1>{{ message.ChildContentChannelItem.Title }}</h1>
  82. <h4>{{ message.ChildContentChannelItem | Attribute:'Subtitle' }}</h4>
  83. </div>
  84. <div class="card-body">
  85. <div class="card-summary text-color">{{ message.ChildContentChannelItem.Content | StripHtml | TruncateWords:25,'...'}}</div>
  86. </div>
  87. <div class="card-dates text-color">{{ message.ChildContentChannelItem.StartDateTime | Date:'dddd, MMMM d, yyyy' }}</div>
  88. </article>
  89. </a>
  90. </div>
  91. {% capture breakNow %}{{ forloop.index | Modulo:3 }}{% endcapture %}
  92. {% endfor -%}
  93. {% if breakNow == 0 %}
  94. </div>
  95. {% endif %}
  96. {% if pageNum > pageCount %}
  97. {{ '~/page-not-found' | PageRedirect }}
  98. {% endif %}
  99. {% if pageCount > 1 %}
  100. {% assign pageNumPrev = pageNum | Minus:1 %}
  101. {% assign pageNumNext = pageNum | Plus:1 %}
  102. {% assign queryParams = 'Global' | Page:'QueryString' %}
  103. <div class="margin-t-lg">
  104. <ul class="pager">
  105. {% if pageNumPrev == 0 %}
  106. <li class="previousoff"><i class="fa fa-chevron-left"></i> Prev</li>
  107. {% else %}
  108. <li class="previous"><a href="{{ 'Global' | Page:'Path' }}?p={{ pageNumPrev }}"><i class="fa fa-chevron-left"></i> Prev</a></li>
  109. {% endif %}
  110. <li class="count">{{ pageNum }} of {{ pageCount }}</li>
  111. {% if pageNumNext > pageCount %}
  112. <li class="nextoff">Next <i class="fa fa-chevron-right"></i></li>
  113. {% else %}
  114. <li class="next"><a href="{{ 'Global' | Page:'Path' }}?p={{ pageNumNext }}">Next <i class="fa fa-chevron-right"></i></a></li>
  115. {% endif %}
  116. </ul>
  117. </div>
  118. {% endif %}
  119. </article>
  120. {% else %}
  121. <h1>Could not find series.</h1>
  122. {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement