Updated Calendar frontend
This commit is contained in:
parent
b1867dd47a
commit
54f778f17d
|
@ -0,0 +1,45 @@
|
|||
class Panel::CalendarNew::FrontEnd::EventsController < OrbitWidgetController
|
||||
# GET /events
|
||||
# GET /events.json
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'calendar'
|
||||
end
|
||||
|
||||
def index
|
||||
@item = Page.find(params[:page_id])
|
||||
@title = @item.title
|
||||
if !@item.frontend_data_count.blank?
|
||||
@page_num = @item.frontend_data_count
|
||||
else
|
||||
@page_num = 10
|
||||
end
|
||||
|
||||
if params[:start].present? && params[:end].present?
|
||||
sdt = Time.at(params[:start].to_i)
|
||||
edt = Time.at(params[:end].to_i)
|
||||
@monthly_events = Event.monthly_event(sdt,edt)
|
||||
@re = Event.recurring_event(sdt,edt)
|
||||
@events = @monthly_events.inject(@re, :<<)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @events }
|
||||
end
|
||||
end
|
||||
def show
|
||||
@event = Event.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @event }
|
||||
end
|
||||
end
|
||||
|
||||
def agenda
|
||||
agenda_start = Date.parse(params[:agenda_start])
|
||||
agenda_end = Date.parse(params[:agenda_end])
|
||||
@events = Event.agenda_events(agenda_start,agenda_end)
|
||||
render :json=>@events.to_json
|
||||
end
|
||||
end
|
|
@ -8,10 +8,10 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :events
|
||||
end
|
||||
namespace :front_end do
|
||||
match 'events/agenda' => 'events#agenda', :as => :agenda
|
||||
resources :events
|
||||
end
|
||||
namespace :front_end do
|
||||
match 'events/agenda' => 'events#agenda', :as => :agenda
|
||||
resources :events, except: [:new, :edit, :update, :destroy]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module CalendarNew
|
|||
|
||||
front_end do
|
||||
app_page 'events' do
|
||||
frontend_i18n "calendar_new.frontend.events"
|
||||
frontend_i18n "calendar_new.frontend.events"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Reference in New Issue