Merge pull request #1366 from betagouv/fix_1360-upgrade_smart_listing
[#1360] Upgrade SmartListing to fork of 1.2.1
This commit is contained in:
commit
1c8ae50045
9 changed files with 136 additions and 7 deletions
5
Gemfile
5
Gemfile
|
@ -76,7 +76,10 @@ gem 'hashie'
|
||||||
|
|
||||||
gem 'mailjet'
|
gem 'mailjet'
|
||||||
|
|
||||||
gem 'smart_listing'
|
# 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 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
|
gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
|
||||||
|
|
||||||
|
|
18
Gemfile.lock
18
Gemfile.lock
|
@ -15,6 +15,17 @@ GIT
|
||||||
open4 (~> 1.3.4)
|
open4 (~> 1.3.4)
|
||||||
rake
|
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
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
@ -671,11 +682,6 @@ GEM
|
||||||
tilt (~> 2.0)
|
tilt (~> 2.0)
|
||||||
skylight (1.5.0)
|
skylight (1.5.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
smart_listing (1.2.0)
|
|
||||||
coffee-rails
|
|
||||||
jquery-rails
|
|
||||||
kaminari (~> 0.17)
|
|
||||||
rails (>= 3.2)
|
|
||||||
spreadsheet_architect (2.0.2)
|
spreadsheet_architect (2.0.2)
|
||||||
axlsx (>= 2.0)
|
axlsx (>= 2.0)
|
||||||
axlsx_styler (>= 0.1.7)
|
axlsx_styler (>= 0.1.7)
|
||||||
|
@ -827,7 +833,7 @@ DEPENDENCIES
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
simple_form
|
simple_form
|
||||||
skylight
|
skylight
|
||||||
smart_listing
|
smart_listing!
|
||||||
spreadsheet_architect
|
spreadsheet_architect
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
|
|
|
@ -6,6 +6,16 @@ class Admin::AccompagnateursController < AdminController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
assign_scope = @procedure.gestionnaires
|
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,
|
@accompagnateurs_assign = smart_listing_create :accompagnateurs_assign,
|
||||||
assign_scope,
|
assign_scope,
|
||||||
partial: "admin/accompagnateurs/list_assign",
|
partial: "admin/accompagnateurs/list_assign",
|
||||||
|
@ -14,6 +24,15 @@ class Admin::AccompagnateursController < AdminController
|
||||||
not_assign_scope = current_administrateur.gestionnaires.where.not(id: assign_scope.ids)
|
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]
|
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,
|
@accompagnateurs_not_assign = smart_listing_create :accompagnateurs_not_assign,
|
||||||
not_assign_scope,
|
not_assign_scope,
|
||||||
partial: "admin/accompagnateurs/list_not_assign",
|
partial: "admin/accompagnateurs/list_not_assign",
|
||||||
|
|
|
@ -3,6 +3,12 @@ class Admin::GestionnairesController < AdminController
|
||||||
helper SmartListing::Helper
|
helper SmartListing::Helper
|
||||||
|
|
||||||
def index
|
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,
|
@gestionnaires = smart_listing_create :gestionnaires,
|
||||||
current_administrateur.gestionnaires,
|
current_administrateur.gestionnaires,
|
||||||
partial: "admin/gestionnaires/list",
|
partial: "admin/gestionnaires/list",
|
||||||
|
|
|
@ -5,6 +5,12 @@ class Admin::ProceduresController < AdminController
|
||||||
before_action :retrieve_procedure, only: [:show, :edit]
|
before_action :retrieve_procedure, only: [:show, :edit]
|
||||||
|
|
||||||
def index
|
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,
|
@procedures = smart_listing_create :procedures,
|
||||||
current_administrateur.procedures.publiees.order(published_at: :desc),
|
current_administrateur.procedures.publiees.order(published_at: :desc),
|
||||||
partial: "admin/procedures/list",
|
partial: "admin/procedures/list",
|
||||||
|
@ -14,6 +20,12 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def archived
|
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,
|
@procedures = smart_listing_create :procedures,
|
||||||
current_administrateur.procedures.archivees.order(published_at: :desc),
|
current_administrateur.procedures.archivees.order(published_at: :desc),
|
||||||
partial: "admin/procedures/list",
|
partial: "admin/procedures/list",
|
||||||
|
@ -25,6 +37,12 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def draft
|
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,
|
@procedures = smart_listing_create :procedures,
|
||||||
current_administrateur.procedures.brouillons.order(created_at: :desc),
|
current_administrateur.procedures.brouillons.order(created_at: :desc),
|
||||||
partial: "admin/procedures/list",
|
partial: "admin/procedures/list",
|
||||||
|
|
|
@ -109,4 +109,31 @@ class ApplicationController < ActionController::Base
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -29,6 +29,12 @@ class Users::DossiersController < UsersController
|
||||||
return redirect_to users_dossiers_path
|
return redirect_to users_dossiers_path
|
||||||
end
|
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 = smart_listing_create :dossiers,
|
||||||
@dossiers_filtered,
|
@dossiers_filtered,
|
||||||
partial: "users/dossiers/list",
|
partial: "users/dossiers/list",
|
||||||
|
|
|
@ -14,6 +14,17 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
end
|
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
|
describe 'POST #create' do
|
||||||
let(:email) { 'test@plop.com' }
|
let(:email) { 'test@plop.com' }
|
||||||
let(:procedure_id) { nil }
|
let(:procedure_id) { nil }
|
||||||
|
|
|
@ -42,18 +42,51 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
it { expect(response.status).to eq(200) }
|
it { expect(response.status).to eq(200) }
|
||||||
end
|
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
|
describe 'GET #archived' do
|
||||||
subject { get :archived }
|
subject { get :archived }
|
||||||
|
|
||||||
it { expect(response.status).to eq(200) }
|
it { expect(response.status).to eq(200) }
|
||||||
end
|
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
|
describe 'GET #published' do
|
||||||
subject { get :published }
|
subject { get :published }
|
||||||
|
|
||||||
it { expect(response.status).to eq(200) }
|
it { expect(response.status).to eq(200) }
|
||||||
end
|
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
|
describe 'DELETE #destroy' do
|
||||||
let(:procedure_draft) { create :procedure, administrateur: admin, published_at: nil, archived_at: nil }
|
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 }
|
let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil }
|
||||||
|
|
Loading…
Reference in a new issue