class DashboardController

Public Instance Methods

personal_calendar() click to toggle source

To render fullcalendar

# File app/controllers/dashboard_controller.rb, line 22
def personal_calendar
  if params[:user_id]
    @other_user = User.find_by_id(params[:user_id])
  end
end
show() click to toggle source

Get all the information related to user i.e. his comments, invoices, schedules to be displayed on his dashboard and if current user is tutor it will display reviews also.

# File app/controllers/dashboard_controller.rb, line 9
def show
  @invoices = current_user.invoices.valid.unpaid.order("created_at desc").limit(5)
  @start_date = Date.today_in_time_zone.beginning_of_week(:sunday)
  @end_date = @start_date.end_of_week(:sunday)
  if current_user.tutor?
    @tutor = current_user
    @reviews = @tutor.recieved_reviews.order("average_review DESC").page(1).per(9)
  elsif current_user.student?
    @student = current_user
  end
end