Merge pull request #422 from sgmap/rubocop

Rubocop
This commit is contained in:
gregoirenovel 2017-06-13 10:38:09 +02:00 committed by GitHub
commit a74ac79489
214 changed files with 1516 additions and 661 deletions

1059
.rubocop.yml Normal file

File diff suppressed because it is too large Load diff

View file

@ -417,6 +417,7 @@ GEM
openstack (3.3.7) openstack (3.3.7)
json json
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.11.2)
parser (2.4.0.0) parser (2.4.0.0)
ast (~> 2.2) ast (~> 2.2)
pg (0.19.0) pg (0.19.0)
@ -471,7 +472,8 @@ GEM
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.2.1) rainbow (2.2.2)
rake
raindrops (0.17.0) raindrops (0.17.0)
rake (12.0.0) rake (12.0.0)
rb-fsevent (0.9.8) rb-fsevent (0.9.8)
@ -522,7 +524,8 @@ GEM
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.5.0)
rspec-support (3.5.0) rspec-support (3.5.0)
rubocop (0.48.1) rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0) parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
@ -618,7 +621,7 @@ GEM
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
unicode-display_width (1.1.3) unicode-display_width (1.2.1)
unicode_utils (1.4.0) unicode_utils (1.4.0)
unicorn (5.2.0) unicorn (5.2.0)
kgio (~> 2.6) kgio (~> 2.6)

View file

@ -24,7 +24,6 @@
# * zeus: 'zeus rspec' (requires the server to be started separetly) # * zeus: 'zeus rspec' (requires the server to be started separetly)
# * 'just' rspec: 'rspec' # * 'just' rspec: 'rspec'
guard 'livereload' do guard 'livereload' do
extensions = { extensions = {
css: :css, css: :css,

View file

@ -19,7 +19,6 @@ task :deploy_ha do
end end
end end
task :deploy_old do task :deploy_old do
domains = %w(37.187.154.237 37.187.249.111) domains = %w(37.187.154.237 37.187.249.111)
domains.each do |domain| domains.each do |domain|
@ -27,7 +26,6 @@ task :deploy_old do
end end
end end
task :deploy_test do task :deploy_test do
domains = %w(192.168.0.116) domains = %w(192.168.0.116)
branch = 'clamav' branch = 'clamav'

View file

@ -7,10 +7,10 @@ class Admin::GestionnairesController < AdminController
current_administrateur.gestionnaires, current_administrateur.gestionnaires,
partial: "admin/gestionnaires/list", partial: "admin/gestionnaires/list",
array: true array: true
@gestionnaire ||= Gestionnaire.new @gestionnaire ||= Gestionnaire.new
end end
def create def create
@gestionnaire = Gestionnaire.find_by_email(params[:gestionnaire][:email]) @gestionnaire = Gestionnaire.find_by_email(params[:gestionnaire][:email])
procedure_id = params[:procedure_id] procedure_id = params[:procedure_id]

View file

@ -40,7 +40,6 @@ class Admin::ProceduresController < AdminController
end end
def edit def edit
end end
def destroy def destroy

View file

@ -11,8 +11,6 @@ class AdministrationsController < ApplicationController
Administrateur.all.order(:email), Administrateur.all.order(:email),
partial: "administrations/list", partial: "administrations/list",
array: true array: true
end end
def create def create

View file

@ -13,5 +13,4 @@ class API::V1::ProceduresController < APIController
Rails.logger.error(e.message) Rails.logger.error(e.message)
render json: {}, status: 404 render json: {}, status: 404
end end
end end

View file

@ -1,5 +1,4 @@
class Backoffice::AvisController < ApplicationController class Backoffice::AvisController < ApplicationController
before_action :authenticate_gestionnaire!, except: [:sign_up, :create_gestionnaire] before_action :authenticate_gestionnaire!, except: [:sign_up, :create_gestionnaire]
before_action :redirect_if_no_sign_up_needed, only: [:sign_up] before_action :redirect_if_no_sign_up_needed, only: [:sign_up]
before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_gestionnaire] before_action :check_avis_exists_and_email_belongs_to_avis, only: [:sign_up, :create_gestionnaire]

View file

@ -21,5 +21,4 @@ class Backoffice::Dossiers::ProcedureController < Backoffice::DossiersListContro
def retrieve_procedure def retrieve_procedure
current_gestionnaire.procedures.find params[:id] current_gestionnaire.procedures.find params[:id]
end end
end end

View file

@ -172,7 +172,6 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
redirect_to backoffice_dossiers_path redirect_to backoffice_dossiers_path
end end
def unarchive def unarchive
@dossier = Dossier.find(params[:id]) @dossier = Dossier.find(params[:id])
if @dossier.archived if @dossier.archived

View file

@ -31,7 +31,6 @@ class Backoffice::DossiersListController < ApplicationController
dossiers_list_facade liste dossiers_list_facade liste
service = dossiers_list_facade.service service = dossiers_list_facade.service
if param_page.nil? if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page} params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end end

View file

@ -1,5 +1,4 @@
class CguController < ApplicationController class CguController < ApplicationController
def index def index
end end
end end

View file

