Add missing brackets around parameters in method definitions
This commit is contained in:
parent
9e19c78b48
commit
2fa88a432b
34 changed files with 64 additions and 64 deletions
|
@ -34,7 +34,7 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def connect_france_connect_particulier user
|
def connect_france_connect_particulier(user)
|
||||||
sign_out :user if user_signed_in?
|
sign_out :user if user_signed_in?
|
||||||
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?
|
||||||
|
|
|
@ -257,11 +257,11 @@ class Users::DossiersController < UsersController
|
||||||
redirect_to url_for users_dossiers_path
|
redirect_to url_for users_dossiers_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_current_user_siret! siret
|
def update_current_user_siret!(siret)
|
||||||
current_user.update(siret: siret)
|
current_user.update(siret: siret)
|
||||||
end
|
end
|
||||||
|
|
||||||
def facade id = params[:id]
|
def facade(id = params[:id])
|
||||||
DossierFacades.new id, current_user.email
|
DossierFacades.new id, current_user.email
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_invite! user
|
def check_invite!(user)
|
||||||
Invite.where(email: user.email).update_all user_id: user.id
|
Invite.where(email: user.email).update_all user_id: user.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ class UsersController < ApplicationController
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user_dossier dossier_id = nil
|
def current_user_dossier(dossier_id = nil)
|
||||||
dossier_id ||= params[:dossier_id] || params[:id]
|
dossier_id ||= params[:dossier_id] || params[:id]
|
||||||
|
|
||||||
dossier = Dossier.find(dossier_id)
|
dossier = Dossier.find(dossier_id)
|
||||||
|
@ -15,7 +15,7 @@ class UsersController < ApplicationController
|
||||||
raise ActiveRecord::RecordNotFound
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorized_routes? controller
|
def authorized_routes?(controller)
|
||||||
if !UserRoutesAuthorizationService.authorized_route?(controller, current_user_dossier)
|
if !UserRoutesAuthorizationService.authorized_route?(controller, current_user_dossier)
|
||||||
redirect_to_root_path 'Le statut de votre dossier n\'autorise pas cette URL'
|
redirect_to_root_path 'Le statut de votre dossier n\'autorise pas cette URL'
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def redirect_to_root_path message
|
def redirect_to_root_path(message)
|
||||||
flash.alert = message
|
flash.alert = message
|
||||||
redirect_to url_for root_path
|
redirect_to url_for root_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DossierDecorator < Draper::Decorator
|
||||||
DossierDecorator.case_state_fr state
|
DossierDecorator.case_state_fr state
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.case_state_fr state = self.state
|
def self.case_state_fr(state = self.state)
|
||||||
h.t("activerecord.attributes.dossier.state.#{state}")
|
h.t("activerecord.attributes.dossier.state.#{state}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class TypeDeChampDecorator < Draper::Decorator
|
class TypeDeChampDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
|
|
||||||
def button_up params
|
def button_up(params)
|
||||||
h.link_to '', params[:url], class: up_classes,
|
h.link_to '', params[:url], class: up_classes,
|
||||||
id: "btn_up_#{params[:index]}",
|
id: "btn_up_#{params[:index]}",
|
||||||
remote: true,
|
remote: true,
|
||||||
|
@ -9,7 +9,7 @@ class TypeDeChampDecorator < Draper::Decorator
|
||||||
style: display_up_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
|
style: display_up_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
|
||||||
end
|
end
|
||||||
|
|
||||||
def button_down params
|
def button_down(params)
|
||||||
h.link_to '', params[:url], class: down_classes,
|
h.link_to '', params[:url], class: down_classes,
|
||||||
id: "btn_down_#{params[:index]}",
|
id: "btn_down_#{params[:index]}",
|
||||||
remote: true,
|
remote: true,
|
||||||
|
@ -39,7 +39,7 @@ class TypeDeChampDecorator < Draper::Decorator
|
||||||
(index + 1) < count_type_de_champ(private)
|
(index + 1) < count_type_de_champ(private)
|
||||||
end
|
end
|
||||||
|
|
||||||
def count_type_de_champ private
|
def count_type_de_champ(private)
|
||||||
if private
|
if private
|
||||||
@count_type_de_champ ||= procedure.types_de_champ_private.count
|
@count_type_de_champ ||= procedure.types_de_champ_private.count
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
class TypeDePieceJustificativeDecorator < Draper::Decorator
|
class TypeDePieceJustificativeDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
def button_up params
|
def button_up(params)
|
||||||
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post if display_up_button?(params[:index])
|
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post if display_up_button?(params[:index])
|
||||||
end
|
end
|
||||||
|
|
||||||
def button_down params
|
def button_down(params)
|
||||||
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post if display_down_button?(params[:index])
|
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post if display_down_button?(params[:index])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AdminProceduresShowFacades
|
class AdminProceduresShowFacades
|
||||||
def initialize procedure
|
def initialize(procedure)
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class AdminTypesDeChampFacades
|
class AdminTypesDeChampFacades
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
|
|
||||||
def initialize private, procedure
|
def initialize(private, procedure)
|
||||||
@private = private
|
@private = private
|
||||||
@procedure = procedure
|
@procedure = procedure
|
||||||
end
|
end
|
||||||
|
@ -30,15 +30,15 @@ class AdminTypesDeChampFacades
|
||||||
@private ? :types_de_champ_private : :types_de_champ
|
@private ? :types_de_champ_private : :types_de_champ
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_up_url ff
|
def move_up_url(ff)
|
||||||
@private ? move_up_admin_procedure_types_de_champ_private_path(@procedure, ff.index) : move_up_admin_procedure_types_de_champ_path(@procedure, ff.index)
|
@private ? move_up_admin_procedure_types_de_champ_private_path(@procedure, ff.index) : move_up_admin_procedure_types_de_champ_path(@procedure, ff.index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_down_url ff
|
def move_down_url(ff)
|
||||||
@private ? move_down_admin_procedure_types_de_champ_private_path(@procedure, ff.index) : move_down_admin_procedure_types_de_champ_path(@procedure, ff.index)
|
@private ? move_down_admin_procedure_types_de_champ_private_path(@procedure, ff.index) : move_down_admin_procedure_types_de_champ_path(@procedure, ff.index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_url ff
|
def delete_url(ff)
|
||||||
@private ? admin_procedure_type_de_champ_private_path(@procedure, ff.object.id) : admin_procedure_type_de_champ_path(@procedure, ff.object.id)
|
@private ? admin_procedure_type_de_champ_private_path(@procedure, ff.object.id) : admin_procedure_type_de_champ_path(@procedure, ff.object.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Carto
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def self.call api_url
|
def self.call(api_url)
|
||||||
RestClient.get api_url, params: { fields: :nom }
|
RestClient.get api_url, params: { fields: :nom }
|
||||||
rescue RestClient::ServiceUnavailable
|
rescue RestClient::ServiceUnavailable
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CARTO::SGMAP::Cadastre::Adapter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_properties properties
|
def filter_properties(properties)
|
||||||
{
|
{
|
||||||
surface_intersection: properties[:surface_intersection],
|
surface_intersection: properties[:surface_intersection],
|
||||||
surface_parcelle: properties[:surface_parcelle],
|
surface_parcelle: properties[:surface_parcelle],
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class AdministrationMailer < ApplicationMailer
|
class AdministrationMailer < ApplicationMailer
|
||||||
layout 'mailers/layout'
|
layout 'mailers/layout'
|
||||||
|
|
||||||
def new_admin_email admin, administration
|
def new_admin_email(admin, administration)
|
||||||
@admin = admin
|
@admin = admin
|
||||||
@administration = administration
|
@administration = administration
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class GestionnaireMailer < ApplicationMailer
|
class GestionnaireMailer < ApplicationMailer
|
||||||
layout 'mailers/layout'
|
layout 'mailers/layout'
|
||||||
|
|
||||||
def new_gestionnaire email, password
|
def new_gestionnaire(email, password)
|
||||||
send_mail email, password, "Vous avez été nommé accompagnateur sur demarches-simplifiees.fr"
|
send_mail email, password, "Vous avez été nommé accompagnateur sur demarches-simplifiees.fr"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ class GestionnaireMailer < ApplicationMailer
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def vars_mailer email, args
|
def vars_mailer(email, args)
|
||||||
@args = args
|
@args = args
|
||||||
@email = email
|
@email = email
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail email, args, subject
|
def send_mail(email, args, subject)
|
||||||
vars_mailer email, args
|
vars_mailer email, args
|
||||||
|
|
||||||
mail(to: email, subject: subject)
|
mail(to: email, subject: subject)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
class InviteMailer < ApplicationMailer
|
class InviteMailer < ApplicationMailer
|
||||||
def invite_user invite
|
def invite_user(invite)
|
||||||
vars_mailer invite
|
vars_mailer invite
|
||||||
|
|
||||||
send_mail invite.email, "demarches-simplifiees.fr - Participez à l'élaboration d'un dossier", invite.email_sender if invite.user.present?
|
send_mail invite.email, "demarches-simplifiees.fr - Participez à l'élaboration d'un dossier", invite.email_sender if invite.user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite_guest invite
|
def invite_guest(invite)
|
||||||
vars_mailer invite
|
vars_mailer invite
|
||||||
|
|
||||||
send_mail invite.email, "Invitation - #{invite.email_sender} vous invite à consulter un dossier sur demarches-simplifiees.fr", invite.email_sender
|
send_mail invite.email, "Invitation - #{invite.email_sender} vous invite à consulter un dossier sur demarches-simplifiees.fr", invite.email_sender
|
||||||
|
@ -13,11 +13,11 @@ class InviteMailer < ApplicationMailer
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def vars_mailer invite
|
def vars_mailer(invite)
|
||||||
@invite = invite
|
@invite = invite
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail email, subject, reply_to
|
def send_mail(email, subject, reply_to)
|
||||||
mail(to: email,
|
mail(to: email,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
reply_to: reply_to)
|
reply_to: reply_to)
|
||||||
|
|
|
@ -1,5 +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,
|
||||||
|
|
|
@ -37,11 +37,11 @@ class Champ < ApplicationRecord
|
||||||
!private?
|
!private?
|
||||||
end
|
end
|
||||||
|
|
||||||
def same_hour? num
|
def same_hour?(num)
|
||||||
same_date? num, '%H'
|
same_date? num, '%H'
|
||||||
end
|
end
|
||||||
|
|
||||||
def same_minute? num
|
def same_minute?(num)
|
||||||
same_date? num, '%M'
|
same_date? num, '%M'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Champ < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def same_date? num, compare
|
def same_date?(num, compare)
|
||||||
if type_champ == 'datetime' && value.present?
|
if type_champ == 'datetime' && value.present?
|
||||||
if value.to_datetime.strftime(compare) == num
|
if value.to_datetime.strftime(compare) == num
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -193,11 +193,11 @@ class Dossier < ApplicationRecord
|
||||||
en_instruction? || accepte? || refuse? || sans_suite?
|
en_instruction? || accepte? || refuse? || sans_suite?
|
||||||
end
|
end
|
||||||
|
|
||||||
def owner? email
|
def owner?(email)
|
||||||
user.email == email
|
user.email == email
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite_by_user? email
|
def invite_by_user?(email)
|
||||||
(invites_user.pluck :email).include? email
|
(invites_user.pluck :email).include? email
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ class Gestionnaire < ApplicationRecord
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_couple_table_attr? table, column
|
def valid_couple_table_attr?(table, column)
|
||||||
couples = [
|
couples = [
|
||||||
{
|
{
|
||||||
table: :dossier,
|
table: :dossier,
|
||||||
|
|
|
@ -66,19 +66,19 @@ class Procedure < ApplicationRecord
|
||||||
types_de_champ + types_de_champ_private
|
types_de_champ + types_de_champ_private
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.active id
|
def self.active(id)
|
||||||
publiees.find(id)
|
publiees.find(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch_types_de_champ index_of_first_element
|
def switch_types_de_champ(index_of_first_element)
|
||||||
switch_list_order(types_de_champ_ordered, index_of_first_element)
|
switch_list_order(types_de_champ_ordered, index_of_first_element)
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch_types_de_champ_private index_of_first_element
|
def switch_types_de_champ_private(index_of_first_element)
|
||||||
switch_list_order(types_de_champ_private_ordered, index_of_first_element)
|
switch_list_order(types_de_champ_private_ordered, index_of_first_element)
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch_types_de_piece_justificative index_of_first_element
|
def switch_types_de_piece_justificative(index_of_first_element)
|
||||||
switch_list_order(types_de_piece_justificative, index_of_first_element)
|
switch_list_order(types_de_piece_justificative, index_of_first_element)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
before_validation -> { sanitize_email(:email) }
|
before_validation -> { sanitize_email(:email) }
|
||||||
|
|
||||||
def self.find_for_france_connect email, siret
|
def self.find_for_france_connect(email, siret)
|
||||||
user = User.find_by(email: email)
|
user = User.find_by(email: email)
|
||||||
if user.nil?
|
if user.nil?
|
||||||
return User.create(email: email, password: Devise.friendly_token[0, 20], siret: siret)
|
return User.create(email: email, password: Devise.friendly_token[0, 20], siret: siret)
|
||||||
|
@ -37,7 +37,7 @@ class User < ApplicationRecord
|
||||||
loged_in_with_france_connect.present?
|
loged_in_with_france_connect.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def invite? dossier_id
|
def invite?(dossier_id)
|
||||||
invites.pluck(:dossier_id).include?(dossier_id.to_i)
|
invites.pluck(:dossier_id).include?(dossier_id.to_i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ClamavService
|
class ClamavService
|
||||||
def self.safe_file? file_path
|
def self.safe_file?(file_path)
|
||||||
if Rails.env == 'development'
|
if Rails.env == 'development'
|
||||||
return CLAMAV[:response] if CLAMAV[:mock?]
|
return CLAMAV[:response] if CLAMAV[:mock?]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class GeojsonService
|
class GeojsonService
|
||||||
def self.to_json_polygon_for_qp coordinates
|
def self.to_json_polygon_for_qp(coordinates)
|
||||||
polygon = {
|
polygon = {
|
||||||
geo: {
|
geo: {
|
||||||
type: "Polygon",
|
type: "Polygon",
|
||||||
|
@ -10,7 +10,7 @@ class GeojsonService
|
||||||
polygon.to_json
|
polygon.to_json
|
||||||
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",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ModuleApiCartoService
|
class ModuleApiCartoService
|
||||||
def self.save_qp! dossier, json_latlngs
|
def self.save_qp!(dossier, json_latlngs)
|
||||||
if dossier.procedure.module_api_carto.quartiers_prioritaires?
|
if dossier.procedure.module_api_carto.quartiers_prioritaires?
|
||||||
qp_list = generate_qp JSON.parse(json_latlngs)
|
qp_list = generate_qp JSON.parse(json_latlngs)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class ModuleApiCartoService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.save_cadastre! dossier, json_latlngs
|
def self.save_cadastre!(dossier, json_latlngs)
|
||||||
if dossier.procedure.module_api_carto.cadastre?
|
if dossier.procedure.module_api_carto.cadastre?
|
||||||
cadastre_list = generate_cadastre JSON.parse(json_latlngs)
|
cadastre_list = generate_cadastre JSON.parse(json_latlngs)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class ModuleApiCartoService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
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']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
|
@ -31,7 +31,7 @@ class ModuleApiCartoService
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_cadastre coordinates
|
def self.generate_cadastre(coordinates)
|
||||||
coordinates.flat_map do |coordinate|
|
coordinates.flat_map do |coordinate|
|
||||||
CARTO::SGMAP::Cadastre::Adapter.new(
|
CARTO::SGMAP::Cadastre::Adapter.new(
|
||||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class NumberService
|
class NumberService
|
||||||
def self.to_number string
|
def self.to_number(string)
|
||||||
string.to_s if Float(string) rescue nil
|
string.to_s if Float(string) rescue nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class PiecesJustificativesService
|
||||||
.compact()
|
.compact()
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.upload_one! dossier, user, params
|
def self.upload_one!(dossier, user, params)
|
||||||
content = params[:piece_justificative][:content]
|
content = params[:piece_justificative][:content]
|
||||||
if ClamavService.safe_file? content.path
|
if ClamavService.safe_file? content.path
|
||||||
pj = PieceJustificative.new(content: content,
|
pj = PieceJustificative.new(content: content,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class PrevisualisationService
|
class PrevisualisationService
|
||||||
def self.delete_all_champs dossier
|
def self.delete_all_champs(dossier)
|
||||||
Champ.where(dossier_id: dossier.id, type_de_champ_id: dossier.procedure.types_de_champ.ids).delete_all
|
Champ.where(dossier_id: dossier.id, type_de_champ_id: dossier.procedure.types_de_champ.ids).delete_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class RenderPartialService
|
class RenderPartialService
|
||||||
attr_accessor :controller, :method
|
attr_accessor :controller, :method
|
||||||
|
|
||||||
def initialize controller, method
|
def initialize(controller, method)
|
||||||
@controller = controller
|
@controller = controller
|
||||||
@method = method
|
@method = method
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ class RenderPartialService
|
||||||
retrieve_left_panel
|
retrieve_left_panel
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.left_panel_exist? left_panel_url
|
def self.left_panel_exist?(left_panel_url)
|
||||||
file = left_panel_url.split('/').last
|
file = left_panel_url.split('/').last
|
||||||
|
|
||||||
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', "_#{file}.html.haml"))
|
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', "_#{file}.html.haml"))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class SwitchDeviseProfileService
|
class SwitchDeviseProfileService
|
||||||
def initialize warden
|
def initialize(warden)
|
||||||
@warden = warden
|
@warden = warden
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class SyncCredentialsService
|
class SyncCredentialsService
|
||||||
def initialize klass, email_before_last_save, email, encrypted_password
|
def initialize(klass, email_before_last_save, email, encrypted_password)
|
||||||
@klass = klass
|
@klass = klass
|
||||||
@email_before_last_save = email_before_last_save
|
@email_before_last_save = email_before_last_save
|
||||||
@email = email
|
@email = email
|
||||||
|
|
|
@ -72,7 +72,7 @@ class TypesDeChampService
|
||||||
(tdca[:order_place].to_i + 1) != tdca[:custom_order_place].to_i
|
(tdca[:order_place].to_i + 1) != tdca[:custom_order_place].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clean_value value
|
def self.clean_value(value)
|
||||||
value.split("\r\n").map{ |v| v.strip }.join("\r\n")
|
value.split("\r\n").map{ |v| v.strip }.join("\r\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class UserRoutesAuthorizationService
|
class UserRoutesAuthorizationService
|
||||||
def self.authorized_route? controller, dossier
|
def self.authorized_route?(controller, dossier)
|
||||||
auth = controller.route_authorization
|
auth = controller.route_authorization
|
||||||
|
|
||||||
auth[:states].include?(dossier.state.to_sym) &&
|
auth[:states].include?(dossier.state.to_sym) &&
|
||||||
|
|
|
@ -19,7 +19,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_couple_table_attr? table, column
|
def valid_couple_table_attr?(table, column)
|
||||||
couples = [
|
couples = [
|
||||||
{
|
{
|
||||||
table: :dossier,
|
table: :dossier,
|
||||||
|
@ -110,7 +110,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
|
def self.create_column(libelle, table, attr, attr_decorate, bootstrap_lg)
|
||||||
{
|
{
|
||||||
libelle: libelle,
|
libelle: libelle,
|
||||||
table: table,
|
table: table,
|
||||||
|
|
|
@ -3,7 +3,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
belongs_to :gestionnaire
|
belongs_to :gestionnaire
|
||||||
belongs_to :procedure
|
belongs_to :procedure
|
||||||
|
|
||||||
def self.available_columns_for procedure_id = nil
|
def self.available_columns_for(procedure_id = nil)
|
||||||
columns = {
|
columns = {
|
||||||
dossier: columns_dossier,
|
dossier: columns_dossier,
|
||||||
procedure: columns_procedure,
|
procedure: columns_procedure,
|
||||||
|
@ -78,7 +78,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
|
def self.create_column(libelle, table, attr, attr_decorate, bootstrap_lg)
|
||||||
{
|
{
|
||||||
libelle: libelle,
|
libelle: libelle,
|
||||||
table: table,
|
table: table,
|
||||||
|
@ -95,7 +95,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
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
|
||||||
|
@ -117,7 +117,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_couple_table_attr? table, column
|
def valid_couple_table_attr?(table, column)
|
||||||
couples = [
|
couples = [
|
||||||
{
|
{
|
||||||
table: :dossier,
|
table: :dossier,
|
||||||
|
|
Loading…
Reference in a new issue