commit
a709bd3fb3
14 changed files with 24 additions and 24 deletions
|
@ -2,7 +2,7 @@ class EntrepriseDecorator < Draper::Decorator
|
||||||
delegate_all
|
delegate_all
|
||||||
|
|
||||||
def raison_sociale_or_name
|
def raison_sociale_or_name
|
||||||
raison_sociale.blank? ? nom + ' ' + prenom : raison_sociale
|
raison_sociale.blank? ? "#{nom} #{prenom}" : raison_sociale
|
||||||
end
|
end
|
||||||
|
|
||||||
def effectif
|
def effectif
|
||||||
|
|
|
@ -9,7 +9,7 @@ class FindDubiousProceduresJob < ApplicationJob
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
# \\y is a word boundary
|
# \\y is a word boundary
|
||||||
forbidden_regexp = FORBIDDEN_KEYWORDS
|
forbidden_regexp = FORBIDDEN_KEYWORDS
|
||||||
.map { |keyword| '\\y' + keyword + '\\y' }
|
.map { |keyword| "\\y#{keyword}\\y" }
|
||||||
.join('|')
|
.join('|')
|
||||||
|
|
||||||
# ~* -> case insensitive regexp match
|
# ~* -> case insensitive regexp match
|
||||||
|
|
|
@ -25,8 +25,8 @@ module Carto
|
||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
|
|
||||||
result['features'].inject([]) do |acc, feature|
|
result['features'].map do |feature|
|
||||||
acc.push feature['properties']['label']
|
feature['properties']['label']
|
||||||
end
|
end
|
||||||
rescue TypeError, JSON::ParserError
|
rescue TypeError, JSON::ParserError
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -8,11 +8,11 @@ class CARTO::SGMAP::Cadastre::Adapter
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_params
|
def to_params
|
||||||
data_source[:features].inject([]) do |acc, feature|
|
data_source[:features].map do |feature|
|
||||||
tmp = filter_properties feature[:properties]
|
tmp = filter_properties feature[:properties]
|
||||||
tmp[:geometry] = feature[:geometry]
|
tmp[:geometry] = feature[:geometry]
|
||||||
|
|
||||||
acc << tmp
|
tmp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,15 +48,15 @@ class Champ < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.regions
|
def self.regions
|
||||||
JSON.parse(Carto::GeoAPI::Driver.regions).sort_by { |e| e['nom'] }.inject([]) { |acc, liste| acc.push(liste['nom']) }
|
JSON.parse(Carto::GeoAPI::Driver.regions).sort_by { |e| e['nom'] }.pluck("nom")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.departements
|
def self.departements
|
||||||
JSON.parse(Carto::GeoAPI::Driver.departements).inject([]) { |acc, liste| acc.push(liste['code'] + ' - ' + liste['nom']) }.push('99 - Étranger')
|
JSON.parse(Carto::GeoAPI::Driver.departements).map { |liste| "#{liste['code']} - #{liste['nom']}" }.push('99 - Étranger')
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pays
|
def self.pays
|
||||||
JSON.parse(Carto::GeoAPI::Driver.pays).inject([]) { |acc, liste| acc.push(liste['nom']) }
|
JSON.parse(Carto::GeoAPI::Driver.pays).pluck("nom")
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|
|
@ -217,6 +217,6 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
updated_annotations,
|
updated_annotations,
|
||||||
updated_avis,
|
updated_avis,
|
||||||
updated_messagerie
|
updated_messagerie
|
||||||
].map { |query| query.distinct.ids }.flatten.uniq
|
].flat_map { |query| query.distinct.ids }.uniq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,10 +32,10 @@ class ModuleApiCartoService
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.generate_cadastre coordinates
|
def self.generate_cadastre coordinates
|
||||||
(coordinates.inject([]) { |acc, coordinate|
|
coordinates.flat_map do |coordinate|
|
||||||
acc << CARTO::SGMAP::Cadastre::Adapter.new(
|
CARTO::SGMAP::Cadastre::Adapter.new(
|
||||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
).to_params
|
).to_params
|
||||||
}).flatten
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class PiecesJustificativesService
|
||||||
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
||||||
|
|
||||||
errors = with_virus
|
errors = with_virus
|
||||||
.map { |_, content| content.original_filename + ' : virus détecté' }
|
.map { |_, content| "#{content.original_filename} : virus détecté" }
|
||||||
|
|
||||||
errors += without_virus
|
errors += without_virus
|
||||||
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
||||||
|
@ -26,7 +26,7 @@ class PiecesJustificativesService
|
||||||
pj.save
|
pj.save
|
||||||
else
|
else
|
||||||
pj = PieceJustificative.new
|
pj = PieceJustificative.new
|
||||||
pj.errors.add(:content, content.original_filename + ': <b>Virus détecté !!</b>')
|
pj.errors.add(:content, "#{content.original_filename} : <b>Virus détecté !!</b>")
|
||||||
end
|
end
|
||||||
|
|
||||||
pj
|
pj
|
||||||
|
|
|
@ -17,7 +17,7 @@ class RenderPartialService
|
||||||
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"))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -31,6 +31,6 @@ class RenderPartialService
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_name
|
def retrieve_name
|
||||||
controller.to_s.parameterize.underscore + '_' + method.to_s
|
"#{controller.to_s.parameterize.underscore}_#{method.to_s}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,8 @@ require 'yaml'
|
||||||
# ansible config
|
# ansible config
|
||||||
class Features
|
class Features
|
||||||
class << self
|
class << self
|
||||||
if File.exist?(File.dirname(__FILE__) + '/features.yml')
|
if File.exist?("#{File.dirname(__FILE__)}/features.yml")
|
||||||
features_map = YAML.load_file(File.dirname(__FILE__) + '/features.yml')
|
features_map = YAML.load_file("#{File.dirname(__FILE__)}/features.yml")
|
||||||
if features_map
|
if features_map
|
||||||
features_map.each do |feature, is_active|
|
features_map.each do |feature, is_active|
|
||||||
define_method("#{feature}") do
|
define_method("#{feature}") do
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
STORAGE_URL = "https://storage.apientreprise.fr/" + CarrierWave::Uploader::Base.fog_directory + '/'
|
STORAGE_URL = "https://storage.apientreprise.fr/#{CarrierWave::Uploader::Base.fog_directory}/"
|
||||||
|
|
|
@ -279,7 +279,7 @@ shared_examples 'description_controller_spec' do
|
||||||
it { expect(response).to redirect_to users_dossier_recapitulatif_path }
|
it { expect(response).to redirect_to users_dossier_recapitulatif_path }
|
||||||
|
|
||||||
context 'when champs is type_de_champ datetime' do
|
context 'when champs is type_de_champ datetime' do
|
||||||
it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq(dossier_date_value + ' ' + dossier_hour_value + ':' + dossier_minute_value) }
|
it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq("#{dossier_date_value} #{dossier_hour_value}:#{dossier_minute_value}") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when champs value is empty' do
|
context 'when champs value is empty' do
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe EntrepriseDecorator do
|
||||||
context 'when raison_sociale is nil' do
|
context 'when raison_sociale is nil' do
|
||||||
let(:raison_sociale) { nil }
|
let(:raison_sociale) { nil }
|
||||||
it 'display nom and prenom' do
|
it 'display nom and prenom' do
|
||||||
expect(subject).to eq(nom + ' ' + prenom)
|
expect(subject).to eq("#{nom} #{prenom}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,12 @@ describe RenderPartialService do
|
||||||
describe 'navbar' do
|
describe 'navbar' do
|
||||||
subject { service.navbar }
|
subject { service.navbar }
|
||||||
|
|
||||||
it { is_expected.to eq 'layouts/navbars/navbar_' + controller.to_s.parameterize + '_' + method.to_s }
|
it { is_expected.to eq "layouts/navbars/navbar_#{controller.to_s.parameterize}_#{method.to_s}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'left_panel' do
|
describe 'left_panel' do
|
||||||
subject { service.left_panel }
|
subject { service.left_panel }
|
||||||
|
|
||||||
it { is_expected.to eq 'layouts/left_panels/left_panel_' + controller.to_s.parameterize + '_' + method.to_s }
|
it { is_expected.to eq "layouts/left_panels/left_panel_#{controller.to_s.parameterize}_#{method.to_s}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue