diff options
| author | Zog | 2018-01-31 11:39:39 +0100 | 
|---|---|---|
| committer | Zog | 2018-01-31 11:39:39 +0100 | 
| commit | fe7915ffac359db41c7737a3847f31a728f502e6 (patch) | |
| tree | e733b44018321cc8eec28b147813cb279db40b7a /app/controllers/calendars_controller.rb | |
| parent | 4023ea52097a47458ac2fcad36d343aba0c8e68b (diff) | |
| download | chouette-core-fe7915ffac359db41c7737a3847f31a728f502e6.tar.bz2 | |
Refs #5683 @2H; Fix specs and refactor action_links
Note: Did not fix the missing workgroup in the calendar mailer
Diffstat (limited to 'app/controllers/calendars_controller.rb')
| -rw-r--r-- | app/controllers/calendars_controller.rb | 21 | 
1 files changed, 10 insertions, 11 deletions
| diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 193680342..6f1522428 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -4,7 +4,7 @@ class CalendarsController < ChouetteController    before_action :ransack_contains_date, only: [:index]    respond_to :html    respond_to :js, only: :index -   +    belongs_to :workgroup    def index @@ -24,9 +24,8 @@ class CalendarsController < ChouetteController    private    def decorate_calendars(calendars) -    ModelDecorator.decorate( +    CalendarDecorator.decorate(        calendars, -      with: CalendarDecorator,        context: {          workgroup: workgroup        } @@ -65,13 +64,13 @@ class CalendarsController < ChouetteController    def collection      @calendars ||= begin -		    scope = workgroup.calendars.where('(organisation_id = ? OR shared = ?)', current_organisation.id, true) -		    scope = shared_scope(scope) -		    @q = scope.ransack(params[:q]) -		    calendars = @q.result -		    calendars = calendars.order(sort_column + ' ' + sort_direction) if sort_column && sort_direction -		    calendars = calendars.paginate(page: params[:page]) -                  end  +      scope = workgroup.calendars.where('(organisation_id = ? OR shared = ?)', current_organisation.id, true) +      scope = shared_scope(scope) +      @q = scope.ransack(params[:q]) +      calendars = @q.result +      calendars = calendars.order(sort_column + ' ' + sort_direction) if sort_column && sort_direction +      calendars = calendars.paginate(page: params[:page]) +    end    end    def ransack_contains_date @@ -96,4 +95,4 @@ class CalendarsController < ChouetteController      scope    end -end
\ No newline at end of file +end | 
