Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. {%- paginate collection.products by settings.pagination_limit -%}
  2.  
  3. {%- assign product_ids = "" -%}
  4. {%- for product in collection.products -%}
  5. {%- capture product_ids -%}{{ product_ids }}{%- unless forloop.first -%},{%- endunless -%}{{ product.id }}{%- endcapture -%}
  6. {%- endfor -%}
  7.  
  8. <div id="content">
  9. <div class="container">
  10. {% include 'breadcrumb' %}
  11. <div class="catalog_c">
  12.  
  13. {% if collection.image or collection.description.size > 0 %}
  14. <div class="row">
  15. <div class="col-sm-12">
  16. <div class="box collection-box animated rollIn" data-animation="rollIn" >
  17. {% if collection.image %}
  18. <img src="{{ collection | img_url: 'master' }}" alt="{{ collection.title }}" />
  19. {% endif %}
  20. {% if collection.description.size > 0 %}
  21. <div class="rte">
  22. {{ collection.description }}
  23. </div>
  24. {% endif %}
  25. </div>
  26. </div>
  27. </div>
  28. {% endif %}
  29.  
  30. <div class="title clearfix">
  31. <h1>{{ collection.title }}</h1>
  32. </div>
  33.  
  34. <div class="row">
  35. <div class="col-sm-12">
  36. <div class="">
  37. <div class="row view-grid animated fadeInUp" data-animation="fadeInUp" >
  38. {% if collection.products %}
  39. <div id='bta-calendar' class='infor_c animated rollIn animation-done'></div>
  40. {% else %}
  41. <p class="no-products">{{ 'collections.general.no_matches' | t }}</p>
  42. {% endif %}
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. {% endpaginate %}
  51.  
  52. {%- capture bta_url -%}//{{ shop.permanent_domain | split: '.' | first }}.bookthatapp.com{%- endcapture -%}
  53. <link href="{{ bta_url }}/fullcalendar2/fullcalendar.min.css" rel='stylesheet' />
  54. <script src="{{ bta_url }}/fullcalendar2/lib/moment.min.js" type="text/javascript"></script>
  55. <script src="{{ bta_url }}/fullcalendar2/fullcalendar.min.js" type="text/javascript"></script>
  56.  
  57. <script>
  58. EventList = function() {
  59. _this = this;
  60. _calendar = null;
  61. _today = new Date(),
  62.  
  63. this.load = function() {
  64. _calendar = $('#bta-calendar').fullCalendar({
  65. header: {
  66. left: 'prev,next today',
  67. center: 'title',
  68. right: ''
  69. },
  70. defaultView: 'listMonth',
  71. contentHeight: 'auto',
  72. noEventsMessage: 'No classes scheduled',
  73. eventLimit: true, // allow "more" link when too many events
  74. events: function(start, end, tz, callback) {
  75. _this.refresh(start, end, callback);
  76. },
  77. eventRender: function(event, element) {
  78. if (event.bookingCount >= event.capacity) {
  79. element.addClass('booked-out');
  80. }
  81.  
  82. if (event.end < _this.today) {
  83. element.addClass('past-event');
  84. }
  85.  
  86. if (event.image) {
  87. _this.renderImage(event, element);
  88. }
  89.  
  90. var titleCell = element.find('.fc-list-item-title'),
  91. timeCell = element.find('.fc-list-item-time');
  92.  
  93. timeCell.append($('<br><small>' + (event.capacity - event.bookingCount) + ' places left</small>'));
  94. titleCell.append($('<p>With Chef XXX</p>'));
  95. titleCell.append($('<a class="learn_more" href="' + event.url + '">Learn more »</a>'));
  96. }
  97. });
  98. };
  99.  
  100. this.map = function(schedule) {
  101. return $.map(schedule, function(item, n) {
  102. var result = $.extend(item, {
  103. start:new Date(item.start[0], item.start[1] - 1, item.start[2], item.start[3], item.start[4], item.start[5]),
  104. end:new Date(item.end[0], item.end[1] - 1, item.end[2], item.end[3], item.end[4], item.end[5])
  105. });
  106.  
  107. // prevent clicking through to past events or products already booked out
  108. if (result.start < _this.today || result.bookedOut) {
  109. delete result.url;
  110. }
  111.  
  112. return result;
  113. });
  114.  
  115. };
  116.  
  117. this.renderImage = function(event, element) {
  118. var parts = event.image.split('?'),
  119. image = parts[0],
  120. index = image.lastIndexOf('.'),
  121. ext = image.substr(index),
  122. path = image.substr(0, index),
  123. div = $('<div>', {'class': 'fc-thumb'}),
  124. img = $('<img>', {'src': path + "_small" + ext + "?_=" + parts[1]});
  125.  
  126. element.find('.fc-list-item-marker').empty().append(div.append(img));
  127. };
  128.  
  129. this.refresh = function(start, end, callback) {
  130. var params = {
  131. start: start.format(),
  132. end: end.format(),
  133. }
  134.  
  135. $.getJSON("{{ bta_url }}/availability/schedule.json?callback=?", params, function (data) {
  136. callback(_this.map(data.schedule));
  137. })
  138. };
  139. };
  140.  
  141. document.addEventListener("DOMContentLoaded", function(event) {
  142. eventList = new EventList();
  143. eventList.load();
  144. })
  145. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement