Guest User

Untitled

a guest
Jun 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.86 KB | None | 0 0
  1. {% nav entry in entry.descendants %}
  2. {% set page = entry.singleEntry[0] ?? null %}
  3. <li class="mb-2">
  4. {% if page is not null %}<a href="{{ page.url() }}" class="text-sm text-white hover:text-lime">{{ entry.title }}</a></li>{% endif %}
  5. {% ifchildren %}
  6. <ul class="ml-4 my-2 list-reset">
  7. {% children %}
  8. </ul>
  9. {% endifchildren %}
  10. </li>
  11. {% endnav %}
  12.  
  13. {% set navigation = craft.entries({
  14. section: 'navigation',
  15. limit: null,
  16. with: [
  17. 'children',
  18. 'descendants',
  19. 'singleEntry'
  20. ]
  21. }) %}
  22.  
  23. (index):2754 Profiling Summary Report
  24. 13:25:22.385 (index):2755 Time: 14.12897s
  25. 13:25:22.386 (index):2756 Memory: 58,940Kb
  26. 13:25:22.386 (index):2757 Total Queries: 178
  27.  
  28. {% cache globally using key "navMega" for 1 year %}
  29. <div class="relative hidden lg:block w-full z-50" data-controller="mega-menu">
  30. <div class="sitecontainer">
  31. <nav class="pb-4">
  32. {% for entry in navigation.level(1) %}
  33. {% if loop.first %}
  34. <ul class="list-reset flex justify-between">
  35. <li class="pr-6 // border-r border-white-25">
  36. <a href="{{ siteUrl() }}" class="hover:text-lime {% if craft.request.firstSegment == '' %}text-lime{% else %}text-white{% endif %}" data-action="mouseover->mega-menu#close">
  37. <div class="w-5 // h-5 // fill-current // mr-2">
  38. {% include '_includes/svg/icon-home.svg' %}
  39. <span class="alt">Home</span>
  40. </div>
  41. </a>
  42. </li>
  43. {% endif %}
  44. <li class="pl-4 pr-8 // {% if not loop.last %}border-r border-white-25{% endif %}">
  45. <a href="#" class="text-white hover:text-lime flex items-center font-semibold"
  46. data-action="click->mega-menu#open"
  47. data-next="{{ entry.title|kebab }}">
  48. {{ entry.title }}
  49. {%- if (entry.hasDescendants or entry.type == 'contact' or 'directories') -%}
  50. <div class="ml-1 w-3 h-3 fill-current /// mt-1 flex flex-col justify-center">
  51. {% include '_includes/svg/icon-chevron.svg' %}
  52. </div>
  53. {%- endif -%}
  54. </a>
  55. </li>
  56. {% if loop.last %}</ul>{% endif %}
  57. {% endfor %}
  58.  
  59.  
  60. {% for entry in navigation.level(1) %}
  61. {% switch entry.type %}
  62.  
  63. {% case 'contact' %}
  64. <div id="{{ entry.title|kebab }}" class="mt-10 hidden absolute pin-x bg-petrol p-4 z-10" data-target="mega-menu.menu">
  65. <div class="max-w-4xl flex flex-wrap pt-6 px-8 mx-auto">
  66. <div class="flex flex-col pr-12 mb-12 flex-1">
  67. <h3 class="mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6">
  68. {{ entry.title }}
  69. </h3>
  70.  
  71. <div class="flex flex-wrap justify-between">
  72. <div class="w-1/2 pr-12 text-white leading-normal">
  73. <a href="mailto:{{ companyInformation.email }}" class="text-lime hover:text-white text-lg mb-6 inline-block">{{ companyInformation.email }}</a>
  74.  
  75. {% if entry.body|length %}
  76. <div class="article">
  77. {{ entry.body }}
  78. </div>
  79. {% endif %}
  80.  
  81. <p class="text-xs">
  82. ‘{{ siteName }}’ is a trading division of Judd and Judd Ltd, a company registered in England and Wales, registered number 8082403. Registered office: Suite 2, Douglas House, 32-34 Simpson Road, Fenny Stratford, Buckinghamshire, MK1 1BA, United Kingdom.
  83. </p>
  84. </div>
  85.  
  86. <div class="pl-12">
  87. <div class="text-white mb-6">
  88. {% include '_includes/social/follow' %}
  89. </div>
  90.  
  91. {# {% if entry.relatedContent|length %}
  92. {% for entry in entry.relatedContent %}
  93. {% if loop.first %}<ul class="list-reset">{% endif %}
  94. <li class="text-white mb-2">
  95. <a href="{{ entry.url }}" class="text-white hover:text-lime">{{ entry.title }}</a>
  96. </li>
  97. {% if loop.last %}</ul>{% endif %}
  98. {% endfor %}
  99. {% endif %} #}
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104.  
  105. {% case "directories" %}
  106. <div id="{{ entry.title|kebab }}" class="mt-10 hidden absolute pin-x bg-petrol p-4 z-10" data-target="mega-menu.menu">
  107. <div class="flex flex-wrap pt-6 px-8 mx-auto">
  108. <div class="flex flex-col pr-12 mb-12 flex-1">
  109. <h3 class="mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6">
  110. {{ entry.title }}
  111. </h3>
  112.  
  113. <div class="flex flex-wrap justify-between">
  114. <div class="pr-12 text-white leading-normal">
  115. {% if entry.body|length %}
  116. {{ entry.body }}
  117. {% endif %}
  118.  
  119. {# {% if entry.relatedContent|length %}
  120. {% for entry in entry.relatedContent %}
  121. {% if loop.first %}<ul class="list-reset">{% endif %}
  122. <li class="text-white mb-2 {% if loop.last %}mt-6 pt-4 border-t border-petrol-light{% endif %}">
  123. <a href="{{ entry.url }}" class="text-white hover:text-lime text-sm">{{ entry.title }}</a>
  124. </li>
  125. {% if loop.last %}</ul>{% endif %}
  126. {% endfor %}
  127. {% endif %} #}
  128. </div>
  129.  
  130. <div class="pl-6 flex-1 flex flex-wrap">
  131. <h3 class="mb-2 text-lg text-white mb-6 w-full">Latest Updates</h3>
  132. {% for entry in directories %}
  133. {% set logo = entry.logo[0] ?? null %}
  134. <article class="flex /// w-1/2 px-6 mb-6">
  135. <div class="flex items-center justify-center w-32 bg-white p-2">
  136. {% if logo|length %}
  137. <a href="{{ entry.url }}">
  138. <div class="text-center">
  139. {% include '_includes/partials/logo' with { classes: 'p-2 bg-white w-full' } %}
  140. </div>
  141. </a>
  142. {% else %}
  143. {% include '_includes/directories/articleImage' %}
  144. {% endif %}
  145. </div>
  146. <div class="pl-4 /// flex-1 flex flex-col justify-center">
  147. <h3 class="mb-2"><a href="{{ entry.url }}" class="text-lime hover:text-blue text-lg font-semibold">{{ entry.title }}</a></h3>
  148. <p class="text-sm mb-0 text-petrol-light">{{ entry.section }}</p>
  149. </div>
  150. </article>
  151. {% endfor %}
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157.  
  158. {% default %}
  159. <div id="{{ entry.title|kebab }}" class="mt-10 hidden absolute pin-x bg-petrol p-4 z-10" data-target="mega-menu.menu">
  160. <div class="flex flex-wrap pt-6 px-8 mx-auto">
  161. {% for entry in entry.children %}
  162. <div class="flex flex-col pr-12 mb-12 flex-1">
  163. <h3 class="mb-2 text-lg border-b border-petrol-light pb-2 font-semibold text-grey-lightest mb-6">
  164. {{ entry.title }}
  165. </h3>
  166. <ul class="ml-4 list-reset">
  167. {% nav entry in entry.descendants %}
  168. {% set page = entry.singleEntry[0] ?? null %}
  169. <li class="mb-2">
  170. {% if page is not null %}<a href="{{ page.url() }}" class="text-sm text-white hover:text-lime">{{ entry.title }}</a></li>{% endif %}
  171. {% ifchildren %}
  172. <ul class="ml-4 my-2 list-reset">
  173. {% children %}
  174. </ul>
  175. {% endifchildren %}
  176. </li>
  177. {% endnav %}
  178. </ul>
  179. </div>
  180. {% endfor %}
  181. </div>
  182. </div>
  183. {% endswitch %}
  184. {% endfor %}
  185. </nav>
  186.  
  187. </div>
  188. </div>
  189. {% endcache %}
Add Comment
Please, Sign In to add comment