fix widget page click and add show event month page
This commit is contained in:
parent
7db11d7fef
commit
2b0fc7efc4
|
@ -1,5 +1,4 @@
|
|||
var Calendar = function(dom,page_id){
|
||||
|
||||
var Calendar = function(dom,page_id,event_date=''){
|
||||
c = this;
|
||||
this.title = $("#current_title");
|
||||
this.calendar = $(dom);
|
||||
|
@ -18,7 +17,13 @@ var Calendar = function(dom,page_id){
|
|||
var agendaView = new AgendaView(c);
|
||||
var loadeventsonviewchange = false;
|
||||
this.initialize = function(){
|
||||
var date = new Date();
|
||||
if (event_date != ''){
|
||||
var event_dates = event_date.split("-");
|
||||
var date = new Date(event_dates[0],event_dates[1],event_dates[2]);
|
||||
}else{
|
||||
var date = new Date();
|
||||
}
|
||||
// var date = new Date();
|
||||
var d = date.getDate();
|
||||
var m = date.getMonth();
|
||||
var y = date.getFullYear();
|
||||
|
@ -47,6 +52,10 @@ var Calendar = function(dom,page_id){
|
|||
c.dialog.show({"x":e.originalEvent.clientX,"y":e.originalEvent.clientY});
|
||||
}
|
||||
});
|
||||
|
||||
if (event_date != ''){
|
||||
c.calendar.fullCalendar('gotoDate', y, (m - 1), d);
|
||||
}
|
||||
|
||||
c.nextBtn.click(function(){
|
||||
c.dialog.dismiss();
|
||||
|
|
|
@ -122,6 +122,9 @@
|
|||
ed = new Date(eve.end),
|
||||
timeDiff = Math.abs(ed.getTime() - sd.getTime()),
|
||||
dayDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
||||
if(eve.allDay){
|
||||
dayDiff = 1 ;
|
||||
}
|
||||
if(dayDiff > 0){
|
||||
var inserting_date = (sd < firstDay ? 1 : sd.getDate());
|
||||
for(i = 0;i <= dayDiff; i++){
|
||||
|
@ -130,7 +133,7 @@
|
|||
td.addClass("w-calendar-event");
|
||||
if(index_url != ""){
|
||||
td.on("click",function(){
|
||||
window.location.href = "http://" + window.location.host + index_url;
|
||||
window.location.href = "http://" + window.location.host + index_url + '/' + eve.id + '-';
|
||||
})
|
||||
}
|
||||
inserting_date++;
|
||||
|
|
|
@ -11,6 +11,15 @@ class CalendarsController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def show
|
||||
params = OrbitHelper.params
|
||||
event = Event.find(params[:uid])
|
||||
{
|
||||
"page_id" => params[:page_id],
|
||||
"event_date" => event.start.strftime("%Y-%m-%d")
|
||||
}
|
||||
end
|
||||
|
||||
def widget
|
||||
part = OrbitHelper.get_current_widget
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
||||
<%= javascript_include_tag 'fullcalendar' %>
|
||||
<%= javascript_include_tag 'calendar_frontend' %>
|
||||
<%= stylesheet_link_tag "fullcalendar"%>
|
||||
<%= stylesheet_link_tag "calendar"%>
|
||||
|
||||
<%= render_view %>
|
Loading…
Reference in New Issue