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

View file

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

View file

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

View file

@ -7,17 +7,17 @@ class Admin::AccompagnateursController < AdminController
def show
assign_scope = @procedure.gestionnaires
@accompagnateurs_assign = smart_listing_create :accompagnateurs_assign,
assign_scope,
partial: "admin/accompagnateurs/list_assign",
array: true
assign_scope,
partial: "admin/accompagnateurs/list_assign",
array: true
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]
@accompagnateurs_not_assign = smart_listing_create :accompagnateurs_not_assign,
not_assign_scope,
partial: "admin/accompagnateurs/list_not_assign",
array: true
not_assign_scope,
partial: "admin/accompagnateurs/list_not_assign",
array: true
@gestionnaire ||= Gestionnaire.new
end

View file

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

View file

@ -6,18 +6,18 @@ class Admin::ProceduresController < AdminController
def index
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(published: true, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
active_class
end
def archived
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(archived: true).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(archived: true).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
archived_class
@ -26,9 +26,9 @@ class Admin::ProceduresController < AdminController
def draft
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.where(published: false, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
current_administrateur.procedures.where(published: false, archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true
draft_class
@ -40,7 +40,6 @@ class Admin::ProceduresController < AdminController
end
def edit
end
def destroy

View file

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

View file

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

View file

@ -1,5 +1,4 @@
class Backoffice::AvisController < ApplicationController
before_action :authenticate_gestionnaire!, except: [:sign_up, :create_gestionnaire]
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]

View file

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

View file

@ -79,17 +79,17 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
end
smart_listing_create :search,
@dossiers,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
@dossiers,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
rescue RuntimeError
smart_listing_create :search,
[],
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
[],
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def receive
@ -172,7 +172,6 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
redirect_to backoffice_dossiers_path
end
def unarchive
@dossier = Dossier.find(params[:id])
if @dossier.archived

View file

@ -31,7 +31,6 @@ class Backoffice::DossiersListController < ApplicationController
dossiers_list_facade liste
service = dossiers_list_facade.service
if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end
@ -48,10 +47,10 @@ class Backoffice::DossiersListController < ApplicationController
def default_smart_listing_create name, collection
smart_listing_create name,
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
collection,
partial: 'backoffice/dossiers/list',
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def param_smart_listing

View file

@ -15,14 +15,14 @@ class BackofficeController < ApplicationController
def invitations
pending_avis = current_gestionnaire.avis.without_answer.includes(dossier: [:procedure]).by_latest
@pending_avis = smart_listing_create :pending_avis,
pending_avis,
partial: 'backoffice/dossiers/list_invitations',
array: true
pending_avis,
partial: 'backoffice/dossiers/list_invitations',
array: true
avis_with_answer = current_gestionnaire.avis.with_answer.includes(dossier: [:procedure]).by_latest
@avis_with_answer = smart_listing_create :avis_with_answer,
avis_with_answer,
partial: 'backoffice/dossiers/list_invitations',
array: true
avis_with_answer,
partial: 'backoffice/dossiers/list_invitations',
array: true
end
end

View file

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

View file

@ -1,9 +1,9 @@
class CommentairesController < ApplicationController
def index
@facade = DossierFacades.new(
params[:dossier_id],
(current_gestionnaire || current_user).email,
params[:champs_id]
params[:dossier_id],
(current_gestionnaire || current_user).email,
params[:champs_id]
)
render layout: false
rescue ActiveRecord::RecordNotFound

View file

@ -6,8 +6,8 @@ class DemoController < ApplicationController
return redirect_to root_path if Rails.env.production?
smart_listing_create :procedures,
Procedure.where(archived: false, published: true).order("id DESC"),
partial: "demo/list",
array: true
Procedure.where(archived: false, published: true).order("id DESC"),
partial: "demo/list",
array: true
end
end

View file

@ -61,7 +61,7 @@ class StatsController < ApplicationController
count_per_administrateur = procedures.group(:administrateur_id).count.values
{
'Une procédure' => count_per_administrateur.select { |count| count == 1 }.count,
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| 2 <= count && count <= 5 }.count,
'Entre deux et cinq procédures' => count_per_administrateur.select { |count| 2 <= count && count <= 5 }.count,
'Plus de cinq procédures' => count_per_administrateur.select { |count| 5 < count }.count
}
end

View file

@ -1,6 +1,6 @@
class Users::Dossiers::AddSiretController < ApplicationController
def show
@facade = DossierFacades.new params[:dossier_id], current_user.email
@facade = DossierFacades.new params[:dossier_id], current_user.email
raise ActiveRecord::RecordNotFound unless @facade.procedure.individual_with_siret?

View file

@ -30,9 +30,9 @@ class Users::DossiersController < UsersController
end
@dossiers = smart_listing_create :dossiers,
@dossiers_filtered,
partial: "users/dossiers/list",
array: true
@dossiers_filtered,
partial: "users/dossiers/list",
array: true
end
def commencer

View file

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

View file

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

View file

@ -17,8 +17,8 @@ class UsersController < ApplicationController
def authorized_routes? controller
redirect_to_root_path 'Le status de votre dossier n\'autorise pas cette URL' unless UserRoutesAuthorizationService.authorized_route?(
controller,
current_user_dossier)
controller,
current_user_dossier)
rescue ActiveRecord::RecordNotFound
redirect_to_root_path 'Vous navez pas accès à ce dossier.'
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,8 +18,8 @@ class CARTO::SGMAP::API
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
RestClient::Resource.new(
url,
verify_ssl: verify_ssl_mode,
url,
verify_ssl: verify_ssl_mode,
).post params[:geojson], content_type: 'application/json'
rescue RestClient::InternalServerError

