diff --git a/Gemfile b/Gemfile index a2cf98132..8dcca1dac 100644 --- a/Gemfile +++ b/Gemfile @@ -76,14 +76,11 @@ gem 'hashie' gem 'mailjet' -# FIXME: this is a fork, go back to official version -# once https://github.com/Sology/smart_listing/pull/139 -# has been merged and released -gem 'smart_listing', git: 'https://github.com/mizinsky/smart_listing.git', branch: 'kaminari-update' +gem 'smart_listing' gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8' -gem 'spreadsheet_architect' +gem 'spreadsheet_architect', '~> 1.4.8' # https://github.com/westonganger/spreadsheet_architect/issues/14 gem 'apipie-rails' # For Markdown support in apipie diff --git a/Gemfile.lock b/Gemfile.lock index dd78b407a..f8a50a1ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,17 +15,6 @@ GIT open4 (~> 1.3.4) rake -GIT - remote: https://github.com/mizinsky/smart_listing.git - revision: bcdd4f25954fc6f4faa3d6ea6ea9a69c65da678b - branch: kaminari-update - specs: - smart_listing (1.2.1) - coffee-rails - jquery-rails - kaminari (>= 0.17) - rails (>= 3.2) - GEM remote: https://rubygems.org/ specs: @@ -101,9 +90,6 @@ GEM htmlentities (~> 4.3.1) nokogiri (>= 1.4.1) rubyzip (~> 1.0.0) - axlsx_styler (0.1.7) - activesupport (>= 3.1) - axlsx (~> 2.0) bcrypt (3.1.11) bindata (2.4.1) bindex (0.5.0) @@ -596,10 +582,10 @@ GEM rgeo (1.0.0) rgeo-geojson (2.0.0) rgeo (~> 1.0) - rodf (1.0.0) - activesupport (>= 3.0) - builder (>= 3.0) - rubyzip (>= 1.0) + rodf (0.3.7) + activesupport (>= 3.0, < 6.0) + builder (~> 3.0) + rubyzip (~> 1.0) rspec (3.5.0) rspec-core (~> 3.5.0) rspec-expectations (~> 3.5.0) @@ -682,10 +668,14 @@ GEM tilt (~> 2.0) skylight (1.5.0) activesupport (>= 3.0.0) - spreadsheet_architect (2.0.2) + smart_listing (1.2.0) + coffee-rails + jquery-rails + kaminari (~> 0.17) + rails (>= 3.2) + spreadsheet_architect (1.4.8) axlsx (>= 2.0) - axlsx_styler (>= 0.1.7) - rodf (>= 1.0.0) + rodf (= 0.3.7) spring (2.0.2) activesupport (>= 4.2) spring-commands-rspec (1.0.4) @@ -833,8 +823,8 @@ DEPENDENCIES shoulda-matchers simple_form skylight - smart_listing! - spreadsheet_architect + smart_listing + spreadsheet_architect (~> 1.4.8) spring spring-commands-rspec therubyracer diff --git a/app/controllers/admin/accompagnateurs_controller.rb b/app/controllers/admin/accompagnateurs_controller.rb index 1f7ca7c7f..259f6112f 100644 --- a/app/controllers/admin/accompagnateurs_controller.rb +++ b/app/controllers/admin/accompagnateurs_controller.rb @@ -6,16 +6,6 @@ class Admin::AccompagnateursController < AdminController def show assign_scope = @procedure.gestionnaires - - # FIXME: remove this comment (no code to remove) when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed. - # - # No need to permit parameters for smart_listing, because - # there are no sortable columns - # - # END OF FIXME - @accompagnateurs_assign = smart_listing_create :accompagnateurs_assign, assign_scope, partial: "admin/accompagnateurs/list_assign", @@ -24,15 +14,6 @@ class Admin::AccompagnateursController < AdminController not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids) not_assign_scope = not_assign_scope.where("email LIKE ?", "%#{params[:filter]}%") if params[:filter] - # FIXME: remove this comment (no code to remove) when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed. - # - # No need to permit parameters for smart_listing, because - # there are no sortable columns - # - # END OF FIXME - @accompagnateurs_not_assign = smart_listing_create :accompagnateurs_not_assign, not_assign_scope, partial: "admin/accompagnateurs/list_not_assign", diff --git a/app/controllers/admin/gestionnaires_controller.rb b/app/controllers/admin/gestionnaires_controller.rb index f6bdb1966..e8f1848f3 100644 --- a/app/controllers/admin/gestionnaires_controller.rb +++ b/app/controllers/admin/gestionnaires_controller.rb @@ -3,12 +3,6 @@ class Admin::GestionnairesController < AdminController helper SmartListing::Helper def index - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - permit_smart_listing_params - # END OF FIXME - @gestionnaires = smart_listing_create :gestionnaires, current_administrateur.gestionnaires, partial: "admin/gestionnaires/list", diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index c827ad5b6..e451af182 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -5,12 +5,6 @@ class Admin::ProceduresController < AdminController before_action :retrieve_procedure, only: [:show, :edit] def index - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - permit_smart_listing_params - # END OF FIXME - @procedures = smart_listing_create :procedures, current_administrateur.procedures.publiees.order(published_at: :desc), partial: "admin/procedures/list", @@ -20,12 +14,6 @@ class Admin::ProceduresController < AdminController end def archived - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - permit_smart_listing_params - # END OF FIXME - @procedures = smart_listing_create :procedures, current_administrateur.procedures.archivees.order(published_at: :desc), partial: "admin/procedures/list", @@ -37,12 +25,6 @@ class Admin::ProceduresController < AdminController end def draft - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - permit_smart_listing_params - # END OF FIXME - @procedures = smart_listing_create :procedures, current_administrateur.procedures.brouillons.order(created_at: :desc), partial: "admin/procedures/list", diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4fa001a2b..559acd6df 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -109,31 +109,4 @@ class ApplicationController < ActionController::Base }) end end - - def permit_smart_listing_params - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - self.params = params.permit( - dossiers_smart_listing: - [ - :page, - :per_page, - { sort: [:id, :'procedure.libelle', :state, :updated_at] } - ], - gestionnaires_smart_listing: - [ - :page, - :per_page, - { sort: [:email] } - ], - procedures_smart_listing: - [ - :page, - :per_page, - { sort: [:id, :libelle, :published_at] } - ] - ) - # END OF FIXME - end end diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index f7effb1ed..9c042590e 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -29,12 +29,6 @@ class Users::DossiersController < UsersController return redirect_to users_dossiers_path end - # FIXME: remove when - # https://github.com/Sology/smart_listing/issues/134 - # is fixed - permit_smart_listing_params - # END OF FIXME - @dossiers = smart_listing_create :dossiers, @dossiers_filtered, partial: "users/dossiers/list", diff --git a/spec/controllers/admin/gestionnaires_controller_spec.rb b/spec/controllers/admin/gestionnaires_controller_spec.rb index 1e2c701f9..3d2bcf246 100644 --- a/spec/controllers/admin/gestionnaires_controller_spec.rb +++ b/spec/controllers/admin/gestionnaires_controller_spec.rb @@ -14,17 +14,6 @@ describe Admin::GestionnairesController, type: :controller do it { expect(subject.status).to eq(200) } end - describe 'GET #index with sorting and pagination' do - subject { - get :index, - 'gestionnaires_smart_listing[page]': 1, - 'gestionnaires_smart_listing[per_page]': 10, - 'gestionnaires_smart_listing[sort][email]': 'asc' - } - - it { expect(subject.status).to eq(200) } - end - describe 'POST #create' do let(:email) { 'test@plop.com' } let(:procedure_id) { nil } diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb index 2ea08fd37..829b3a7cb 100644 --- a/spec/controllers/admin/procedures_controller_spec.rb +++ b/spec/controllers/admin/procedures_controller_spec.rb @@ -42,51 +42,18 @@ describe Admin::ProceduresController, type: :controller do it { expect(response.status).to eq(200) } end - describe 'GET #index with sorting and pagination' do - subject { - get :index, - 'procedures_smart_listing[page]': 1, - 'procedures_smart_listing[per_page]': 10, - 'procedures_smart_listing[sort][id]': 'asc' - } - - it { expect(subject.status).to eq(200) } - end - describe 'GET #archived' do subject { get :archived } it { expect(response.status).to eq(200) } end - describe 'GET #archived with sorting and pagination' do - subject { - get :archived, - 'procedures_smart_listing[page]': 1, - 'procedures_smart_listing[per_page]': 10, - 'procedures_smart_listing[sort][libelle]': 'asc' - } - - it { expect(subject.status).to eq(200) } - end - describe 'GET #published' do subject { get :published } it { expect(response.status).to eq(200) } end - describe 'GET #draft with sorting and pagination' do - subject { - get :draft, - 'procedures_smart_listing[page]': 1, - 'procedures_smart_listing[per_page]': 10, - 'procedures_smart_listing[sort][published_at]': 'asc' - } - - it { expect(subject.status).to eq(200) } - end - describe 'DELETE #destroy' do let(:procedure_draft) { create :procedure, administrateur: admin, published_at: nil, archived_at: nil } let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil }