diff --git a/vendor/built_in_modules/calendar_new/app/controllers/panel/calendar_new/front_end/events_controller.rb b/vendor/built_in_modules/calendar_new/app/controllers/panel/calendar_new/front_end/events_controller.rb new file mode 100644 index 000000000..6e82688da --- /dev/null +++ b/vendor/built_in_modules/calendar_new/app/controllers/panel/calendar_new/front_end/events_controller.rb @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/calendar_new/config/routes.rb b/vendor/built_in_modules/calendar_new/config/routes.rb index fd411537e..d097d2c13 100644 --- a/vendor/built_in_modules/calendar_new/config/routes.rb +++ b/vendor/built_in_modules/calendar_new/config/routes.rb @@ -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 diff --git a/vendor/built_in_modules/calendar_new/init.rb b/vendor/built_in_modules/calendar_new/init.rb index b95f9d458..486f10ec9 100644 --- a/vendor/built_in_modules/calendar_new/init.rb +++ b/vendor/built_in_modules/calendar_new/init.rb @@ -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