diff options
| author | Vlatka Pavisic | 2017-01-03 11:47:30 +0100 | 
|---|---|---|
| committer | Vlatka Pavisic | 2017-01-03 11:47:30 +0100 | 
| commit | bac2e1b1bd9111580d161b3282f52460d49783ca (patch) | |
| tree | 10a3bc645e3817b62b4f073b0a126ababda1b78f /app/controllers/calendars_controller.rb | |
| parent | c246e91169a0acea798fba01bfb2d9a360ac3cb0 (diff) | |
| download | chouette-core-bac2e1b1bd9111580d161b3282f52460d49783ca.tar.bz2 | |
Refs #2265 : Calendars search
Diffstat (limited to 'app/controllers/calendars_controller.rb')
| -rw-r--r-- | app/controllers/calendars_controller.rb | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index afa4c129c..697d8a507 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -2,6 +2,9 @@ class CalendarsController < BreadcrumbController    defaults resource_class: Calendar    before_action :check_policy, only: [:edit, :update, :destroy] +  respond_to :html +  respond_to :js, only: :index +    private    def calendar_params      params.require(:calendar).permit(:id, :name, :short_name, :shared, periods_attributes: [:id, :begin, :end, :_destroy], dates: []) @@ -34,8 +37,7 @@ class CalendarsController < BreadcrumbController      end      @q = current_organisation.calendars.search(params[:q]) -    calendars = @q.result(distinct: true) -    ap "FILTERED COLLECTION LENGTH : #{@q.result.length}" +    calendars = @q.result      calendars = calendars.order(sort_column + ' ' + sort_direction) if sort_column && sort_direction      @calendars = calendars.paginate(page: params[:page])    end | 
