asiaH3/modules/calendar/_calendar_widget1.html.erb

58 lines
2.2 KiB
Plaintext

<div class="w-calendar widget-calendar-1" data-module="calendar">
<div class='month_template'>
<h4 class="widget-title ">
<span class="text"></span>
<i class="fa fa-circle-o-notch fa-spin fa-fw loading hide"></i>
</h4>
<div class="w-calendar-nav">
<a href="#" class="w-calendar-nav-prev">
<i class="fa fa-chevron-left"></i>
<span class="w-calendar-nav-prev-text hide">Prev</span>
</a>
<a href="#" class="w-calendar-nav-next">
<i class="fa fa-chevron-right"></i>
<span class="w-calendar-nav-next-text hide">Next</span>
</a>
</div>
<table class="table table-condensed w-calendar-table">
<thead>
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<script>
if(document.getElementById("calendar-widget_module") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module");
tag.src = "/assets/calendar_widget.js";
tag.onload = function(){
$("div[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth(new Date(), calendar,calendar.data("subpart-id"),"{{more_url}}");
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
})
})
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
</script>