@ -1,6 +1,6 @@
class Users::RegistrationsController < Devise::RegistrationsController class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create] # before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update] # before_action :configure_account_update_params, only: [:update]
def after_sign_up_path_for(resource_or_scope) def after_sign_up_path_for(resource_or_scope)
WelcomeMailer.welcome_email(resource_or_scope).deliver_now! WelcomeMailer.welcome_email(resource_or_scope).deliver_now!

View file

@ -1,5 +1,5 @@
class Users::SessionsController < Sessions::SessionsController class Users::SessionsController < Sessions::SessionsController
# before_action :configure_sign_in_params, only: [:create] # before_action :configure_sign_in_params, only: [:create]
def demo def demo
return redirect_to root_path if Rails.env.production? return redirect_to root_path if Rails.env.production?
@ -8,7 +8,7 @@ class Users::SessionsController < Sessions::SessionsController
render 'new' render 'new'
end end
# GET /resource/sign_in # GET /resource/sign_in
def new def new
unless user_return_to_procedure_id.nil? # WTF ? unless user_return_to_procedure_id.nil? # WTF ?
@dossier = Dossier.new(procedure: Procedure.active(user_return_to_procedure_id)) @dossier = Dossier.new(procedure: Procedure.active(user_return_to_procedure_id))
@ -19,7 +19,7 @@ class Users::SessionsController < Sessions::SessionsController
error_procedure error_procedure
end end
#POST /resource/sign_in #POST /resource/sign_in
def create def create
remember_me = params[:user][:remember_me] == '1' remember_me = params[:user][:remember_me] == '1'
try_to_authenticate(User, remember_me) try_to_authenticate(User, remember_me)
@ -44,7 +44,7 @@ class Users::SessionsController < Sessions::SessionsController
end end
end end
# DELETE /resource/sign_out # DELETE /resource/sign_out
def destroy def destroy
sign_out :gestionnaire if gestionnaire_signed_in? sign_out :gestionnaire if gestionnaire_signed_in?
sign_out :administrateur if administrateur_signed_in? sign_out :administrateur if administrateur_signed_in?

View file

@ -1,4 +1,3 @@
class DossiersDecorator < Draper::CollectionDecorator class DossiersDecorator < Draper::CollectionDecorator
delegate :current_page, :per_page, :offset, :total_entries, :total_pages delegate :current_page, :per_page, :offset, :total_entries, :total_pages
end end

View file

@ -1,4 +1,3 @@
class EtablissementDecorator < Draper::Decorator class EtablissementDecorator < Draper::Decorator
delegate_all delegate_all
end end

View file

@ -1,5 +1,4 @@
class ProcedureDecorator < Draper::Decorator class ProcedureDecorator < Draper::Decorator
delegate_all delegate_all
def lien def lien

View file

@ -1,4 +1,3 @@
class ProceduresDecorator < Draper::CollectionDecorator class ProceduresDecorator < Draper::CollectionDecorator
delegate :current_page, :per_page, :offset, :total_entries, :total_pages delegate :current_page, :per_page, :offset, :total_entries, :total_pages
end end

View file

@ -1,5 +1,4 @@
class TypeDeChampDecorator < Draper::Decorator class TypeDeChampDecorator < Draper::Decorator
delegate_all delegate_all
def button_up params def button_up params

View file

@ -1,3 +1,2 @@
class TypeDeChampPrivateDecorator < TypeDeChampDecorator class TypeDeChampPrivateDecorator < TypeDeChampDecorator
end end

View file

@ -1,5 +1,4 @@
class DossierFacades class DossierFacades
#TODO rechercher en fonction de la personne/email #TODO rechercher en fonction de la personne/email
def initialize(dossier_id, email, champ_id = nil) def initialize(dossier_id, email, champ_id = nil)
@dossier = Dossier.find(dossier_id) @dossier = Dossier.find(dossier_id)

View file

@ -80,5 +80,4 @@ class DossiersListFacades
def base_url liste def base_url liste
@procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste) @procedure.nil? ? backoffice_dossiers_path(liste: liste) : backoffice_dossiers_procedure_path(id: @procedure.id, liste: liste)
end end
end end

View file

@ -1,5 +1,4 @@
class InviteDossierFacades < DossierFacades class InviteDossierFacades < DossierFacades
#TODO rechercher en fonction de la personne/email #TODO rechercher en fonction de la personne/email
def initialize id, email def initialize id, email
@dossier = Invite.where(email: email, id: id).first!.dossier @dossier = Invite.where(email: email, id: id).first!.dossier

View file

@ -1,7 +1,6 @@
module Carto module Carto
module GeoAPI module GeoAPI
class Driver class Driver
def self.regions def self.regions
call regions_url call regions_url
end end
@ -29,7 +28,6 @@ module Carto
rescue RestClient::ServiceUnavailable rescue RestClient::ServiceUnavailable
nil nil
end end
end end
end end
end end

View file

@ -12,7 +12,6 @@ class SIADE::RNAAdapter
data_source[:association].each do |k, v| data_source[:association].each do |k, v|
params[k] = v if attr_to_fetch.include?(k) params[k] = v if attr_to_fetch.include?(k)
end end
params[:association_id] = params[:id] params[:association_id] = params[:id]

View file

@ -1,9 +1,7 @@
class AvisMailer < ApplicationMailer class AvisMailer < ApplicationMailer
def avis_invitation(avis) def avis_invitation(avis)
@avis = avis @avis = avis
email = @avis.gestionnaire.try(:email) || @avis.email email = @avis.gestionnaire.try(:email) || @avis.email
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})") mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
end end
end end

