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;
|
c = this;
|
||||||
this.title = $("#current_title");
|
this.title = $("#current_title");
|
||||||
this.calendar = $(dom);
|
this.calendar = $(dom);
|
||||||
|
@ -18,7 +17,13 @@ var Calendar = function(dom,page_id){
|
||||||
var agendaView = new AgendaView(c);
|
var agendaView = new AgendaView(c);
|
||||||
var loadeventsonviewchange = false;
|
var loadeventsonviewchange = false;
|
||||||
this.initialize = function(){
|
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 d = date.getDate();
|
||||||
var m = date.getMonth();
|
var m = date.getMonth();
|
||||||
var y = date.getFullYear();
|
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});
|
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.nextBtn.click(function(){
|
||||||
c.dialog.dismiss();
|
c.dialog.dismiss();
|
||||||
|
|
|
@ -122,6 +122,9 @@
|
||||||
ed = new Date(eve.end),
|
ed = new Date(eve.end),
|
||||||
timeDiff = Math.abs(ed.getTime() - sd.getTime()),
|
timeDiff = Math.abs(ed.getTime() - sd.getTime()),
|
||||||
dayDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
dayDiff = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
||||||
|
if(eve.allDay){
|
||||||
|
dayDiff = 1 ;
|
||||||
|
}
|
||||||
if(dayDiff > 0){
|
if(dayDiff > 0){
|
||||||
var inserting_date = (sd < firstDay ? 1 : sd.getDate());
|
var inserting_date = (sd < firstDay ? 1 : sd.getDate());
|
||||||
for(i = 0;i <= dayDiff; i++){
|
for(i = 0;i <= dayDiff; i++){
|
||||||
|
@ -130,7 +133,7 @@
|
||||||
td.addClass("w-calendar-event");
|
td.addClass("w-calendar-event");
|
||||||
if(index_url != ""){
|
if(index_url != ""){
|
||||||
td.on("click",function(){
|
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++;
|
inserting_date++;
|
||||||
|
|
|
@ -11,6 +11,15 @@ class CalendarsController < ApplicationController
|
||||||
}
|
}
|
||||||
end
|
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
|
def widget
|
||||||
part = OrbitHelper.get_current_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