View file

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

View file

@ -1,9 +1,7 @@
class AvisMailer < ApplicationMailer
def avis_invitation(avis)
@avis = avis
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})")
end
end

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
class Administrateur < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :gestionnaires
has_many :procedures

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
class Gestionnaire < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_and_belongs_to_many :administrateurs
@ -52,10 +52,8 @@ class Gestionnaire < ActiveRecord::Base
end
def build_default_preferences_list_dossier procedure_id=nil
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
table.second.each do |column|
if valid_couple_table_attr? table.first, column.first
PreferenceListDossier.create(
libelle: column.second[:libelle],

View file

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

View file

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

View file

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

View file

@ -33,7 +33,7 @@ class PieceJustificative < ActiveRecord::Base
(RemoteDownloader.new content.filename).url
else
(LocalDownloader.new content.path,
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
end
end
end

View file

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

View file

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

View file

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

View file

@ -7,7 +7,7 @@ class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
:recoverable, :rememberable, :trackable, :validatable
has_many :dossiers, dependent: :destroy
has_many :invites, dependent: :destroy

View file

@ -1,6 +1,6 @@
class CerfaSerializer < ActiveModel::Serializer
attributes :created_at,
:content_url
:content_url
has_one :user
end

View file

@ -1,5 +1,5 @@
class CommentaireSerializer < ActiveModel::Serializer
attributes :email,
:body,
:created_at
:body,
:created_at
end

View file

@ -1,16 +1,16 @@
class DossierSerializer < ActiveModel::Serializer
attributes :id,
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:simplified_state,
:initiated_at,
:received_at,
:processed_at,
:accompagnateurs,
:invites
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:simplified_state,
:initiated_at,
:received_at,
:processed_at,
:accompagnateurs,
:invites
has_one :entreprise
has_one :etablissement

View file

@ -1,20 +1,20 @@
class DossierTableExportSerializer < ActiveModel::Serializer
attributes :id,
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:initiated_at,
:received_at,
:processed_at
:created_at,
:updated_at,
:archived,
:mandataire_social,
:state,
:initiated_at,
:received_at,
:processed_at
attribute :emails_accompagnateurs
attributes :individual_gender,
:individual_prenom,
:individual_nom,
:individual_birthdate
:individual_prenom,
:individual_nom,
:individual_birthdate
def individual_prenom
object.individual.try(:prenom)

View file

@ -1,4 +1,4 @@
class DossiersSerializer < ActiveModel::Serializer
attributes :id,
:updated_at
:updated_at
end

View file

@ -1,14 +1,14 @@
class EntrepriseSerializer < ActiveModel::Serializer
attributes :siren,
:capital_social,
:numero_tva_intracommunautaire,
:forme_juridique,
:forme_juridique_code,
:nom_commercial,
:raison_sociale,
:siret_siege_social,
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom
:capital_social,
:numero_tva_intracommunautaire,
:forme_juridique,
:forme_juridique_code,
:nom_commercial,
:raison_sociale,
:siret_siege_social,
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom
end

View file

@ -1,15 +1,14 @@
class EtablissementSerializer < ActiveModel::Serializer
attributes :siret,
:siege_social,
:naf,
:libelle_naf,
:adresse,
:numero_voie,
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite
:siege_social,
:naf,
:libelle_naf,
:adresse,
:numero_voie,
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite
end

View file

@ -1,7 +1,5 @@
class ModuleApiCartoSerializer < ActiveModel::Serializer
attributes :use_api_carto,
:quartiers_prioritaires,
:cadastre
:quartiers_prioritaires,
:cadastre
end

View file

@ -1,7 +1,7 @@
class PieceJustificativeSerializer < ActiveModel::Serializer
attributes :created_at,
:type_de_piece_justificative_id,
:content_url
:type_de_piece_justificative_id,
:content_url
has_one :user
end

View file

@ -3,13 +3,12 @@ class ProcedureSerializer < ActiveModel::Serializer
attribute :lien_demarche, key: :link
attributes :id,
:description,
:organisation,
:direction,
:archived,
:geographic_information,
:total_dossier
:description,
:organisation,
:direction,
:archived,
:geographic_information,
:total_dossier
has_one :geographic_information, serializer: ModuleApiCartoSerializer
has_many :types_de_champ, serializer: TypeDeChampSerializer

View file

@ -1,7 +1,7 @@
class TypeDeChampSerializer < ActiveModel::Serializer
attributes :id,
:libelle,
:type_champ,
:order_place,
:description
:libelle,
:type_champ,
:order_place,
:description
end

View file

@ -1,7 +1,7 @@
class TypeDePieceJustificativeSerializer < ActiveModel::Serializer
attributes :id,
:libelle,
:description,
:order_place,
:lien_demarche
:libelle,
:description,
:order_place,
:lien_demarche
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,12 +26,14 @@ class ModuleApiCartoService
def self.generate_qp coordinates
coordinates.inject({}) { |acc, coordinate|
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
def self.generate_cadastre coordinates
(coordinates.inject([]) { |acc, coordinate|
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

View file

@ -1,5 +1,4 @@
class NotificationService
def initialize type_notif, dossier_id, attribut_change=''
@type_notif = type_notif
@dossier_id = dossier_id
@ -25,20 +24,20 @@ class NotificationService
def text_for_notif attribut=''
case @type_notif
when 'commentaire'
"#{notification.liste.size + 1} nouveau(x) commentaire(s) déposé(s)."
when 'cerfa'
"Un nouveau formulaire a été déposé."
when 'piece_justificative'
attribut
when 'champs'
attribut
when 'submitted'
"Le dossier nº #{@dossier_id} a été déposé."
when 'avis'
'Un nouvel avis a été rendu'
else
'Notification par défaut'
when 'commentaire'
"#{notification.liste.size + 1} nouveau(x) commentaire(s) déposé(s)."
when 'cerfa'
"Un nouveau formulaire a été déposé."
when 'piece_justificative'
attribut
when 'champs'
attribut
when 'submitted'
"Le dossier nº #{@dossier_id} a été déposé."
when 'avis'
'Un nouvel avis a été rendu'
else
'Notification par défaut'
end
end
end

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
class CerfaUploader < BaseUploader
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
storage :fog
else

View file

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

View file

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

View file

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

View file

@ -9,6 +9,7 @@ class SiretFormatValidator < ActiveModel::EachValidator
end
private
def luhn_checksum(value)
accum = 0
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?
# set :domain, '5.135.190.60'
set :domain, ENV['domain']
set :repository, 'https://github.com/sgmap/tps.git'
@ -72,7 +71,6 @@ set :shared_paths, [
'app/views/cgu/index.html.haml'
]
set :rbenv_path, "/usr/local/rbenv/bin/rbenv"
# Optional settings:

View file

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

View file

@ -1,75 +1,75 @@
SmartListing.configure do |config|
config.global_options({
#:param_names => { # param names
#:page => :page,
#:per_page => :per_page,
#:sort => :sort,
#},
#:array => false, # controls whether smart list should be using arrays or AR collections
#:max_count => nil, # limit number of rows
#:unlimited_per_page => false, # allow infinite page size
#:paginate => true, # allow pagination
#:memorize_per_page => false, # save per page settings in the cookie
:page_sizes => [10, 20, 50, 100], # set available page sizes array
#:kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options
})
# :param_names => { # param names
# :page => :page,
# :per_page => :per_page,
# :sort => :sort,
# },
# :array => false, # controls whether smart list should be using arrays or AR collections
# :max_count => nil, # limit number of rows
# :unlimited_per_page => false, # allow infinite page size
# :paginate => true, # allow pagination
# :memorize_per_page => false, # save per page settings in the cookie
:page_sizes => [10, 20, 50, 100], # set available page sizes array
# :kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options
})
config.constants :classes, {
#:main => "smart-listing",
#:editable => "editable",
#:content => "content",
#:loading => "loading",
#:status => "smart-listing-status",
#:item_actions => "actions",
#:new_item_placeholder => "new-item-placeholder",
#:new_item_action => "new-item-action",
#:new_item_button => "btn",
#:hidden => "hidden",
#:autoselect => "autoselect",
#:callback => "callback",
#:pagination_per_page => "pagination-per-page text-center",
#:pagination_count => "count",
#:inline_editing => "info",
#:no_records => "no-records",
#:limit => "smart-listing-limit",
#:limit_alert => "smart-listing-limit-alert",
#:controls => "smart-listing-controls",
#:controls_reset => "reset",
#:filtering => "filter",
#:filtering_search => "glyphicon-search",
#:filtering_cancel => "glyphicon-remove",
#:filtering_disabled => "disabled",
#:sortable => "sortable",
#:icon_new => "glyphicon glyphicon-plus",
#:icon_edit => "glyphicon glyphicon-pencil",
#:icon_trash => "glyphicon glyphicon-trash",
#:icon_inactive => "glyphicon glyphicon-circle",
#:icon_show => "glyphicon glyphicon-share-alt",
#:icon_sort_none => "glyphicon glyphicon-resize-vertical",
#:icon_sort_up => "glyphicon glyphicon-chevron-up",
#:icon_sort_down => "glyphicon glyphicon-chevron-down",
}
#:main => "smart-listing",
#:editable => "editable",
#:content => "content",
#:loading => "loading",
#:status => "smart-listing-status",
#:item_actions => "actions",
#:new_item_placeholder => "new-item-placeholder",
#:new_item_action => "new-item-action",
#:new_item_button => "btn",
#:hidden => "hidden",
#:autoselect => "autoselect",
#:callback => "callback",
#:pagination_per_page => "pagination-per-page text-center",
#:pagination_count => "count",
#:inline_editing => "info",
#:no_records => "no-records",
#:limit => "smart-listing-limit",
#:limit_alert => "smart-listing-limit-alert",
#:controls => "smart-listing-controls",
#:controls_reset => "reset",
#:filtering => "filter",
#:filtering_search => "glyphicon-search",
#:filtering_cancel => "glyphicon-remove",
#:filtering_disabled => "disabled",
#:sortable => "sortable",
#:icon_new => "glyphicon glyphicon-plus",
#:icon_edit => "glyphicon glyphicon-pencil",
#:icon_trash => "glyphicon glyphicon-trash",
#:icon_inactive => "glyphicon glyphicon-circle",
#:icon_show => "glyphicon glyphicon-share-alt",
#:icon_sort_none => "glyphicon glyphicon-resize-vertical",
#:icon_sort_up => "glyphicon glyphicon-chevron-up",
#:icon_sort_down => "glyphicon glyphicon-chevron-down",
}
config.constants :data_attributes, {
#:main => "smart-listing",
#:confirmation => "confirmation",
#:id => "id",
#:href => "href",
#:callback_href => "callback-href",
#:max_count => "max-count",
#:inline_edit_backup => "smart-listing-edit-backup",
#:params => "params",
#:observed => "observed",
#:href => "href",
#:autoshow => "autoshow",
#:popover => "slpopover",
}
# :main => "smart-listing",
# :confirmation => "confirmation",
# :id => "id",
# :href => "href",
# :callback_href => "callback-href",
# :max_count => "max-count",
# :inline_edit_backup => "smart-listing-edit-backup",
# :params => "params",
# :observed => "observed",
# :href => "href",
# :autoshow => "autoshow",
# :popover => "slpopover",
}
config.constants :selectors, {
#:item_action_destroy => "a.destroy",
#:edit_cancel => "button.cancel",
#:row => "tr",
#:head => "thead",
#:filtering_icon => "i"
}
# :item_action_destroy => "a.destroy",
# :edit_cancel => "button.cancel",
# :row => "tr",
# :head => "thead",
# :filtering_icon => "i"
}
end

View file

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

View file

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

View file

@ -8,8 +8,6 @@
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
worker_processes 2
@ -52,7 +50,6 @@ check_client_connection false
# local variable to guard against running a hook multiple times
run_once = true
before_fork do |server, worker|
# the following is highly recomended for Rails + "preload_app true"
# 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.string :nom
t.string :prenom
end
add_reference :entreprises, :dossier, references: :dossiers
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,8 @@
class CreateFranceConnectInformation < ActiveRecord::Migration
class User < ActiveRecord::Base
end
class FranceConnectInformation < ActiveRecord::Base
end
def up
@ -38,7 +35,6 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
remove_column :users, :france_connect_particulier_id
end
def down
add_column :users, :gender, :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.datetime :locked_at
t.timestamps
end

View file

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

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