View file

@ -1,5 +1,4 @@
class GestionnaireMailer < ApplicationMailer class GestionnaireMailer < ApplicationMailer
def new_gestionnaire email, password def new_gestionnaire email, password
send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS" send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS"
end end

View file

@ -1,5 +1,4 @@
class InviteMailer < ApplicationMailer class InviteMailer < ApplicationMailer
def invite_user invite def invite_user invite
vars_mailer invite vars_mailer invite

View file

@ -1,6 +1,5 @@
class NewAdminMailer < ApplicationMailer class NewAdminMailer < ApplicationMailer
def new_admin_email admin, password def new_admin_email admin, password
@admin = admin @admin = admin
@password = password @password = password

View file

@ -1,6 +1,5 @@
class WelcomeMailer < ApplicationMailer class WelcomeMailer < ApplicationMailer
def welcome_email user def welcome_email user
@user = user @user = user
mail(to: user.email, mail(to: user.email,

View file

@ -1,3 +1,2 @@
class ChampPrivate < Champ class ChampPrivate < Champ
end end

View file

@ -1,3 +1,2 @@
class ChampPublic < Champ class ChampPublic < Champ
end end

View file

@ -15,5 +15,4 @@ module CredentialsSyncableConcern
def force_sync_credentials def force_sync_credentials
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials! SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
end end
end end

View file

@ -52,10 +52,8 @@ class Gestionnaire < ActiveRecord::Base
end end
def build_default_preferences_list_dossier procedure_id=nil def build_default_preferences_list_dossier procedure_id=nil
PreferenceListDossier.available_columns_for(procedure_id).each do |table| PreferenceListDossier.available_columns_for(procedure_id).each do |table|
table.second.each do |column| table.second.each do |column|
if valid_couple_table_attr? table.first, column.first if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create( PreferenceListDossier.create(
libelle: column.second[:libelle], libelle: column.second[:libelle],

View file

@ -1,5 +1,4 @@
class Invite < ActiveRecord::Base class Invite < ActiveRecord::Base
belongs_to :dossier belongs_to :dossier
belongs_to :user belongs_to :user

View file

@ -1,3 +1,2 @@
class InviteGestionnaire < Invite class InviteGestionnaire < Invite
end end

View file

@ -1,3 +1,2 @@
class InviteUser < Invite class InviteUser < Invite
end end

View file

@ -88,7 +88,8 @@ class Procedure < ActiveRecord::Base
def clone def clone
procedure = self.deep_clone(include: procedure = self.deep_clone(include:
[:types_de_piece_justificative, [
:types_de_piece_justificative,
:types_de_champ, :types_de_champ,
:types_de_champ_private, :types_de_champ_private,
:module_api_carto, :module_api_carto,

View file

@ -1,3 +1,2 @@
class TypeDeChampPrivate < TypeDeChamp class TypeDeChampPrivate < TypeDeChamp
end end

View file

@ -1,3 +1,2 @@
class TypeDeChampPublic < TypeDeChamp class TypeDeChampPublic < TypeDeChamp
end end

View file

@ -11,5 +11,4 @@ class EtablissementSerializer < ActiveModel::Serializer
:code_postal, :code_postal,
:localite, :localite,
:code_insee_localite :code_insee_localite
end end

View file

@ -2,6 +2,4 @@ class ModuleApiCartoSerializer < ActiveModel::Serializer
attributes :use_api_carto, attributes :use_api_carto,
:quartiers_prioritaires, :quartiers_prioritaires,
:cadastre :cadastre
end end

View file

@ -10,7 +10,6 @@ class ProcedureSerializer < ActiveModel::Serializer
:geographic_information, :geographic_information,
:total_dossier :total_dossier
has_one :geographic_information, serializer: ModuleApiCartoSerializer has_one :geographic_information, serializer: ModuleApiCartoSerializer
has_many :types_de_champ, serializer: TypeDeChampSerializer has_many :types_de_champ, serializer: TypeDeChampSerializer
has_many :types_de_champ_private, serializer: TypeDeChampSerializer has_many :types_de_champ_private, serializer: TypeDeChampSerializer

View file

@ -1,5 +1,4 @@
class BrowserService class BrowserService
def self.get_browser request def self.get_browser request
BROWSER.value = Browser.new(request.user_agent) BROWSER.value = Browser.new(request.user_agent)
end end
@ -15,5 +14,4 @@ class BrowserService
true true
end end
end end

View file

@ -1,6 +1,5 @@
class ClamavService class ClamavService
def self.safe_file? path_file def self.safe_file? path_file
if Rails.env == 'development' if Rails.env == 'development'
return CLAMAV[:response] if CLAMAV[:mock?] return CLAMAV[:response] if CLAMAV[:mock?]
end end

View file

@ -1,5 +1,4 @@
class DossierService class DossierService
def initialize dossier, siret, france_connect_information def initialize dossier, siret, france_connect_information
@dossier = dossier @dossier = dossier
@siret = siret @siret = siret
@ -34,7 +33,6 @@ class DossierService
@dossier @dossier
end end
def self.siren siret def self.siren siret
siret[0..8] siret[0..8]
end end

View file

@ -13,7 +13,6 @@ class DossiersListGestionnaireService
'termine' => termine, 'termine' => termine,
'archive' => archive, 'archive' => archive,
'all_state' => all_state}[@liste] 'all_state' => all_state}[@liste]
end end
def self.dossiers_liste_libelle def self.dossiers_liste_libelle
@ -186,5 +185,4 @@ class DossiersListGestionnaireService
def current_preference_smart_listing_page def current_preference_smart_listing_page
@current_devise_profil.preference_smart_listing_page @current_devise_profil.preference_smart_listing_page
end end
end end

View file

@ -1,5 +1,4 @@
class FranceConnectSaltService class FranceConnectSaltService
attr_reader :model attr_reader :model
def initialize france_connect_information def initialize france_connect_information

View file

@ -11,7 +11,6 @@ class GeojsonService
end end
def self.to_json_polygon_for_cadastre coordinates def self.to_json_polygon_for_cadastre coordinates
polygon = { polygon = {
geom: { geom: {
type: "Feature", type: "Feature",

View file

@ -26,12 +26,14 @@ class ModuleApiCartoService
def self.generate_qp coordinates def self.generate_qp coordinates
coordinates.inject({}) { |acc, coordinate| coordinates.inject({}) { |acc, coordinate|
acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new( acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }).to_params } coordinate.map { |element| [element['lng'], element['lat']] }).to_params
}
end end
def self.generate_cadastre coordinates def self.generate_cadastre coordinates
(coordinates.inject([]) { |acc, coordinate| (coordinates.inject([]) { |acc, coordinate|
acc << CARTO::SGMAP::Cadastre::Adapter.new( acc << CARTO::SGMAP::Cadastre::Adapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }).to_params }).flatten coordinate.map { |element| [element['lng'], element['lat']] }).to_params
}).flatten
end end
end end

View file

@ -1,5 +1,4 @@
class NotificationService class NotificationService
def initialize type_notif, dossier_id, attribut_change='' def initialize type_notif, dossier_id, attribut_change=''
@type_notif = type_notif @type_notif = type_notif
@dossier_id = dossier_id @dossier_id = dossier_id

View file

@ -1,5 +1,4 @@
class RenderPartialService class RenderPartialService
attr_accessor :controller, :method attr_accessor :controller, :method
def initialize controller, method def initialize controller, method

View file

@ -1,5 +1,4 @@
class SyncCredentialsService class SyncCredentialsService
def initialize klass, email_was, email, encrypted_password def initialize klass, email_was, email, encrypted_password
@klass = klass @klass = klass
@email_was = email_was @email_was = email_was

View file

@ -7,7 +7,6 @@ class TypesDeChampService
.permit("#{attributes}" => [:libelle, :description, :order_place, :type_champ, :id, :mandatory, :type, .permit("#{attributes}" => [:libelle, :description, :order_place, :type_champ, :id, :mandatory, :type,
drop_down_list_attributes: [:value, :id]]) drop_down_list_attributes: [:value, :id]])
parameters[attributes].each do |param_first, param_second| parameters[attributes].each do |param_first, param_second|
if param_second[:libelle].empty? if param_second[:libelle].empty?
parameters[attributes].delete(param_first.to_s) parameters[attributes].delete(param_first.to_s)

View file

@ -1,5 +1,4 @@
class UserRoutesAuthorizationService class UserRoutesAuthorizationService
def self.authorized_route? controller, dossier def self.authorized_route? controller, dossier
auth = controller.route_authorization auth = controller.route_authorization

View file

@ -3,7 +3,7 @@
class CerfaUploader < BaseUploader class CerfaUploader < BaseUploader
before :cache, :set_original_filename before :cache, :set_original_filename
# Choose what kind of storage to use for this uploader: # Choose what kind of storage to use for this uploader:
if Features.remote_storage if Features.remote_storage
storage :fog storage :fog
else else

View file

@ -1,7 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class ProcedureLogoUploader < BaseUploader class ProcedureLogoUploader < BaseUploader
def root def root
File.join(Rails.root, "public") File.join(Rails.root, "public")
end end
@ -47,5 +46,4 @@ class ProcedureLogoUploader < BaseUploader
def generate_secure_token def generate_secure_token
SecureRandom.uuid SecureRandom.uuid
end end
end end

View file

@ -1,5 +1,4 @@
class EmailFormatValidator < ActiveModel::Validator class EmailFormatValidator < ActiveModel::Validator
def email_regex def email_regex
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
end end

View file

@ -1,5 +1,4 @@
class ProcedurePathFormatValidator < ActiveModel::Validator class ProcedurePathFormatValidator < ActiveModel::Validator
def path_regex def path_regex
/^[a-z0-9_]{3,30}$/ /^[a-z0-9_]{3,30}$/
end end
@ -8,5 +7,4 @@ class ProcedurePathFormatValidator < ActiveModel::Validator
return false if record.path.blank? return false if record.path.blank?
record.errors[:path] << "Path invalide" unless path_regex.match(record.path) record.errors[:path] << "Path invalide" unless path_regex.match(record.path)
end end
end end

View file

@ -9,6 +9,7 @@ class SiretFormatValidator < ActiveModel::EachValidator
end end
private private
def luhn_checksum(value) def luhn_checksum(value)
accum = 0 accum = 0
value.reverse.each_char.map(&:to_i).each_with_index do |digit, index| value.reverse.each_char.map(&:to_i).each_with_index do |digit, index|

View file

@ -15,7 +15,6 @@ raise "Bad to=#{+ENV['to']}" unless ["staging", "production"].include?(ENV['to']
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil? raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
# set :domain, '5.135.190.60' # set :domain, '5.135.190.60'
set :domain, ENV['domain'] set :domain, ENV['domain']
set :repository, 'https://github.com/sgmap/tps.git' set :repository, 'https://github.com/sgmap/tps.git'
@ -72,7 +71,6 @@ set :shared_paths, [
'app/views/cgu/index.html.haml' 'app/views/cgu/index.html.haml'
] ]
set :rbenv_path, "/usr/local/rbenv/bin/rbenv" set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
# Optional settings: # Optional settings:

View file

@ -14,5 +14,4 @@ Apipie.configure do |config|
Description Description
EOS EOS
end end

View file

@ -1,17 +1,17 @@
SmartListing.configure do |config| SmartListing.configure do |config|
config.global_options({ config.global_options({
#:param_names => { # param names # :param_names => { # param names
#:page => :page, # :page => :page,
#:per_page => :per_page, # :per_page => :per_page,
#:sort => :sort, # :sort => :sort,
#}, # },
#:array => false, # controls whether smart list should be using arrays or AR collections # :array => false, # controls whether smart list should be using arrays or AR collections
#:max_count => nil, # limit number of rows # :max_count => nil, # limit number of rows
#:unlimited_per_page => false, # allow infinite page size # :unlimited_per_page => false, # allow infinite page size
#:paginate => true, # allow pagination # :paginate => true, # allow pagination
#:memorize_per_page => false, # save per page settings in the cookie # :memorize_per_page => false, # save per page settings in the cookie
:page_sizes => [10, 20, 50, 100], # set available page sizes array :page_sizes => [10, 20, 50, 100], # set available page sizes array
#:kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options # :kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options
}) })
config.constants :classes, { config.constants :classes, {
@ -51,25 +51,25 @@ SmartListing.configure do |config|
} }
config.constants :data_attributes, { config.constants :data_attributes, {
#:main => "smart-listing", # :main => "smart-listing",
#:confirmation => "confirmation", # :confirmation => "confirmation",
#:id => "id", # :id => "id",
#:href => "href", # :href => "href",
#:callback_href => "callback-href", # :callback_href => "callback-href",
#:max_count => "max-count", # :max_count => "max-count",
#:inline_edit_backup => "smart-listing-edit-backup", # :inline_edit_backup => "smart-listing-edit-backup",
#:params => "params", # :params => "params",
#:observed => "observed", # :observed => "observed",
#:href => "href", # :href => "href",
#:autoshow => "autoshow", # :autoshow => "autoshow",
#:popover => "slpopover", # :popover => "slpopover",
} }
config.constants :selectors, { config.constants :selectors, {
#:item_action_destroy => "a.destroy", # :item_action_destroy => "a.destroy",
#:edit_cancel => "button.cancel", # :edit_cancel => "button.cancel",
#:row => "tr", # :row => "tr",
#:head => "thead", # :head => "thead",
#:filtering_icon => "i" # :filtering_icon => "i"
} }
end end

View file

@ -1,9 +1,7 @@
require "unicode_utils/upcase" require "unicode_utils/upcase"
class String class String
def upcase def upcase
UnicodeUtils.upcase(self) UnicodeUtils.upcase(self)
end end
end end

View file

@ -1,5 +1,4 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/} get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/}
devise_for :administrations, skip: [:password, :registrations] devise_for :administrations, skip: [:password, :registrations]
@ -144,7 +143,6 @@ Rails.application.routes.draw do
resource :accompagnateurs, only: [:show, :update] resource :accompagnateurs, only: [:show, :update]
resource :previsualisation, only: [:show] resource :previsualisation, only: [:show]
end end
namespace :accompagnateurs do namespace :accompagnateurs do

View file

@ -8,8 +8,6 @@
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation. # documentation.
# Use at least one worker per core if you're on a dedicated server, # Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches. # more will usually help for _short_ waits on databases/caches.
worker_processes 2 worker_processes 2
@ -52,7 +50,6 @@ check_client_connection false
# local variable to guard against running a hook multiple times # local variable to guard against running a hook multiple times
run_once = true run_once = true
before_fork do |server, worker| before_fork do |server, worker|
# the following is highly recomended for Rails + "preload_app true" # the following is highly recomended for Rails + "preload_app true"
# as there's no need for the master process to hold a connection # as there's no need for the master process to hold a connection

View file

@ -13,7 +13,6 @@ class CreateEntreprise < ActiveRecord::Migration
t.integer :date_creation t.integer :date_creation
t.string :nom t.string :nom
t.string :prenom t.string :prenom
end end
add_reference :entreprises, :dossier, references: :dossiers add_reference :entreprises, :dossier, references: :dossiers
end end

View file

@ -30,7 +30,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -30,7 +30,6 @@ class DeviseCreatePros < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -30,7 +30,6 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -30,7 +30,6 @@ class CreateUsers < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -30,7 +30,6 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -1,6 +1,5 @@
class ChangeStateConfirmedToValidated < ActiveRecord::Migration class ChangeStateConfirmedToValidated < ActiveRecord::Migration
def change def change
Dossier.where(state: 'confirmed').update_all(state: 'validated') Dossier.where(state: 'confirmed').update_all(state: 'validated')
end end
end end

View file

@ -7,6 +7,5 @@ class DeleteAttributsToDossier < ActiveRecord::Migration
remove_column :dossiers, :position_lon remove_column :dossiers, :position_lon
remove_column :dossiers, :ref_dossier_carto remove_column :dossiers, :ref_dossier_carto
end end
end end

View file

@ -1,11 +1,8 @@
class UpdateModuleAPICarto < ActiveRecord::Migration class UpdateModuleAPICarto < ActiveRecord::Migration
class Procedure < ActiveRecord::Base class Procedure < ActiveRecord::Base
end end
class ModuleAPICarto < ActiveRecord::Base class ModuleAPICarto < ActiveRecord::Base
end end
def up def up

View file

@ -1,11 +1,8 @@
class CreateFranceConnectInformation < ActiveRecord::Migration class CreateFranceConnectInformation < ActiveRecord::Migration
class User < ActiveRecord::Base class User < ActiveRecord::Base
end end
class FranceConnectInformation < ActiveRecord::Base class FranceConnectInformation < ActiveRecord::Base
end end
def up def up
@ -38,7 +35,6 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
remove_column :users, :france_connect_particulier_id remove_column :users, :france_connect_particulier_id
end end
def down def down
add_column :users, :gender, :string add_column :users, :gender, :string
add_column :users, :given_name, :string add_column :users, :given_name, :string

View file

@ -30,7 +30,6 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
# t.string :unlock_token # Only if unlock strategy is :email or :both # t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps
end end

View file

@ -8,7 +8,6 @@ class PieceJustificativeHaveUser < ActiveRecord::Migration
end end
class User < ActiveRecord::Base class User < ActiveRecord::Base
end end
def change def change

View file

@ -8,7 +8,6 @@ class CerfaHaveUser < ActiveRecord::Migration
end end
class User < ActiveRecord::Base class User < ActiveRecord::Base
end end
def change def change

View file

@ -1,10 +1,8 @@
class SetOriginalFilenameForUploaders < ActiveRecord::Migration class SetOriginalFilenameForUploaders < ActiveRecord::Migration
class PieceJustificative < ActiveRecord::Base class PieceJustificative < ActiveRecord::Base
end end
class Cerfa < ActiveRecord::Base class Cerfa < ActiveRecord::Base
end end
def change def change

View file

@ -1,18 +1,14 @@
class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration
class Dossier < ActiveRecord::Base class Dossier < ActiveRecord::Base
end end
class Champ < ActiveRecord::Base class Champ < ActiveRecord::Base
end end
class Procedure < ActiveRecord::Base class Procedure < ActiveRecord::Base
end end
class TypeDeChamp < ActiveRecord::Base class TypeDeChamp < ActiveRecord::Base
end end
def up def up

View file

@ -1,7 +1,5 @@
class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base class TypeDeChamp < ActiveRecord::Base
end end
def change def change

View file

@ -1,10 +1,8 @@
class BuildDefaultPreferenceListDossier < ActiveRecord::Migration class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
class Gestionnaire < ActiveRecord::Base class Gestionnaire < ActiveRecord::Base
def build_default_preferences_list_dossier def build_default_preferences_list_dossier
PreferenceListDossier.available_columns.each do |table| PreferenceListDossier.available_columns.each do |table|
table.second.each do |column| table.second.each do |column|
if valid_couple_table_attr? table.first, column.first if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create( PreferenceListDossier.create(
libelle: column.second[:libelle], libelle: column.second[:libelle],

View file

@ -1,6 +1,5 @@
class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base class TypeDeChamp < ActiveRecord::Base
end end
def up def up

View file

@ -1,5 +1,4 @@
class AddTypeAttrInChampTable < ActiveRecord::Migration class AddTypeAttrInChampTable < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base class TypeDeChamp < ActiveRecord::Base
has_many :champs has_many :champs
end end

View file

@ -1,6 +1,5 @@
class DeleteValueOfFilterProcedure < ActiveRecord::Migration class DeleteValueOfFilterProcedure < ActiveRecord::Migration
class Gestionnaire < ActiveRecord::Base class Gestionnaire < ActiveRecord::Base
end end
def change def change

View file

@ -4,7 +4,6 @@ class InitiatedAllReceivedMailForProcedure < ActiveRecord::Migration
end end
class MailTemplate < ActiveRecord::Base class MailTemplate < ActiveRecord::Base
end end
class ::MailReceived < MailTemplate class ::MailReceived < MailTemplate

View file

@ -1,6 +1,5 @@
class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration
class PreferenceListDossier < ActiveRecord::Base class PreferenceListDossier < ActiveRecord::Base
end end
def change def change

View file

@ -1,6 +1,5 @@
class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration
class TypeDeChamp < ActiveRecord::Base class TypeDeChamp < ActiveRecord::Base
end end
def change def change

View file

@ -96,10 +96,8 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
has_many :procedures, through: :assign_to has_many :procedures, through: :assign_to
def build_default_preferences_list_dossier procedure_id=nil def build_default_preferences_list_dossier procedure_id=nil
PreferenceListDossier.available_columns_for(procedure_id).each do |table| PreferenceListDossier.available_columns_for(procedure_id).each do |table|
table.second.each do |column| table.second.each do |column|
if valid_couple_table_attr? table.first, column.first if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create( PreferenceListDossier.create(
libelle: column.second[:libelle], libelle: column.second[:libelle],
@ -144,7 +142,6 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
class Procedure < ActiveRecord::Base class Procedure < ActiveRecord::Base
has_many :assign_to, dependent: :destroy has_many :assign_to, dependent: :destroy
has_many :gestionnaires, through: :assign_to has_many :gestionnaires, through: :assign_to
end end
def change def change

View file

@ -1,14 +1,12 @@
class CreateNotification < ActiveRecord::Migration[5.0] class CreateNotification < ActiveRecord::Migration[5.0]
def change def change
create_table :notifications do |t| create_table :notifications do |t|
t.boolean :already_read, default: false t.boolean :already_read, default: false
t.string :liste, array: true t.string :liste, array: true
t.boolean :multiple, default: false t.boolean :multiple, default: false
t.string :type_notif t.string :type_notif
t.datetime :created_at t.datetime :created_at
t.datetime :updated_at t.datetime :updated_at
end end
add_belongs_to :notifications, :dossier add_belongs_to :notifications, :dossier

View file

@ -11,7 +11,6 @@
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170523092900) do ActiveRecord::Schema.define(version: 20170523092900) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -475,5 +474,4 @@ ActiveRecord::Schema.define(version: 20170523092900) do
LEFT JOIN individuals ON ((individuals.dossier_id = dossiers.id))) LEFT JOIN individuals ON ((individuals.dossier_id = dossiers.id)))
LEFT JOIN pieces_justificatives ON ((pieces_justificatives.dossier_id = dossiers.id))); LEFT JOIN pieces_justificatives ON ((pieces_justificatives.dossier_id = dossiers.id)));
SQL SQL
end end

View file

@ -1,5 +1,4 @@
namespace :cloudstorage do namespace :cloudstorage do
task init: :environment do task init: :environment do
os_config = (YAML.load_file(Fog.credentials_path))['default'] os_config = (YAML.load_file(Fog.credentials_path))['default']
@os = OpenStack::Connection.create( @os = OpenStack::Connection.create(
@ -91,7 +90,6 @@ namespace :cloudstorage do
} }
end end
desc 'Clear old documents in tenant' desc 'Clear old documents in tenant'
task :clear do task :clear do
Rake::Task['cloudstorage:init'].invoke Rake::Task['cloudstorage:init'].invoke
@ -110,5 +108,4 @@ namespace :cloudstorage do
@cont.delete_object(object) unless last_modified.utc > (Time.now - 2.year).utc @cont.delete_object(object) unless last_modified.utc > (Time.now - 2.year).utc
} }
end end
end end

View file

View file

@ -12,5 +12,4 @@ describe Admin::PrevisualisationsController, type: :controller do
subject { get :show, params: {procedure_id: procedure.id} } subject { get :show, params: {procedure_id: procedure.id} }
it { expect(subject.status).to eq(200) } it { expect(subject.status).to eq(200) }
end end
end end

View file

@ -31,7 +31,6 @@ describe Admin::ProceduresController, type: :controller do
} }
} }
before do before do
sign_in admin sign_in admin
end end
@ -55,7 +54,6 @@ describe Admin::ProceduresController, type: :controller do
end end
describe 'DELETE #destroy' do describe 'DELETE #destroy' do
let(:procedure_draft) { create :procedure, published: false, archived: false } let(:procedure_draft) { create :procedure, published: false, archived: false }
let(:procedure_published) { create :procedure, published: true, archived: false } let(:procedure_published) { create :procedure, published: true, archived: false }
let(:procedure_archived) { create :procedure, published: false, archived: true } let(:procedure_archived) { create :procedure, published: false, archived: true }
@ -151,7 +149,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.direction).to eq(direction) } it { expect(subject.direction).to eq(direction) }
it { expect(subject.lien_demarche).to eq(lien_demarche) } it { expect(subject.lien_demarche).to eq(lien_demarche) }
it { expect(subject.administrateur_id).to eq(admin.id) } it { expect(subject.administrateur_id).to eq(admin.id) }
end end
describe 'procedure module api carto attributs in database' do describe 'procedure module api carto attributs in database' do
@ -279,7 +276,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] } it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] }
it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] } it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] }
it { expect(subject.use_api_carto).not_to eq procedure_params[:module_api_carto_attributes][:use_api_carto] } it { expect(subject.use_api_carto).not_to eq procedure_params[:module_api_carto_attributes][:use_api_carto] }
end end
end end
end end
@ -466,7 +462,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(body.first['mine']).to be_truthy } it { expect(body.first['mine']).to be_truthy }
it { expect(body.second['label']).to eq(procedure2.path) } it { expect(body.second['label']).to eq(procedure2.path) }
it { expect(body.second['mine']).to be_falsy } it { expect(body.second['mine']).to be_falsy }
end end
context 'filtered' do context 'filtered' do
@ -483,7 +478,6 @@ describe Admin::ProceduresController, type: :controller do
end end
context 'when procedure is archived' do context 'when procedure is archived' do
before do before do
procedure3.update_attribute :archived, true procedure3.update_attribute :archived, true
subject subject

