mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
32 lines
981 B
Ruby
32 lines
981 B
Ruby
class CalendarController < ApplicationController
|
|
skip_before_filter :login_required, :only => [:show]
|
|
prepend_before_filter :login_or_feed_token_required, :only => [:show]
|
|
|
|
def show
|
|
@source_view = 'calendar'
|
|
@page_title = t('todos.calendar_page_title')
|
|
|
|
@calendar = Todos::Calendar.new(current_user)
|
|
@projects = @calendar.projects
|
|
@count = current_user.todos.not_completed.are_due.count
|
|
@due_all = current_user.todos.not_completed.are_due.reorder("due")
|
|
|
|
respond_to do |format|
|
|
format.html
|
|
format.ics {
|
|
render :action => 'show', :layout => false, :content_type => Mime::ICS
|
|
}
|
|
format.xml {
|
|
render :xml => @due_all.to_xml( *to_xml_params )
|
|
}
|
|
end
|
|
end
|
|
|
|
def to_xml_params
|
|
if params[:limit_fields] == 'index'
|
|
return [:only => [:id, :created_at, :updated_at, :completed_at] ]
|
|
else
|
|
return [:except => :user_id, :include => [:tags, :predecessors, :successors] ]
|
|
end
|
|
end
|
|
end
|