app/controllers/meetings_controller.rb
# Index of the meetings for the current sport/academic year.
#
# === Optional parameters:
# - text:       a text to be added to the title in between brackets;
# - swimmer_id: a Swimmer id to be highlighted among the results;
# - team_id:    a Team id to be highlighted among the results.
#
Index of the meetings for the current sport/academic year.
Optional parameters:
text:       a text to be added to the title in between brackets;
swimmer_id: a Swimmer id to be highlighted among the results;
team_id:    a Team id to be highlighted among the results.
Index of the meetings for the current sport / academic year . Optional parameters : text : a text to be added to the title in between brackets ; swimmer_id : a Swimmer id to be highlighted among the results ; team_id : a Team id to be highlighted among the results .
def current
    params.permit!()
    @start_date = "#{Date.today.prev_day(8)}"
    @end_date   = "#{Date.today.next_month(10)}"
    @title = if params[:text].to_s.size > 0
      I18n.t('meeting.current_title') + " ('#{ params[:text] }', #{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })"
    else
      I18n.t('meeting.current_title') + " (#{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })"
    end
    @preselected_swimmer_id = params[:swimmer_id].to_i if params[:swimmer_id]
    @preselected_team_id    = params[:team_id].to_i if params[:team_id]
    @calendarMeetingPicker = CalendarMeetingPicker.new( @start_date, @end_date )
    @calendarDAO = @calendarMeetingPicker.pick_meetings( 'ASC', false, current_user )
    @meetings = @calendarDAO.get_paginated_meetings( params[:page] || 1 )
  end
def current params . permit! ( ) @start_date = "#{Date.today.prev_day(8)}" @end_date = "#{Date.today.next_month(10)}" @title = if params [ :text ] . to_s . size > 0 I18n . t ( 'meeting.current_title' ) + " ('#{ params[:text] }', #{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })" else I18n . t ( 'meeting.current_title' ) + " (#{ Format.a_date(@start_date) } ... #{ Format.a_date(@end_date) })" end @preselected_swimmer_id = params [ :swimmer_id ] . to_i if params [ :swimmer_id ] @preselected_team_id = params [ :team_id ] . to_i if params [ :team_id ] @calendarMeetingPicker = CalendarMeetingPicker . new ( @start_date , @end_date ) @calendarDAO = @calendarMeetingPicker . pick_meetings ( 'ASC' , false , current_user ) @meetings = @calendarDAO . get_paginated_meetings ( params [ :page ] || 1 ) end
Index of the meetings for the current sport/academic year.
Index of the meetings for the current sport / academic year .
# [Steve, 20161001] We need to whitelist all parameters for the search query: # Calendar DAO using a costructor which selects meeting using dates