View file

@ -1,11 +1,9 @@
require 'spec_helper' require 'spec_helper'
describe AdministrationsController, type: :controller do describe AdministrationsController, type: :controller do
let(:administration) { create :administration } let(:administration) { create :administration }
describe 'GET #index' do describe 'GET #index' do
subject { get :index } subject { get :index }
context 'when administration user is not connect' do context 'when administration user is not connect' do
@ -13,7 +11,6 @@ describe AdministrationsController, type: :controller do
end end
context 'when administration user is connect' do context 'when administration user is connect' do
before do before do
sign_in administration sign_in administration
end end
@ -23,7 +20,6 @@ describe AdministrationsController, type: :controller do
end end
describe 'POST #create' do describe 'POST #create' do
let(:email) { 'plop@plop.com' } let(:email) { 'plop@plop.com' }
let(:password) { 'password' } let(:password) { 'password' }
@ -43,7 +39,6 @@ describe AdministrationsController, type: :controller do
expect(NewAdminMailer).to receive(:deliver_now!) expect(NewAdminMailer).to receive(:deliver_now!)
subject subject
end end
end end
context 'when email or password are missing' do context 'when email or password are missing' do

View file

@ -2,7 +2,6 @@ require 'spec_helper'
describe API::StatistiquesController, type: :controller do describe API::StatistiquesController, type: :controller do
describe '#GET dossiers_stats' do describe '#GET dossiers_stats' do
before do before do
get :dossiers_stats get :dossiers_stats
end end

View file

@ -95,7 +95,6 @@ describe API::V1::DossiersController do
end end
context 'when procedure is found and belongs to current admin' do context 'when procedure is found and belongs to current admin' do
context 'when dossier does not exist' do context 'when dossier does not exist' do
let(:procedure_id) { procedure.id } let(:procedure_id) { procedure.id }
let(:dossier_id) { 99999 } let(:dossier_id) { 99999 }
@ -144,7 +143,8 @@ describe API::V1::DossiersController do
:code_effectif_entreprise, :code_effectif_entreprise,
:date_creation, :date_creation,
:nom, :nom,
:prenom] } :prenom]
}
subject { super()[:entreprise] } subject { super()[:entreprise] }
it { expect(subject[:siren]).to eq('440117620') } it { expect(subject[:siren]).to eq('440117620') }
@ -164,7 +164,8 @@ describe API::V1::DossiersController do
let(:field_list) { [ let(:field_list) { [
:id, :id,
:libelle, :libelle,
:description] } :description]
}
subject { super()[:types_de_piece_justificative] } subject { super()[:types_de_piece_justificative] }
it { expect(subject.length).to eq 2 } it { expect(subject.length).to eq 2 }
@ -184,9 +185,9 @@ describe API::V1::DossiersController do
end end
let(:field_list) { [ let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] } :url, :created_at, :type_de_piece_justificative_id]
subject { }
super()[:pieces_justificatives].first } subject { super()[:pieces_justificatives].first }
it { expect(subject.keys.include?(:content_url)).to be_truthy } it { expect(subject.keys.include?(:content_url)).to be_truthy }
it { expect(subject[:created_at]).not_to be_nil } it { expect(subject[:created_at]).not_to be_nil }
@ -203,7 +204,8 @@ describe API::V1::DossiersController do
describe 'champs' do describe 'champs' do
let(:field_list) { [ let(:field_list) { [
:url] } :url]
}
subject { super()[:champs] } subject { super()[:champs] }
it { expect(subject.length).to eq 1 } it { expect(subject.length).to eq 1 }
@ -220,7 +222,8 @@ describe API::V1::DossiersController do
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] } :type]
}
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy } it { expect(subject.keys.include?(:id)).to be_truthy }
@ -234,7 +237,8 @@ describe API::V1::DossiersController do
describe 'champs_private' do describe 'champs_private' do
let(:field_list) { [ let(:field_list) { [
:url] } :url]
}
subject { super()[:champs_private] } subject { super()[:champs_private] }
it { expect(subject.length).to eq 1 } it { expect(subject.length).to eq 1 }
@ -251,7 +255,8 @@ describe API::V1::DossiersController do
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] } :type]
}
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy } it { expect(subject.keys.include?(:id)).to be_truthy }
@ -298,9 +303,9 @@ describe API::V1::DossiersController do
describe 'user' do describe 'user' do
let(:field_list) { [ let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] } :url, :created_at, :type_de_piece_justificative_id]
subject { }
super()[:user] } subject { super()[:user] }
it { expect(subject[:email]).not_to be_nil } it { expect(subject[:email]).not_to be_nil }
end end
@ -320,7 +325,8 @@ describe API::V1::DossiersController do
:code_postal, :code_postal,
:localite, :localite,
:code_insee_localite :code_insee_localite
] } ]
}
subject { super()[:etablissement] } subject { super()[:etablissement] }
it { expect(subject[:siret]).to eq('44011762001530') } it { expect(subject[:siret]).to eq('44011762001530') }

Some files were not shown because too many files have changed in this diff Show more