Merge pull request #3261 from betagouv/dev

2019-01-08-01
This commit is contained in:
Pierre de La Morinerie 2019-01-08 10:37:52 +01:00 committed by GitHub
commit 75cbb742de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
160 changed files with 990 additions and 1337 deletions

View file

@ -14,7 +14,7 @@ Bundler/InsecureProtocolSource:
Enabled: true
Bundler/OrderedGems:
Enabled: false
Enabled: true
Gemspec/DuplicatedAssignment:
Enabled: true
@ -58,7 +58,7 @@ Layout/CommentIndentation:
Enabled: true
Layout/ConditionPosition:
Enabled: false
Enabled: true
Layout/DefEndAlignment:
Enabled: false
@ -200,7 +200,7 @@ Layout/SpaceAfterColon:
Enabled: true
Layout/SpaceAfterComma:
Enabled: false
Enabled: true
Layout/SpaceAfterMethodName:
Enabled: true
@ -224,7 +224,7 @@ Layout/SpaceAroundOperators:
Enabled: true
Layout/SpaceBeforeBlockBraces:
Enabled: false
Enabled: true
Layout/SpaceBeforeComma:
Enabled: true
@ -252,7 +252,8 @@ Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false
Enabled: true
EnforcedStyle: no_space
Layout/SpaceInsideParens:
Enabled: true
@ -339,40 +340,40 @@ Lint/EnsureReturn:
Enabled: false
Lint/FloatOutOfRange:
Enabled: false
Enabled: true
Lint/FormatParameterMismatch:
Enabled: false
Enabled: true
Lint/HandleExceptions:
Enabled: false
Lint/ImplicitStringConcatenation:
Enabled: false
Enabled: true
Lint/IneffectiveAccessModifier:
Enabled: false
Lint/InheritException:
Enabled: false
Enabled: true
Lint/InterpolationCheck:
Enabled: true
Lint/LiteralAsCondition:
Enabled: false
Enabled: true
Lint/LiteralInInterpolation:
Enabled: false
Enabled: true
Lint/Loop:
Enabled: false
Enabled: true
Lint/MissingCopEnableDirective:
Enabled: true
Lint/MultipleCompare:
Enabled: false
Enabled: true
Lint/NestedMethodDefinition:
Enabled: false
@ -381,7 +382,7 @@ Lint/NestedPercentLiteral:
Enabled: true
Lint/NextWithoutAccumulator:
Enabled: false
Enabled: true
Lint/NonLocalExitFromIterator:
Enabled: false
@ -393,7 +394,9 @@ Lint/OrderedMagicComments:
Enabled: true
Lint/ParenthesesAsGroupedExpression:
Enabled: false
Enabled: true
Exclude:
- "spec/**/*"
Lint/PercentStringArray:
Enabled: false
@ -417,16 +420,16 @@ Lint/RequireParentheses:
Enabled: false
Lint/RescueException:
Enabled: false
Enabled: true
Lint/RescueType:
Enabled: false
Enabled: true
Lint/ReturnInVoidContext:
Enabled: false
Lint/SafeNavigationChain:
Enabled: false
Enabled: true
Lint/ScriptPermission:
Enabled: false
@ -435,25 +438,25 @@ Lint/ShadowedArgument:
Enabled: true
Lint/ShadowedException:
Enabled: false
Enabled: true
Lint/ShadowingOuterLocalVariable:
Enabled: false
Lint/StringConversionInInterpolation:
Enabled: false
Enabled: true
Lint/Syntax:
Enabled: true
Lint/UnderscorePrefixedVariableName:
Enabled: false
Enabled: true
Lint/UnifiedInteger:
Enabled: false
Enabled: true
Lint/UnneededCopDisableDirective:
Enabled: false
Enabled: true
Lint/UnneededCopEnableDirective:
Enabled: true
@ -465,10 +468,10 @@ Lint/UnneededSplatExpansion:
Enabled: false
Lint/UnreachableCode:
Enabled: false
Enabled: true
Lint/UnusedBlockArgument:
Enabled: false
Enabled: true
Lint/UnusedMethodArgument:
Enabled: false
@ -483,19 +486,21 @@ Lint/UselessAccessModifier:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Enabled: true
Exclude:
- "spec/**/*"
Lint/UselessComparison:
Enabled: false
Enabled: true
Lint/UselessElseWithoutRescue:
Enabled: false
Enabled: true
Lint/UselessSetterCall:
Enabled: false
Enabled: true
Lint/Void:
Enabled: false
Enabled: true
Metrics/AbcSize:
Enabled: false

217
Gemfile
View file

@ -1,181 +1,104 @@
source 'https://rubygems.org'
# dotenv should always be loaded before rails
gem 'dotenv-rails', require: 'dotenv/rails-now'
gem 'rails'
# Use SCSS for stylesheets
gem 'sassc-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Enable deep clone of active record models
gem 'deep_cloneable'
gem 'warden'
# Use Puma as the app server
gem 'puma'
# serializer
gem 'aasm'
gem 'active_link_to' # Automatically set a class on active links
gem 'active_model_serializers'
# haml
gem 'haml-rails'
# bootstrap saas
gem 'activestorage-openstack', git: 'https://github.com/fredZen/activestorage-openstack.git', branch: 'frederic/fix_upload_signature'
gem 'administrate'
gem 'after_party'
gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365
gem 'bcrypt'
gem 'bootstrap-sass', '~> 3.3.5'
# Automatically set a class on active links
gem 'active_link_to'
# Pagination
gem 'kaminari'
# Decorators
gem 'draper'
# Gestion des comptes utilisateurs
gem 'devise'
gem 'devise-async'
gem 'openid_connect'
gem 'omniauth-github'
# Locales par défaut
gem 'rails-i18n'
gem 'rest-client'
gem 'typhoeus'
gem 'clamav-client', require: 'clamav/client'
gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
gem 'browser'
gem 'carrierwave'
gem 'carrierwave-i18n'
gem 'copy_carrierwave_file'
gem 'fog-openstack'
gem 'activestorage-openstack', git: 'https://github.com/fredZen/activestorage-openstack.git', branch: 'frederic/fix_upload_signature'
gem 'pg'
gem 'rbnacl-libsodium'
gem 'bcrypt'
gem 'rgeo-geojson'
gem 'chartkick'
gem 'chunky_png'
gem 'clamav-client', require: 'clamav/client'
gem 'copy_carrierwave_file'
gem 'daemons'
gem 'deep_cloneable' # Enable deep clone of active record models
gem 'delayed_cron_job' # Cron jobs
gem 'delayed_job_active_record'
gem 'delayed_job_web'
gem 'devise' # Gestion des comptes utilisateurs
gem 'devise-async'
gem 'dotenv-rails', require: 'dotenv/rails-now' # dotenv should always be loaded before rails
gem 'flipflop'
gem 'fog-openstack'
gem 'font-awesome-rails'
gem 'groupdate'
gem 'haml-rails'
gem 'hashie'
gem 'jquery-rails' # Use jquery as the JavaScript library
gem 'kaminari' # Pagination
gem 'lograge'
gem 'logstash-event'
gem 'font-awesome-rails'
gem 'hashie'
gem 'mailjet'
gem "premailer-rails"
gem 'smart_listing'
gem 'groupdate'
gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
gem 'spreadsheet_architect'
gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365
gem 'omniauth-github'
gem 'openid_connect'
gem 'openstack'
gem 'browser'
gem 'simple_form'
gem 'skylight'
gem 'scenic'
gem 'pg'
gem 'prawn' # PDF Generation
gem 'prawn_rails'
gem 'premailer-rails'
gem 'puma' # Use Puma as the app server
gem 'rack-mini-profiler'
gem 'rails'
gem 'rails-i18n' # Locales par défaut
gem 'rake-progressbar', require: false
gem 'rest-client'
gem 'rgeo-geojson'
gem 'sanitize-url'
gem 'flipflop'
gem 'aasm'
gem 'sassc-rails' # Use SCSS for stylesheets
gem 'scenic'
gem 'select2-rails'
gem 'sentry-raven'
gem 'simple_form'
gem 'skylight'
gem 'smart_listing'
gem 'spreadsheet_architect'
gem 'turbolinks' # Turbolinks makes following links in your web application faster
gem 'typhoeus'
gem 'warden'
gem 'webpacker', '>= 4.0.x'
gem 'after_party'
gem 'zxcvbn-ruby', require: 'zxcvbn'
# Cron jobs
gem 'delayed_job_active_record'
gem "daemons"
gem 'delayed_cron_job'
gem "delayed_job_web"
gem 'select2-rails'
# PDF Generation
gem 'prawn'
gem 'prawn_rails'
gem 'chunky_png'
gem 'sentry-raven'
gem "administrate"
gem 'rack-mini-profiler'
gem 'rake-progressbar', require: false
group :test do
gem 'launchy'
gem 'factory_bot'
gem 'capybara' # Integration testing
gem 'capybara-email' # Access emails during integration tests
gem 'capybara-screenshot' # Save a dump of the page when an integration test fails
gem 'capybara-selenium'
gem 'database_cleaner'
gem 'webmock'
gem 'factory_bot'
gem 'guard'
gem 'guard-livereload', require: false
gem 'guard-rspec', require: false
gem 'launchy'
gem 'rails-controller-testing'
gem 'shoulda-matchers', require: false
gem 'timecop'
gem 'guard'
gem 'guard-rspec', require: false
gem 'guard-livereload', require: false
gem 'vcr'
gem 'rails-controller-testing'
# Integration testing
gem 'capybara'
gem 'capybara-selenium'
# Save a dump of the page when an integration test fails
gem 'capybara-screenshot'
# Access emails during integration tests
gem 'capybara-email'
gem 'webmock'
end
group :development do
gem 'brakeman', require: false
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console'
gem 'rack-handlers'
gem 'xray-rails'
gem 'haml-lint'
gem 'letter_opener_web'
gem 'rubocop', require: false
gem 'rubocop-rspec-focused', require: false
gem 'haml-lint'
gem 'scss_lint', require: false
gem 'letter_opener_web'
gem 'xray-rails'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'byebug' # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false # Deploy
gem 'pry-byebug'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-commands-rspec'
gem 'rspec-rails'
# Deploy
gem 'mina', git: 'https://github.com/mina-deploy/mina.git', require: false
gem 'rspec_junit_formatter'
gem 'spring' # Spring speeds up development by keeping your application running in the background
gem 'spring-commands-rspec'
end

View file

@ -58,10 +58,6 @@ GEM
globalid (>= 0.3.6)
activemodel (5.2.2)
activesupport (= 5.2.2)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.2.2)
activemodel (= 5.2.2)
activesupport (= 5.2.2)
@ -93,7 +89,7 @@ GEM
arel (9.0.0)
ast (2.4.0)
attr_required (1.0.1)
autoprefixer-rails (9.4.1)
autoprefixer-rails (9.4.4)
execjs
axlsx (3.0.0.pre)
htmlentities (~> 4.3, >= 4.3.4)
@ -105,7 +101,6 @@ GEM
axlsx (>= 2.0, < 4)
bcrypt (3.1.12)
bindata (2.4.4)
bindex (0.5.0)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
@ -132,14 +127,14 @@ GEM
capybara-selenium (0.0.6)
capybara
selenium-webdriver
carrierwave (1.2.3)
carrierwave (1.3.1)
activemodel (>= 4.0.0)
activesupport (>= 4.0.0)
mime-types (>= 1.16)
carrierwave-i18n (0.2.0)
case_transform (0.2)
activesupport
chartkick (3.0.1)
chartkick (3.0.2)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.11)
@ -152,7 +147,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.3)
concurrent-ruby (1.1.4)
copy_carrierwave_file (1.3.0)
carrierwave (>= 0.9)
crack (0.4.3)
@ -160,7 +155,7 @@ GEM
crass (1.0.4)
css_parser (1.6.0)
addressable
daemons (1.2.6)
daemons (1.3.1)
database_cleaner (1.7.0)
datetime_picker_rails (0.0.7)
momentjs-rails (>= 2.8.1)
@ -194,16 +189,10 @@ GEM
dotenv-rails (2.5.0)
dotenv (= 2.5.0)
railties (>= 3.2, < 6.0)
draper (3.0.1)
actionpack (~> 5.0)
activemodel (~> 5.0)
activemodel-serializers-xml (~> 1.0)
activesupport (~> 5.0)
request_store (~> 1.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubi (1.7.1)
erubi (1.8.0)
erubis (2.7.0)
ethon (0.11.0)
ffi (>= 1.3.0)
@ -212,7 +201,7 @@ GEM
execjs (2.7.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
faraday (0.12.2)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
flipflop (2.4.0)
@ -234,7 +223,7 @@ GEM
formatador (0.2.5)
globalid (0.4.1)
activesupport (>= 4.2.0)
groupdate (4.1.0)
groupdate (4.1.1)
activesupport (>= 4.2)
guard (2.15.0)
formatador (>= 0.2.4)
@ -272,8 +261,8 @@ GEM
rake (>= 10, < 13)
rubocop (>= 0.50.0)
sysexits (~> 1.1)
hashdiff (0.3.7)
hashie (3.5.7)
hashdiff (0.3.8)
hashie (3.6.0)
html2haml (2.2.0)
erubis (~> 2.7.0)
haml (>= 4.0, < 6)
@ -284,21 +273,21 @@ GEM
domain_name (~> 0.5)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (1.1.1)
i18n (1.4.0)
concurrent-ruby (~> 1.0)
ipaddress (0.8.3)
jaro_winkler (1.5.1)
jaro_winkler (1.5.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.1.0)
json-jwt (1.9.4)
activesupport
json-jwt (1.10.0)
activesupport (>= 4.2)
aes_key_wrap
bindata
jsonapi-renderer (0.2.0)
jwt (1.5.6)
jwt (2.1.0)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
@ -313,7 +302,7 @@ GEM
kaminari-core (1.1.1)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.6.0)
letter_opener (1.7.0)
launchy (~> 2.2)
letter_opener_web (1.3.4)
actionmailer (>= 3.2)
@ -345,9 +334,9 @@ GEM
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mimemagic (0.3.2)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
mini_portile2 (2.4.0)
minitest (5.11.3)
momentjs-rails (2.20.1)
railties (>= 3.1)
@ -358,26 +347,26 @@ GEM
nenv (0.3.0)
netrc (0.11.0)
nio4r (2.3.1)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogiri (1.10.0)
mini_portile2 (~> 2.4.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth2 (1.4.0)
faraday (>= 0.8, < 0.13)
jwt (~> 1.0)
oauth2 (1.4.1)
faraday (>= 0.8, < 0.16.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
rack (>= 1.6.2, < 3)
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-oauth2 (1.5.0)
omniauth-oauth2 (1.6.0)
oauth2 (~> 1.1)
omniauth (~> 1.2)
omniauth (~> 1.9)
open4 (1.3.4)
openid_connect (1.1.6)
activemodel
@ -420,9 +409,7 @@ GEM
public_suffix (3.0.3)
puma (3.12.0)
rack (2.0.6)
rack-handlers (0.7.3)
rack
rack-mini-profiler (1.0.0)
rack-mini-profiler (1.0.1)
rack (>= 1.2.0)
rack-oauth2 (1.9.3)
activesupport
@ -430,7 +417,7 @@ GEM
httpclient
json-jwt (>= 1.9.0)
rack
rack-protection (2.0.4)
rack-protection (2.0.5)
rack
rack-proxy (0.6.5)
rack
@ -449,7 +436,7 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.2)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.3)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
@ -468,15 +455,11 @@ GEM
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.1)
rake (12.3.2)
rake-progressbar (0.0.5)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rbnacl (5.0.0)
ffi
rbnacl-libsodium (1.0.16)
rbnacl (>= 3.0.1)
rb-inotify (0.10.0)
ffi (~> 1.0)
regexp_parser (1.3.0)
request_store (1.4.1)
rack (>= 1.4)
@ -517,7 +500,7 @@ GEM
rspec-support (3.8.0)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.61.1)
rubocop (0.62.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
@ -529,12 +512,12 @@ GEM
rubocop (>= 0.51)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
ruby_parser (3.11.0)
ruby_parser (3.12.0)
sexp_processor (~> 4.9)
rubyzip (1.2.2)
safe_yaml (1.0.4)
sanitize-url (0.1.4)
sass (3.7.2)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
@ -548,7 +531,7 @@ GEM
sassc (2.0.0)
ffi (~> 1.9.6)
rake
sassc-rails (2.0.0)
sassc-rails (2.1.0)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
@ -575,10 +558,10 @@ GEM
simple_form (4.1.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
sinatra (2.0.4)
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.4)
rack-protection (= 2.0.5)
tilt (~> 2.0)
skylight (3.1.2)
skylight-core (= 3.1.2)
@ -625,7 +608,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.0)
unicode-display_width (1.4.1)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
@ -635,19 +618,14 @@ GEM
vcr (4.0.0)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webfinger (1.1.0)
activesupport
httpclient (>= 2.4)
webmock (3.4.2)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
webpacker (4.0.0.pre.3)
webpacker (4.0.0.rc.2)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
@ -696,7 +674,6 @@ DEPENDENCIES
devise
devise-async
dotenv-rails
draper
factory_bot
flipflop
fog-openstack
@ -725,13 +702,11 @@ DEPENDENCIES
premailer-rails
pry-byebug
puma
rack-handlers
rack-mini-profiler
rails
rails-controller-testing
rails-i18n
rake-progressbar
rbnacl-libsodium
rest-client
rgeo-geojson
rspec-rails
@ -756,7 +731,6 @@ DEPENDENCIES
typhoeus
vcr
warden
web-console
webmock
webpacker (>= 4.0.x)
xray-rails

View file

@ -35,8 +35,7 @@ guard 'livereload' do
png: :png,
gif: :gif,
jpg: :jpg,
jpeg: :jpeg,
# less: :less, # uncomment if you want LESS stylesheets done in browser
jpeg: :jpeg
}
rails_view_exts = ['erb', 'haml', 'slim']

View file

@ -104,7 +104,7 @@ Une fois `overmind` lancé, et un breakpoint `byebug` inséré dans le code, il
### Linting
Le projet utilise plusieurs linters pour vérifier la lisibilité et la qualité code.
Le projet utilise plusieurs linters pour vérifier la lisibilité et la qualité du code.
- Faire tourner tous les linters : `bin/rake lint`
- [AccessLint](http://accesslint.com/) tourne automatiquement sur les PRs
@ -121,16 +121,10 @@ Le projet utilise plusieurs linters pour vérifier la lisibilité et la qualité
## Tâches courantes
### Tâches Super Admin
### Tâches de gestion des comptes super-admin
- ajouter un compte super admin :
`bin/rake admin:create_admin[email-du-compte-github@exemple.com]`
- lister les comptes super admin :
`bin/rake admin:list`
- supprimer un compte super admin :
`bin/rake admin:delete_admin[email-du-compte-github@exemple.com]`
Des tâches de gestion des comptes super-admin sont prévues dans le namespace `superadmin`.
Pour les lister : `bin/rake -D superadmin:`.
### Tâches daide au support

View file

@ -3,75 +3,16 @@
@import "placeholders";
@import "mixins";
$auth-breakpoint: $two-columns-breakpoint;
.preview {
font-size: 24px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@media (max-width: $auth-breakpoint) {
display: none;
}
}
h3 {
color: $blue;
font-weight: bold;
}
.close-procedure {
font-size: 12px;
}
.procedure-title {
font-size: 30px;
margin: 20px 0 0;
@media (min-width: $auth-breakpoint) {
margin: 50px 0 32px;
}
}
.procedure-description {
font-size: 14px;
p {
margin-bottom: 2 * $default-spacer;
}
@media (max-width: $auth-breakpoint) {
display: none; // TO FIX : make this description available for small devices
}
}
.procedure-logos {
display: flex;
justify-content: space-around;
img {
max-height: 50px;
max-width: 100%;
margin: 0 10px;
@media (min-width: $auth-breakpoint) {
max-height: 130px;
max-width: 500px;
}
}
}
}
.auth-form {
.reset-password {
margin-top: - 3 * $default-spacer;
margin-bottom: $default-spacer;
.auth-options {
display: flex;
justify-content: space-between;
margin-bottom: 4 * $default-spacer;
}
.remember-me {
display: inline-block;
margin-bottom: 0;
}
.separation {
@ -120,10 +61,12 @@ $auth-breakpoint: $two-columns-breakpoint;
}
}
.identity-form {
@media (max-width: $two-columns-breakpoint) {
input[type=submit] {
margin-bottom: 2 * $default-padding;
}
.sign-in-form .form {
input[type="password"] {
margin-bottom: $default-spacer;
}
input[type="checkbox"] {
margin-bottom: 0;
}
}

View file

@ -24,4 +24,8 @@
&.justify-start {
justify-content: flex-start;
}
&.wrap {
flex-wrap: wrap;
}
}

View file

@ -4,6 +4,7 @@
.merci {
text-align: center;
margin-bottom: 60px;
img {
margin-top: 4 * $default-padding;

View file

@ -0,0 +1,71 @@
@import "colors";
@import "constants";
$procedure-context-breakpoint: $two-columns-breakpoint;
.procedure-preview {
font-size: 24px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@media (max-width: $procedure-context-breakpoint) {
display: none;
}
}
h3 {
color: $blue;
font-weight: bold;
}
.close-procedure {
font-size: 12px;
}
.procedure-title {
font-size: 30px;
margin: 20px 0 0;
@media (min-width: $procedure-context-breakpoint) {
margin: 50px 0 32px;
}
}
.procedure-description {
font-size: 14px;
p {
margin-bottom: 2 * $default-spacer;
}
@media (max-width: $procedure-context-breakpoint) {
display: none; // TO FIX : make this description available for small devices
}
}
.procedure-logos {
display: flex;
justify-content: space-around;
img {
max-height: 50px;
max-width: 100%;
margin: 0 10px;
@media (min-width: $procedure-context-breakpoint) {
max-height: 130px;
max-width: 500px;
}
}
}
}
.procedure-context-content {
@media (max-width: $procedure-context-breakpoint) {
input[type=submit] {
margin-bottom: 2 * $default-padding;
}
}
}

View file

@ -5,12 +5,16 @@ class Admin::ProceduresController < AdminController
before_action :retrieve_procedure, only: [:show, :edit, :delete_logo, :delete_deliberation, :delete_notice]
def index
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.publiees.order(published_at: :desc),
partial: "admin/procedures/list",
array: true
if current_administrateur.procedures.count != 0
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.publiees.order(published_at: :desc),
partial: "admin/procedures/list",
array: true
active_class
active_class
else
redirect_to new_from_existing_admin_procedures_path
end
end
def archived
@ -71,6 +75,10 @@ class Admin::ProceduresController < AdminController
render 'new'
else
flash.notice = 'Démarche enregistrée.'
gestionnaire = Gestionnaire.find_by(email: current_administrateur.email)
if gestionnaire
gestionnaire.assign_to_procedure(@procedure)
end
redirect_to admin_procedure_types_de_champ_path(procedure_id: @procedure.id)
end
end

View file

@ -1,8 +1,10 @@
class AdminController < ApplicationController
layout 'application_old'
before_action :authenticate_administrateur!
def index
redirect_to (admin_procedures_path)
redirect_to(admin_procedures_path)
end
def retrieve_procedure

View file

@ -3,8 +3,6 @@ require 'zxcvbn'
class Administrateurs::ActivateController < ApplicationController
include TrustedDeviceConcern
layout "new_application"
def new
@administrateur = Administrateur.find_inactive_by_token(params[:token])

View file

@ -1,6 +1,4 @@
class Administrateurs::SessionsController < Sessions::SessionsController
layout "new_application"
def new
redirect_to new_user_session_path
end

View file

@ -1,6 +1,4 @@
class Administrations::SessionsController < ApplicationController
layout "new_application"
def new
end

View file

@ -6,7 +6,7 @@ class API::V1::DossiersController < APIController
def index
dossiers = @dossiers.page(params[:page]).per(per_page)
render json: { dossiers: dossiers.map{ |dossier| DossiersSerializer.new(dossier) }, pagination: pagination(dossiers) }, status: 200
render json: { dossiers: dossiers.map { |dossier| DossiersSerializer.new(dossier) }, pagination: pagination(dossiers) }, status: 200
rescue ActiveRecord::RecordNotFound
render json: {}, status: 404
end

View file

@ -1,6 +1,4 @@
class DemandesController < ApplicationController
layout "new_application"
def new
end

View file

@ -1,8 +1,6 @@
class Gestionnaires::ActivateController < ApplicationController
include TrustedDeviceConcern
layout "new_application"
def new
@gestionnaire = Gestionnaire.with_reset_password_token(params[:token])

View file

@ -1,6 +1,4 @@
class Gestionnaires::SessionsController < Sessions::SessionsController
layout "new_application"
def new
redirect_to new_user_session_path
end

View file

@ -1,7 +1,5 @@
module NewAdministrateur
class AdministrateurController < ApplicationController
layout 'new_application'
before_action :authenticate_administrateur!
end
end

View file

@ -76,7 +76,7 @@ module NewGestionnaire
@email = params[:email]
@dossier = Avis.includes(:dossier).find(params[:id]).dossier
render layout: 'new_application'
render
end
def create_gestionnaire

View file

@ -1,7 +1,5 @@
module NewGestionnaire
class GestionnaireController < ApplicationController
layout "new_application"
before_action :authenticate_gestionnaire!
def nav_bar_profile

View file

@ -2,6 +2,8 @@ module NewUser
class DossiersController < UserController
include DossierHelper
layout 'procedure_context', only: [:identite, :update_identite, :siret, :update_siret]
SESSION_USER_RETURN_LOCATION = 'user_return_to'
ACTIONS_ALLOWED_TO_ANY_USER = [:index, :recherche, :new]
ACTIONS_ALLOWED_TO_OWNER_OR_INVITE = [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire, :purge_champ_piece_justificative]

View file

@ -1,7 +1,5 @@
module NewUser
class UserController < ApplicationController
layout "new_application"
before_action :authenticate_user!
def nav_bar_profile

View file

@ -1,6 +1,4 @@
class RootController < ApplicationController
layout 'new_application'
def index
if administrateur_signed_in?
return redirect_to admin_procedures_path

View file

@ -1,6 +1,4 @@
class StatsController < ApplicationController
layout "new_application"
before_action :authenticate_administration!, only: [:download]
MEAN_NUMBER_OF_CHAMPS_IN_A_FORM = 24.0
@ -165,10 +163,15 @@ class StatsController < ApplicationController
end
def contact_percentage
from = Date.new(2017, 10)
from = Date.new(2018, 1)
to = Date.today.prev_month
Helpscout::UserConversationsAdapter.new(from, to)
adapter = Helpscout::UserConversationsAdapter.new(from, to)
if !adapter.can_fetch_reports?
return nil
end
adapter
.reports
.map do |monthly_report|
start_date = monthly_report[:start_date].to_time.localtime
@ -211,7 +214,7 @@ class StatsController < ApplicationController
association
.where(date_attribute => min_date..max_date)
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
.group("DATE_TRUNC('month', #{date_attribute})")
.count
.to_a
.sort_by { |a| a[0] }
@ -221,8 +224,8 @@ class StatsController < ApplicationController
def cumulative_hash(association, date_attribute)
sum = 0
association
.where("#{date_attribute.to_s} < ?", max_date)
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
.where("#{date_attribute} < ?", max_date)
.group("DATE_TRUNC('month', #{date_attribute})")
.count
.to_a
.sort_by { |a| a[0] }
@ -271,7 +274,7 @@ class StatsController < ApplicationController
dossiers_grouped_by_procedure = value.group_by { |dossier| dossier[0] }
# Compute the mean time for this procedure
procedure_processing_times = dossiers_grouped_by_procedure.map do |procedure_id, procedure_dossiers|
procedure_processing_times = dossiers_grouped_by_procedure.map do |_procedure_id, procedure_dossiers|
procedure_dossiers_processing_time = procedure_dossiers.map do |dossier|
(dossier[2] - dossier[1]).to_f / (3600 * 24)
end

View file

@ -1,6 +1,4 @@
class SupportController < ApplicationController
layout "new_application"
def index
setup_context
end

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true
class Users::ConfirmationsController < Devise::ConfirmationsController
layout "new_application"
# GET /resource/confirmation/new
def new
# Allow displaying the user email in the message

View file

@ -1,6 +1,4 @@
class Users::PasswordsController < Devise::PasswordsController
layout "new_application"
after_action :try_to_authenticate_gestionnaire, only: [:update]
after_action :try_to_authenticate_administrateur, only: [:update]

View file

@ -1,6 +1,4 @@
class Users::RegistrationsController < Devise::RegistrationsController
layout "new_application"
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

View file

@ -2,8 +2,6 @@ class Users::SessionsController < Sessions::SessionsController
include TrustedDeviceConcern
include ActionView::Helpers::DateHelper
layout "new_application"
# GET /resource/sign_in
def new
if user_return_to_procedure_id.present? # WTF ?

View file

@ -1,21 +0,0 @@
class ChampDecorator < Draper::Decorator
delegate_all
def value
if type_champ == TypeDeChamp.type_champs.fetch(:date) && object.value.present?
Date.parse(object.value).strftime("%d/%m/%Y")
elsif type_champ.in? [TypeDeChamp.type_champs.fetch(:checkbox), TypeDeChamp.type_champs.fetch(:engagement)]
object.value == 'on' ? 'Oui' : 'Non'
elsif type_champ == TypeDeChamp.type_champs.fetch(:yes_no)
if object.value == 'true'
'Oui'
elsif object.value == 'false'
'Non'
end
elsif type_champ == TypeDeChamp.type_champs.fetch(:multiple_drop_down_list) && object.value.present?
JSON.parse(object.value).join(', ')
else
object.value
end
end
end

View file

@ -1,12 +0,0 @@
class DossierDecorator < Draper::Decorator
delegate :current_page, :limit_value, :total_pages
delegate_all
def first_creation
created_at.strftime('%d/%m/%Y %H:%M')
end
def last_update
updated_at.strftime('%d/%m/%Y %H:%M')
end
end

View file

@ -1,3 +0,0 @@
class DossiersDecorator < Draper::CollectionDecorator
delegate :current_page, :limit_value, :total_pages
end

View file

@ -1,7 +0,0 @@
class FranceConnectInformationDecorator < Draper::Decorator
delegate_all
def gender_fr
gender == 'female' ? 'Mme' : 'M.'
end
end

View file

@ -1,25 +0,0 @@
class ProcedureDecorator < Draper::Decorator
delegate_all
def created_at_fr
created_at.strftime('%d/%m/%Y %H:%M')
end
def published_at_fr
if published_at.present?
published_at.strftime('%d/%m/%Y %H:%M')
end
end
def logo_img
if logo.blank?
h.image_url("marianne.svg")
else
if Flipflop.remote_storage?
(RemoteDownloader.new logo.filename).url
else
(LocalDownloader.new logo.path, 'logo').url
end
end
end
end

View file

@ -1,3 +0,0 @@
class ProceduresDecorator < Draper::CollectionDecorator
delegate :current_page, :limit_value, :total_pages
end

View file

@ -1,49 +0,0 @@
class TypeDeChampDecorator < Draper::Decorator
delegate_all
def button_up(params)
h.link_to '', params[:url], class: up_classes,
id: "btn_up_#{params[:index]}",
remote: true,
method: :post,
style: display_up_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
end
def button_down(params)
h.link_to '', params[:url], class: down_classes,
id: "btn_down_#{params[:index]}",
remote: true,
method: :post,
style: display_down_button?(params[:index], params[:private]) ? '' : 'visibility: hidden;'
end
private
def up_classes
base_classes << 'fa-chevron-up'
end
def down_classes
base_classes << 'fa-chevron-down'
end
def base_classes
['btn', 'btn-default', 'form-control', 'fa']
end
def display_up_button?(index, private)
!(index == 0 || count_type_de_champ(private) < 2)
end
def display_down_button?(index, private)
(index + 1) < count_type_de_champ(private)
end
def count_type_de_champ(private)
if private
@count_type_de_champ ||= procedure.types_de_champ_private.count
else
@count_type_de_champ ||= procedure.types_de_champ.count
end
end
end

View file

@ -1,40 +0,0 @@
class TypeDePieceJustificativeDecorator < Draper::Decorator
delegate_all
def button_up(params)
if display_up_button?(params[:index])
h.link_to '', params[:url], class: up_classes, id: "btn_up_#{params[:index]}", remote: true, method: :post
end
end
def button_down(params)
if display_down_button?(params[:index])
h.link_to '', params[:url], class: down_classes, id: "btn_down_#{params[:index]}", remote: true, method: :post
end
end
private
def up_classes
base_classes << 'fa-chevron-up'
end
def down_classes
base_classes << 'fa-chevron-down'
end
def base_classes
['btn', 'btn-default', 'form-control', 'fa']
end
def display_up_button?(index)
!(index == 0 || count_type_de_piece_justificative < 2)
end
def display_down_button?(index)
(index + 1) < count_type_de_piece_justificative
end
def count_type_de_piece_justificative
@count_type_de_piece_justificative ||= procedure.types_de_piece_justificative.count
end
end

View file

@ -1,12 +0,0 @@
class UserDecorator < Draper::Decorator
delegate_all
def gender_fr
case gender
when 'male'
'M.'
when 'female'
'Mme'
end
end
end

View file

@ -0,0 +1,55 @@
module AdminFormulaireHelper
BASE_CLASSES = ['btn', 'btn-default', 'form-control', 'fa']
def button_up(procedure, kind, index, url)
if display_up_button?(index, procedure, kind)
button(up_classes, "btn_up_#{index}", url)
end
end
def button_down(procedure, kind, index, url)
if display_down_button?(index, procedure, kind)
button(down_classes, "btn_down_#{index}", url)
end
end
private
def button(classes, id, url)
link_to(
'',
url,
class: classes,
id: id,
remote: true,
method: :post
)
end
def up_classes
BASE_CLASSES + ['fa-chevron-up']
end
def down_classes
BASE_CLASSES + ['fa-chevron-down']
end
def display_up_button?(index, procedure, kind)
index != 0 && count_type_de_champ(procedure, kind) > 1
end
def display_down_button?(index, procedure, kind)
(index + 1) < count_type_de_champ(procedure, kind)
end
def count_type_de_champ(procedure, kind)
case kind
when "public"
@count_type_de_champ_public ||= procedure.types_de_champ.count
when "private"
@count_type_de_champ_private ||= procedure.types_de_champ_private.count
when "piece_justificative"
@count_type_de_piece_justificative ||= procedure.types_de_piece_justificative.count
end
end
end

View file

@ -9,4 +9,25 @@ module ChampHelper
raw(champ.to_render_data.to_json)
# rubocop:enable Rails/OutputSafety
end
def formatted_value(champ)
value = champ.value
type = champ.type_champ
if type == TypeDeChamp.type_champs.fetch(:date) && value.present?
Date.parse(value).strftime("%d/%m/%Y")
elsif type.in? [TypeDeChamp.type_champs.fetch(:checkbox), TypeDeChamp.type_champs.fetch(:engagement)]
value == 'on' ? 'Oui' : 'Non'
elsif type == TypeDeChamp.type_champs.fetch(:yes_no)
if value == 'true'
'Oui'
elsif value == 'false'
'Non'
end
elsif type == TypeDeChamp.type_champs.fetch(:multiple_drop_down_list) && value.present?
JSON.parse(value).join(', ')
else
value
end
end
end

View file

@ -19,4 +19,18 @@ module ProcedureHelper
action = procedure.archivee? ? :reopen : :publish
t(action, scope: [:modal, :publish, key])
end
def logo_img(procedure)
logo = procedure.logo
if logo.blank?
ActionController::Base.helpers.image_url("marianne.svg")
else
if Flipflop.remote_storage?
RemoteDownloader.new(logo.filename).url
else
LocalDownloader.new(logo.path, 'logo').url
end
end
end
end

View file

@ -1,7 +1,7 @@
class AutoReceiveDossiersForProcedureJob < ApplicationJob
queue_as :cron
def perform(procedure_id, state, gestionnaire_id = nil)
def perform(procedure_id, state)
procedure = Procedure.find(procedure_id)
gestionnaire = procedure.gestionnaire_for_cron_job

View file

@ -7,6 +7,15 @@ class Helpscout::API
PHONES = 'phones'
OAUTH2_TOKEN = 'oauth2/token'
def ready?
required_secrets = [
Rails.application.secrets.helpscout[:mailbox_id],
Rails.application.secrets.helpscout[:client_id],
Rails.application.secrets.helpscout[:client_secret]
]
required_secrets.all?(&:present?)
end
def add_tags(conversation_id, tags)
call_api(:put, "#{CONVERSATIONS}/#{conversation_id}/#{TAGS}", {
tags: tags
@ -69,7 +78,7 @@ class Helpscout::API
response = call_api(:get, 'reports/conversations?' + params.to_query)
if !response.success?
raise StandardError, "Error while fetching conversation report: #{response.status} '#{response.body}'"
raise StandardError, "Error while fetching conversation report: #{response.response_code} '#{response.body}'"
end
parse_response_body(response)

View file

@ -7,6 +7,10 @@ class Helpscout::UserConversationsAdapter
@to = to
end
def can_fetch_reports?
api_client.ready?
end
# Return an array of monthly reports
def reports
@reports ||= (@from..@to)
@ -35,15 +39,17 @@ class Helpscout::UserConversationsAdapter
}
end
def api_client
@api_client ||= Helpscout::API.new
end
def fetch_conversations_report(year, month)
if year == Date.today.year && month == Date.today.month
raise ArgumentError, 'The report for the current month will change in the future, and cannot be cached.'
end
@helpscout_api ||= Helpscout::API.new
Rails.cache.fetch("helpscout-conversation-report-#{year}-#{month}") do
@helpscout_api.conversations_report(year, month)
api_client.conversations_report(year, month)
end
end
end

View file

@ -36,7 +36,7 @@ class Champ < ApplicationRecord
end
def search_terms
[ to_s ]
[to_s]
end
def to_s

View file

@ -1,7 +1,7 @@
class Champs::CheckboxChamp < Champ
def search_terms
if value == 'on'
[ libelle ]
[libelle]
end
end

View file

@ -12,7 +12,7 @@ class Champs::DatetimeChamp < Champ
self.value =
begin
hash_date = YAML.safe_load(value.gsub('=>', ': '))
year, month, day, hour, minute = hash_date.values_at(1,2,3,4,5)
year, month, day, hour, minute = hash_date.values_at(1, 2, 3, 4, 5)
Time.zone.local(year, month, day, hour, minute).strftime("%d/%m/%Y %H:%M")
rescue
nil

View file

@ -1,7 +1,7 @@
class Champs::EngagementChamp < Champs::CheckboxChamp
def search_terms
if value == 'on'
[ libelle ]
[libelle]
end
end
end

View file

@ -38,7 +38,7 @@ class Champs::LinkedDropDownListChamp < Champ
end
def search_terms
[ primary_value, secondary_value ]
[primary_value, secondary_value]
end
private
@ -52,6 +52,6 @@ class Champs::LinkedDropDownListChamp < Champ
end
def pack_value(primary, secondary)
self.value = JSON.generate([ primary, secondary ])
self.value = JSON.generate([primary, secondary])
end
end

View file

@ -31,11 +31,11 @@ class Champs::PieceJustificativeChamp < Champ
if piece_justificative_file.attached? && piece_justificative_file.previous_changes.present?
if piece_justificative_file.blob.byte_size > PIECE_JUSTIFICATIVE_FILE_MAX_SIZE
errors << "Le fichier #{piece_justificative_file.filename.to_s} est trop lourd, il doit faire au plus #{PIECE_JUSTIFICATIVE_FILE_MAX_SIZE.to_s(:human_size, precision: 2)}"
errors << "Le fichier #{piece_justificative_file.filename} est trop lourd, il doit faire au plus #{PIECE_JUSTIFICATIVE_FILE_MAX_SIZE.to_s(:human_size, precision: 2)}"
end
if !piece_justificative_file.blob.content_type.in?(PIECE_JUSTIFICATIVE_FILE_ACCEPTED_FORMATS)
errors << "Le fichier #{piece_justificative_file.filename.to_s} est dans un format que nous n'acceptons pas"
errors << "Le fichier #{piece_justificative_file.filename} est dans un format que nous n'acceptons pas"
end
# FIXME: add Clamav check

View file

@ -40,6 +40,6 @@ class Champs::SiretChamp < Champ
accepts_nested_attributes_for :etablissement, allow_destroy: true, update_only: true
def search_terms
etablissement.present? ? etablissement.search_terms : [ value ]
etablissement.present? ? etablissement.search_terms : [value]
end
end

View file

@ -1,7 +1,7 @@
class Champs::YesNoChamp < Champs::CheckboxChamp
def search_terms
if value == 'true'
[ libelle ]
[libelle]
end
end

View file

@ -133,7 +133,7 @@ module TagsSubstitutionConcern
end
def external_link(url)
link_to(url, url, target: '_blank')
link_to(url, url, target: '_blank', rel: 'noopener')
end
def dossier_tags

View file

@ -7,11 +7,7 @@ class DropDownList < ApplicationRecord
end
def disabled_options
options.select{ |v| (v =~ /^--.*--$/).present? }
end
def selected_options(champ)
champ.object.value.blank? ? [] : multiple ? JSON.parse(champ.object.value) : [champ.object.value]
options.select { |v| (v =~ /^--.*--$/).present? }
end
def selected_options_without_decorator(champ)

View file

@ -91,6 +91,6 @@ class Etablissement < ApplicationRecord
def message_for_signature
JSON.pretty_generate(as_json(include: {
exercices: { only: [:ca, :date_fin_exercice, :date_fin_exercice_timestamp] }
}).delete_if { |k,v| v.blank? })
}).delete_if { |_k, v| v.blank? })
end
end

View file

@ -3,6 +3,8 @@ class Gestionnaire < ApplicationRecord
include EmailSanitizableConcern
include ActiveRecord::SecureToken
LOGIN_TOKEN_VALIDITY = 30.minutes
devise :database_authenticatable, :registerable, :async,
:recoverable, :rememberable, :trackable, :validatable
@ -141,7 +143,7 @@ class Gestionnaire < ApplicationRecord
def login_token_valid?(login_token)
BCrypt::Password.new(encrypted_login_token) == login_token &&
30.minutes.ago < login_token_created_at
LOGIN_TOKEN_VALIDITY.ago < login_token_created_at
rescue BCrypt::Errors::InvalidHash
false
end

View file

@ -176,6 +176,7 @@ class Procedure < ApplicationRecord
else
list[index_of_first_element].update(order_place: index_of_first_element + 1)
list[index_of_first_element + 1].update(order_place: index_of_first_element)
reload
true
end

View file

@ -46,7 +46,7 @@ class ProcedurePresentation < ApplicationRecord
)
end
explanatory_types_de_champ = [:header_section, :explication].map{ |k| TypeDeChamp.type_champs.fetch(k) }
explanatory_types_de_champ = [:header_section, :explication].map { |k| TypeDeChamp.type_champs.fetch(k) }
fields.concat procedure.types_de_champ
.reject { |tdc| explanatory_types_de_champ.include?(tdc.type_champ) }
@ -215,7 +215,7 @@ class ProcedurePresentation < ApplicationRecord
def valid_columns_for_table(table)
@column_whitelist ||= fields
.group_by { |field| field['table'] }
.map { |table, fields| [table, Set.new(fields.map { |field| field['column'] }) ] }
.map { |table, fields| [table, Set.new(fields.map { |field| field['column'] })] }
.to_h
@column_whitelist[table] || []

View file

@ -10,7 +10,7 @@ class PiecesJustificativesService
errors = with_virus
.map { |_, content| "#{content.original_filename} : virus détecté" }
errors += without_virus
errors + without_virus
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
.compact()
end

View file

@ -212,7 +212,8 @@ class ProcedureExportService
etablissement.champ.dossier_id,
label_for_export(etablissement.champ.libelle).to_s
]
data += etablissement_data(etablissement)
data + etablissement_data(etablissement)
end
end

View file

@ -17,7 +17,7 @@ class RenderPartialService
def self.left_panel_exist?(left_panel_url)
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
private
@ -31,6 +31,6 @@ class RenderPartialService
end
def retrieve_name
"#{controller.to_s.parameterize.underscore}_#{method.to_s}"
"#{controller.to_s.parameterize.underscore}_#{method}"
end
end

View file

@ -1,28 +1,22 @@
class SignatureService
class << self
def generate
RbNaCl::Util.bin2hex(RbNaCl::SigningKey.generate)
end
def verify(signature, message)
message = Base64.urlsafe_encode64(message)
begin
signing_key.verify_key
.verify(RbNaCl::Util.hex2bin(signature), message)
rescue RbNaCl::BadSignatureError, RbNaCl::LengthError
decoded_message = verifier.verify(signature)
return message == decoded_message
rescue ActiveSupport::MessageVerifier::InvalidSignature
return false
end
end
def sign(message)
message = Base64.urlsafe_encode64(message)
RbNaCl::Util.bin2hex(signing_key.sign(message))
verifier.generate(message)
end
private
def signing_key
@@signing_key ||= RbNaCl::SigningKey.new(RbNaCl::Util.hex2bin(Rails.application.secrets.signing_key))
def verifier
@@verifier ||= ActiveSupport::MessageVerifier.new(Rails.application.secrets.signing_key)
end
end
end

View file

@ -36,11 +36,11 @@ class TypesDeChampService
end
def types_de_champ
private? ? @procedure.types_de_champ_private.decorate : @procedure.types_de_champ.decorate
private? ? @procedure.types_de_champ_private : @procedure.types_de_champ
end
def new_type_de_champ
TypeDeChamp.new(private: private?).decorate
TypeDeChamp.new(private: private?)
end
def fields_for_var

View file

@ -18,6 +18,6 @@ class CommentaireFileUploader < BaseUploader
end
def accept_extension_list
extension_white_list.map{ |e| ".#{e}" }.join(",")
extension_white_list.map { |e| ".#{e}" }.join(",")
end
end

View file

@ -18,9 +18,6 @@
%br
%br
= f.submit 'Valider', class: 'btn btn-info', style: 'float: left;', id: 'add-gestionnaire-email'
%br
.alert.alert-info
Astuce : ajoutez votre adresse email pour tester la partie instructeur.
.col-xs-6
%h3.text-success Affectés
= smart_listing_render :instructeurs_assign

View file

@ -20,8 +20,8 @@
- if ff.object.id.present?
.form-group
%br &nbsp;
= ff.object.button_up(index: ff.index, url: move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
= ff.object.button_down(index: ff.index, url: move_down_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
= button_up(@procedure, "piece_justificative", ff.index, move_up_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
= button_down(@procedure, "piece_justificative", ff.index, move_down_admin_procedure_pieces_justificatives_path(@procedure, ff.index))
.form-group
%h4 Obligatoire ?

View file

@ -1,7 +1,7 @@
= form_for [:admin, @procedure], url: admin_procedure_pieces_justificatives_path(@procedure), remote: true do |f|
#liste_piece_justificative
= render partial: 'fields', locals: { types_de_piece_justificative: @procedure.types_de_piece_justificative.decorate, f: f }
= render partial: 'fields', locals: { types_de_piece_justificative: @procedure.types_de_piece_justificative, f: f }
= f.submit "Enregistrer", class: 'btn btn-success', id: :save
%hr
#new_type_de_piece_justificative
= render partial: 'fields', locals: { types_de_piece_justificative: TypeDePieceJustificative.new.decorate, f: f }
= render partial: 'fields', locals: { types_de_piece_justificative: TypeDePieceJustificative.new, f: f }

View file

@ -101,7 +101,7 @@
.col-md-6
%h4 Logo de la démarche
- if @procedure.logo.present?
= image_tag @procedure.decorate.logo_img, { style: 'height: 40px; display: inline; margin-right: 6px;', id: 'preview_procedure_logo' }
= image_tag logo_img(@procedure), { style: 'height: 40px; display: inline; margin-right: 6px;', id: 'preview_procedure_logo' }
\-
- if @procedure.persisted?

View file

@ -12,7 +12,7 @@
%th Actions
- @procedures.each do |procedure|
- procedure = procedure.decorate
- procedure = procedure
- admin_procedure_href = admin_procedure_path(procedure)
%tr{ id: "tr_dossier_#{procedure.id}", data: { href: admin_procedure_href } }
%td= link_to(procedure.id, admin_procedure_href)
@ -20,9 +20,9 @@
- if procedure.publiee?
%td.procedure-lien= link_to(procedure_lien(procedure), procedure_lien(procedure))
- if procedure.publiee_ou_archivee?
%td= link_to(procedure.published_at_fr, admin_procedure_href)
%td= link_to(procedure.published_at.present? ? procedure.published_at.strftime('%d/%m/%Y %H:%M') : "", admin_procedure_href)
- else
%td= link_to(procedure.created_at_fr, admin_procedure_href)
%td= link_to(procedure.created_at.strftime('%d/%m/%Y %H:%M'), admin_procedure_href)
%td
= link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn')
- if !procedure.publiee_ou_archivee?

View file

@ -1,9 +1,13 @@
.row.white-back
%a#from-scratch{ href: new_admin_procedure_path, class: 'btn-sm btn-primary' }
- if current_administrateur.procedures.brouillons.count == 0
%h4{ style: 'padding: 20px; margin: 20px !important;' }
Bienvenue, vous allez pouvoir créer une première démarche de test. Celle-ci sera visible uniquement par vous et ne sera publiée nulle part, alors pas de crainte à avoir.
.row{ style: 'padding: 20px; margin: 20px !important;' }
%a#from-scratch{ href: new_admin_procedure_path, class: 'btn-lg btn-primary' }
Créer une nouvelle démarche de zéro
.row.white-back
%h2
%h3
Créer une nouvelle démarche à partir d'une démarche existante
.section.section-label

View file

@ -1,5 +1,5 @@
= f.fields_for type_de_champ_service.fields_for_var, types_de_champ, remote: true do |ff|
- type_champ = ff.object.object.type_champ
- type_champ = ff.object.type_champ
.form-inline{ class: (type_champ == TypeDeChamp.type_champs.fetch(:header_section) ? 'header-section' : nil) }
.form-group.libelle
@ -16,14 +16,14 @@
.form-group.drop-down-list{ class: (%w(drop_down_list multiple_drop_down_list linked_drop_down_list).include?(type_champ) ? 'show-inline' : nil), style: 'margin-right: 5px;' }
%h4 Liste déroulante
= ff.fields_for :drop_down_list_attributes, ff.object.object.drop_down_list do |fff|
= ff.fields_for :drop_down_list_attributes, ff.object.drop_down_list do |fff|
~ fff.text_area :value, class: 'form-control drop_down_list', placeholder: "Ecrire une valeur par ligne et --valeur-- pour un séparateur.", rows: 3, cols: 30
= fff.hidden_field :id
.form-group.pj-template{ class: (type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative)) ? 'show-inline' : nil }
%h4 Modèle
- if type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative)
- template = ff.object.object.piece_justificative_template
- template = ff.object.piece_justificative_template
- if !template.attached?
= ff.file_field :piece_justificative_template,
@ -52,7 +52,7 @@
= ff.check_box :parcelles_agricoles
Parcelles Agricoles
- hide_mandatory = (ff.object.object.private? || type_champ == TypeDeChamp.type_champs.fetch(:explication))
- hide_mandatory = (ff.object.private? || type_champ == TypeDeChamp.type_champs.fetch(:explication))
.form-group.mandatory{ style: hide_mandatory ? 'visibility: hidden;' : nil }
%h4 Obligatoire ?
.center
@ -65,8 +65,9 @@
- if ff.object.id.present?
.form-group
%br &nbsp;
= ff.object.button_up(index: ff.index, url: type_de_champ_service.move_up_url(ff), private: type_de_champ_service.private?)
= ff.object.button_down(index: ff.index, url: type_de_champ_service.move_down_url(ff), private: type_de_champ_service.private?)
- kind = type_de_champ_service.private? ? "private" : "public"
= button_up(@procedure, kind, ff.index, type_de_champ_service.move_up_url(ff))
= button_down(@procedure, kind, ff.index, type_de_champ_service.move_down_url(ff))
.form-group
%h4 position

View file

@ -85,7 +85,9 @@
= link_to destroy_user_session_path, method: :delete, class: "menu-item menu-link" do
= image_tag "icons/sign-out.svg"
Se déconnecter
- elsif request.path != new_user_session_path
- if request.path == new_user_registration_path
%li
Vous avez déjà un compte ?
%li
= link_to "Connexion", new_user_session_path, class: "button secondary"

View file

@ -0,0 +1,26 @@
:javascript
(function() {
window.sib = { equeue: [], client_key: "pcxtf4lpkka986pf4l1kt" };
/* OPTIONAL: email for identify request*/
window.sib.email_id = '#{current_administrateur.email}';
window.sendinblue = {}; for (var j = ['track', 'identify', 'trackLink', 'page'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();
})();
sendinblue.identify('#{current_administrateur.email}', {
'nb_demarches_brouillons': '#{current_administrateur.procedures.brouillons.count}',
'nb_demarches_actives': '#{current_administrateur.procedures.publiees.count}',
'nb_demarches_archivees': '#{current_administrateur.procedures.archivees.count}',
'sign_in_count' : '#{current_administrateur.sign_in_count}',
'created_at' : '#{current_administrateur.created_at}',
'active' : '#{current_administrateur.active}'
// Dans l'ideal :
// 'nom' : //pour personnaliser les emails
// 'prenom' : //pour personnaliser les emails
// 'nb_demarches_prod' : // Avec plus de 20 dossiers
// 'nb_demarches_test' : // Avec entre 1 et 20 dossiers
// 'nb_services' : //combien de service ?
// 'nb_instructeurs' : //combien d'instructeur en tout ?
// 'nb_dossiers' : //combien de dossier en tout ?
});

View file

@ -1,20 +1,25 @@
%html
!!! 5
%html{ lang: "fr" }
%head
%meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }/
%meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" }
%meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" }
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1" }
= csrf_meta_tags
%title
= t('dynamics.page_title')
%meta{ 'http-equiv' => "X-UA-Compatible", :content => "IE=edge" }
= content_for?(:title) ? "#{yield(:title)} · demarches-simplifiees.fr" : "demarches-simplifiees.fr"
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': "reload"
= stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track': "reload"
= javascript_pack_tag 'application-old', defer: true, 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= javascript_pack_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/new_application', media: 'all', 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/print', media: 'print', 'data-turbolinks-track': 'reload'
- if Rails.env.development?
= stylesheet_link_tag :xray
= render partial: "layouts/matomo"
@ -24,29 +29,21 @@
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
= render partial: 'layouts/outdated_browser_banner'
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
.page-wrapper
= render partial: "layouts/outdated_browser_banner"
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
#wrap
.row
#header.navbar
= render partial: "layouts/navbar"
.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
.col-xs-2#left-panel
= render partial: @left_pannel_url
- main_container_size = 10
- else
- main_container_size = 12
= render partial: "layouts/new_header"
= render partial: "layouts/flash_messages"
= content_for?(:content) ? yield(:content) : yield
= render partial: 'layouts/main_container', locals: { main_container_size: main_container_size }
#mask-search
%h1
%i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' }
- if content_for?(:footer)
= content_for(:footer)
= render partial: 'layouts/switch_devise_profile_module'
- if Rails.env.development?
= javascript_include_tag :xray
= render partial: 'layouts/footer', locals: { main_container_size: main_container_size }
= yield :charts_js

View file

@ -0,0 +1,53 @@
%html
%head
%meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }/
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%title
= t('dynamics.page_title')
%meta{ 'http-equiv' => "X-UA-Compatible", :content => "IE=edge" }
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': "reload"
= stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track': "reload"
= javascript_pack_tag 'application-old', defer: true, 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= render partial: "layouts/matomo"
= render partial: "layouts/sendinblue"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
= render partial: 'layouts/outdated_browser_banner'
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
#wrap
.row
#header.navbar
= render partial: "layouts/navbar"
.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
.col-xs-2#left-panel
= render partial: @left_pannel_url
- main_container_size = 10
- else
- main_container_size = 12
= render partial: 'layouts/main_container', locals: { main_container_size: main_container_size }
#mask-search
%h1
%i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' }
= render partial: 'layouts/switch_devise_profile_module'
= render partial: 'layouts/footer', locals: { main_container_size: main_container_size }

View file

@ -1,7 +1,7 @@
#first-block
.en-cours
- if @procedure.logo.present?
= image_tag @procedure.decorate.logo_img, style: 'width: 30px;'
= image_tag logo_img(@procedure), style: 'width: 30px;'
%b
= @procedure.libelle
@ -14,6 +14,10 @@
.procedure-list-element{ class: ('active' if active == 'Informations') }
Publication
%a#onglet-description{ href: url_for(edit_admin_procedure_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'Description') }
Description
%a#onglet-services{ href: current_administrateur.services.present? ? url_for(services_path(procedure_id: @procedure.id)) : url_for(new_service_path(procedure_id: @procedure.id)) }
.procedure-list-element
Services
@ -22,10 +26,6 @@
.procedure-list-element{ class: ('active' if active == 'Instructeurs') }
Instructeurs
%a#onglet-description{ href: url_for(edit_admin_procedure_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'Description') }
Description
- if !@procedure.locked?
%a#onglet-champs{ href: url_for(admin_procedure_types_de_champ_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'Champs') }
@ -41,16 +41,17 @@
.procedure-list-element{ class: ('active' if active == 'Annotations privées') }
Annotations privées
%a#onglet-inemailsfos{ href: url_for(admin_procedure_mail_templates_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'E-mails') }
E-mails
%a#onglet-preview{ href: url_for(apercu_procedure_path(@procedure)), target: "_blank" }
.procedure-list-element{ class: ('active' if active == 'Prévisualisation') }
Prévisualisation
%a#onglet-inemailsfos{ href: url_for(admin_procedure_mail_templates_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'E-mails') }
E-mails
%a#onglet-attestation{ href: url_for(edit_admin_procedure_attestation_template_path(@procedure)) }
.procedure-list-element{ class: ('active' if active == 'Attestation') } Attestation
.procedure-list-element{ class: ('active' if active == 'Attestation') }
Attestation
.split-hr-left

View file

@ -1,49 +0,0 @@
!!! 5
%html{ lang: "fr" }
%head
%meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" }
%meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" }
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1" }
= csrf_meta_tags
%title
= content_for?(:title) ? "#{yield(:title)} · demarches-simplifiees.fr" : "demarches-simplifiees.fr"
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= javascript_pack_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/new_application', media: 'all', 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/print', media: 'print', 'data-turbolinks-track': 'reload'
- if Rails.env.development?
= stylesheet_link_tag :xray
= render partial: "layouts/matomo"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
.page-wrapper
= render partial: "layouts/outdated_browser_banner"
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
= render partial: "layouts/new_header"
= render partial: "layouts/flash_messages"
= yield
- if content_for?(:footer)
= content_for(:footer)
- if Rails.env.development?
= javascript_include_tag :xray
= yield :charts_js

View file

@ -0,0 +1,22 @@
- content_for :content do
.two-columns.procedure-context
.columns-container
.column.procedure-preview
- procedure = @dossier.procedure
.procedure-logos
= image_tag logo_img(procedure)
- if procedure.euro_flag
= image_tag "flag_of_europe.svg"
%h2.procedure-title
= procedure.libelle
.procedure-description
= h string_to_html(procedure.description)
.column.procedure-context-content
= yield
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
= render template: 'layouts/application'

View file

@ -13,7 +13,7 @@
%h2 Formulaire
- champs = @dossier.champs.decorate
- champs = @dossier.champs
- if champs.any?
= render partial: "shared/dossiers/champs", locals: { champs: champs, dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' }

View file

@ -1,9 +0,0 @@
.procedure-logos
= image_tag procedure.decorate.logo_img
- if procedure.euro_flag
= image_tag "flag_of_europe.svg"
%h2.procedure-title
= procedure.libelle
.procedure-description
= h string_to_html(procedure.description)

View file

@ -1,39 +1,30 @@
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
.two-columns
.columns-container
.column.preview
= render partial: "new_user/dossiers/demarche_overview", locals: { procedure: @dossier.procedure }
- if !dossier_submission_is_closed?(@dossier)
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité
.column.identity-form
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
- if !dossier_submission_is_closed?(@dossier)
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité
%label
%span.mandatory *
champs requis
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
= f.label :gender, class: "required"
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
%label
%span.mandatory *
champs requis
.flex
.inline-champ
= f.label :prenom, class: "required"
= f.text_field :prenom, class: "small", required: true
.inline-champ
= f.label :nom, class: "required"
= f.text_field :nom, class: "small", required: true
= f.label :gender, class: "required"
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
- if @dossier.procedure.ask_birthday?
= f.label :birthdate, class: "required"
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
.flex
.inline-champ
= f.label :prenom, class: "required"
= f.text_field :prenom, class: "small", required: true
.inline-champ
= f.label :nom, class: "required"
= f.text_field :nom, class: "small", required: true
- if @dossier.procedure.ask_birthday?
= f.label :birthdate, class: "required"
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
= f.submit "Continuer", class: "button large primary expand"
= f.submit "Continuer", class: "button large primary expand"

View file

@ -1,25 +1,14 @@
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
- if !dossier_submission_is_closed?(@dossier)
= form_for current_user, url: siret_dossier_path(@dossier), html: { class: 'form', method: 'post' } do |f|
%h1 Identifier votre établissement
.two-columns
.columns-container
.column.preview
= render partial: "new_user/dossiers/demarche_overview", locals: { procedure: @dossier.procedure }
%p.mb-1 Merci de remplir le numéro de SIRET de votre entreprise, administration ou association pour commencer la démarche.
.column.identity-form
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
= f.label :siret, style: "display: none"
= f.text_field :siret, placeholder: "Numéro SIRET à 14 chiffres", required: true
- if !dossier_submission_is_closed?(@dossier)
= form_for current_user, url: siret_dossier_path(@dossier), html: { class: 'form', method: 'post' } do |f|
%h1 Identifier votre établissement
= f.hidden_field :dossier_id, value: @dossier.id
%p.mb-1 Merci de remplir le numéro de SIRET de votre entreprise, administration ou association pour commencer la démarche.
= f.label :siret, style: "display: none"
= f.text_field :siret, placeholder: "Numéro SIRET à 14 chiffres", required: true
= f.hidden_field :dossier_id, value: @dossier.id
= f.submit "Valider", class: "button large primary expand", data: { disable_with: "Récupération des informations…" }
= f.submit "Valider", class: "button large primary expand", data: { disable_with: "Récupération des informations…" }

View file

@ -2,6 +2,7 @@
%tbody
- champs.reject(&:exclude_from_view?).each do |c|
%tr
- value = formatted_value(c)
- case c.type_champ
- when TypeDeChamp.type_champs.fetch(:header_section)
%th.header-section{ colspan: 3 }
@ -10,9 +11,9 @@
%th.libelle
= "#{c.libelle} :"
%td.rich-text
- if c.value.present?
- if value.present?
%ul
- c.value.split(", ").each do |item|
- value.split(", ").each do |item|
%li
= item
- when TypeDeChamp.type_champs.fetch(:linked_drop_down_list)
@ -23,7 +24,7 @@
%th.libelle
= "#{c.libelle} :"
%td.rich-text
- dossier = Dossier.includes(:procedure).find_by(id: c.value)
- dossier = Dossier.includes(:procedure).find_by(id: value)
- if dossier
- path = dossier_linked_path(current_gestionnaire, dossier)
- if path.present?
@ -48,7 +49,7 @@
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
= simple_format(c.value)
= simple_format(value)
- when TypeDeChamp.type_champs.fetch(:siret)
%th.libelle
= "#{c.libelle} :"
@ -61,14 +62,14 @@
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
- if c.value.present?
- if value.present?
= render partial: "shared/champs/carte/show", locals: { champ: c }
- else
%th.libelle
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
= sanitize(c.value)
= sanitize(value)
- if c.type_champ != TypeDeChamp.type_champs.fetch(:header_section)
%td.updated-at
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }

View file

@ -10,7 +10,7 @@
= render partial: "shared/dossiers/identite_individual", locals: { individual: dossier.individual }
.tab-title Formulaire
- champs = dossier.champs.includes(:type_de_champ).decorate
- champs = dossier.champs.includes(:type_de_champ)
- if champs.any?
.card
= render partial: "shared/dossiers/champs", locals: { champs: champs, demande_seen_at: demande_seen_at, profile: profile }

View file

@ -1,6 +1,6 @@
= form_for(commentaire, url: form_url, html: { class: 'form' }) do |f|
= f.text_area :body, rows: 5, placeholder: 'Répondre ici', required: true, class: 'message-textarea'
.flex.justify-between
.flex.justify-between.wrap
%div
= f.file_field :file, id: :file, accept: commentaire.file.accept_extension_list
%label{ for: :file }
@ -8,4 +8,4 @@
(taille max : 20 Mo)
%div
= f.submit 'Envoyer', class: 'button primary send', data: { disable: true }
= f.submit 'Envoyer le message', class: 'button primary send', data: { disable: true }

View file

@ -1,6 +1,6 @@
.two-columns.auth
.columns-container
.column.preview
.column.procedure-preview
= image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo"
.baseline.center
%h3 Un outil simple
@ -9,7 +9,7 @@
%br
administratifs dématérialisés.
.column.auth-form
.column.procedure-context-content.auth-form
= devise_error_messages!
= form_for resource, url: user_registration_path, html: { class: "form" } do |f|
%h1 Créez-vous un compte

View file

@ -8,7 +8,7 @@
= image_tag('drapeau_europe.png')
#logo_procedure.flag
= image_tag( @dossier.procedure.decorate.logo_img )
= image_tag(logo_img(dossier.procedure))
%h2#titre-procedure.text-info
= @dossier.procedure.libelle

View file

@ -1,6 +1,6 @@
.two-columns.auth
.columns-container
.column.preview
.column.procedure-preview
- if !@dossier
= image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo"
.baseline.center
@ -13,7 +13,7 @@
.text-right
= link_to "Fermer", users_no_procedure_url, class: "link close-procedure"
.procedure-logos
= image_tag @dossier.procedure.decorate.logo_img
= image_tag logo_img(@dossier.procedure)
- if @dossier.procedure.euro_flag
= image_tag "flag_of_europe.svg"
@ -22,7 +22,7 @@
.procedure-description
= h simple_format(@dossier.procedure.description)
.column.auth-form
.column.procedure-context-content.auth-form.sign-in-form
- if resource_name == :user
%p.register
%span
@ -40,13 +40,15 @@
= f.label :password, "Mot de passe"
= f.password_field :password, value: @user.password, placeholder: "8 caractères minimum"
- if [:user, :gestionnaire].include?(resource_name)
.reset-password.text-right
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "link"
.auth-options
- if devise_mapping.rememberable?
%div
= f.check_box :remember_me, as: :boolean
= f.label :remember_me, "Se souvenir de moi", class: 'remember-me'
- if devise_mapping.rememberable?
= f.check_box :remember_me, as: :boolean
= f.label :remember_me, "Se souvenir de moi", class: 'remember-me'
- if [:user, :gestionnaire].include?(resource_name)
.text-right
= link_to "Mot de passe oublié ?", new_password_path(resource_name), class: "link"
= f.submit "Se connecter", class: "button large primary expand"
@ -58,4 +60,4 @@
= link_to "", france_connect_particulier_path, class: "login-with-fc"
.center
= link_to "Quest-ce que FranceConnect ?", "https://app.franceconnect.gouv.fr/en-savoir-plus", target: "_blank", class: "link"
= link_to "Quest-ce que FranceConnect ?", "https://franceconnect.gouv.fr/", target: "_blank", class: "link"

View file

@ -32,12 +32,19 @@ class ActiveJobLogSubscriber < ::ActiveJob::Logging::LogSubscriber
def process_event(event, type)
data = extract_metadata(event)
data.merge! extract_exception(event)
data.merge! extract_scheduled_at(event) if type == 'enqueue_at'
data.merge! extract_duration(event) if type == 'perform'
data.merge!(extract_exception(event))
case type
when 'enqueue_at'
data.merge!(extract_scheduled_at(event))
when 'perform'
data.merge!(extract_duration(event))
end
tags = ['job', type]
tags.push('exception') if data[:exception]
if data[:exception]
tags.push('exception')
end
data[:tags] = tags
data[:type] = 'tps'
data[:source] = ENV['SOURCE']

View file

@ -1,3 +1,3 @@
AfterParty.setup do |config|
AfterParty.setup do |_config|
require "after_party/active_record.rb"
end

View file

@ -5,7 +5,7 @@
if ENV['RAILS_ENV'] != 'test' && File.basename($0) != 'rake'
reference_env_file = File.join('config', 'env.example')
Dotenv::Environment.new(Rails.root.join(reference_env_file)).each do |key, value|
Dotenv::Environment.new(Rails.root.join(reference_env_file)).each do |key, _value|
if !ENV.key?(key.to_s)
raise "Configuration error: `#{key}` is not present in the process environment variables (declared in `#{reference_env_file}`)"
end

View file

@ -30,7 +30,7 @@ Rails.application.configure do
end
config.lograge.keep_original_rails_log = true
config.lograge.logger = ActiveSupport::Logger.new Rails.root.join('log', "logstash_#{Rails.env}.log")
config.lograge.logger = ActiveSupport::Logger.new(Rails.root.join('log', "logstash_#{Rails.env}.log"))
if config.lograge.enabled
ActiveJobLogSubscriber.attach_to(:active_job)

View file

@ -10,7 +10,7 @@ SmartListing.configure do |config|
# :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
:page_sizes => [10, 20, 50, 100] # set available page sizes array
# :kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options
})

View file

@ -2,7 +2,7 @@ class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
def change
all_mails = MailReceived.all
groupped = all_mails.group_by(&:procedure_id)
filtered = groupped.reject { |k, v| v.length < 2 }
filtered = groupped.reject { |_k, v| v.length < 2 }
filtered.each_value do |duplicate_mails|
duplicate_mails.pop
duplicate_mails.each(&:destroy)

View file

@ -10,7 +10,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
t.string :checksum, null: false
t.datetime :created_at, null: false
t.index [ :key ], unique: true
t.index [:key], unique: true
end
create_table :active_storage_attachments do |t|
@ -20,7 +20,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
t.datetime :created_at, null: false
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
end
end
end

View file

@ -0,0 +1,5 @@
class DropRNAInformations < ActiveRecord::Migration[5.2]
def change
drop_table :rna_informations
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_12_18_204707) do
ActiveRecord::Schema.define(version: 2018_12_21_103901) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -497,19 +497,6 @@ ActiveRecord::Schema.define(version: 2018_12_18_204707) do
t.index ["procedure_id"], name: "index_refused_mails_on_procedure_id"
end
create_table "rna_informations", id: :serial, force: :cascade do |t|
t.string "association_id"
t.string "titre"
t.text "objet"
t.date "date_creation"
t.date "date_declaration"
t.date "date_publication"
t.integer "entreprise_id"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["entreprise_id"], name: "index_rna_informations_on_entreprise_id"
end
create_table "services", force: :cascade do |t|
t.string "type_organisme", null: false
t.string "nom", null: false

View file

@ -1,59 +0,0 @@
-- this version allows to search for a single term within many tables,
-- but behaves badly with multiple terms scattered in multiple tables.
SELECT dossiers.id AS dossier_id,
dossiers.id::text || ' ' ||
COALESCE(users.email, '') AS term
FROM dossiers
INNER JOIN users ON users.id = dossiers.user_id
UNION SELECT cerfas.dossier_id,
COALESCE(cerfas.content, '') AS term
FROM cerfas
UNION SELECT champs.dossier_id,
COALESCE(champs.value, '') || ' ' ||
COALESCE(drop_down_lists.value, '') AS term
FROM champs
INNER JOIN drop_down_lists ON drop_down_lists.type_de_champ_id = champs.type_de_champ_id
UNION SELECT entreprises.dossier_id,
COALESCE(entreprises.siren, '') || ' ' ||
COALESCE(entreprises.numero_tva_intracommunautaire, '') || ' ' ||
COALESCE(entreprises.forme_juridique, '') || ' ' ||
COALESCE(entreprises.forme_juridique_code, '') || ' ' ||
COALESCE(entreprises.nom_commercial, '') || ' ' ||
COALESCE(entreprises.raison_sociale, '') || ' ' ||
COALESCE(entreprises.siret_siege_social, '') || ' ' ||
COALESCE(entreprises.nom, '') || ' ' ||
COALESCE(entreprises.prenom, '') || ' ' ||
COALESCE(rna_informations.association_id, '') || ' ' ||
COALESCE(rna_informations.titre, '') || ' ' ||
COALESCE(rna_informations.objet, '') AS term
FROM entreprises
LEFT JOIN rna_informations ON rna_informations.entreprise_id = entreprises.id
UNION SELECT etablissements.dossier_id,
COALESCE(etablissements.siret, '') || ' ' ||
COALESCE(etablissements.naf, '') || ' ' ||
COALESCE(etablissements.libelle_naf, '') || ' ' ||
COALESCE(etablissements.adresse, '') || ' ' ||
COALESCE(etablissements.code_postal, '') || ' ' ||
COALESCE(etablissements.localite, '') || ' ' ||
COALESCE(etablissements.code_insee_localite, '') AS term
FROM etablissements
UNION SELECT individuals.dossier_id,
COALESCE(individuals.nom, '') || ' ' ||
COALESCE(individuals.prenom, '') AS term
FROM individuals
UNION SELECT pieces_justificatives.dossier_id,
COALESCE(pieces_justificatives.content, '') AS term
FROM pieces_justificatives
UNION SELECT dossiers.id,
COALESCE(france_connect_informations.given_name, '') || ' ' ||
COALESCE(france_connect_informations.family_name, '') AS term
FROM france_connect_informations
INNER JOIN dossiers ON dossiers.user_id = france_connect_informations.user_id

View file

@ -1,43 +0,0 @@
-- this version merges all possible search terms together, complicating the
-- view, but enables searching for multiple terms from multiple tables at once.
SELECT dossiers.id AS dossier_id,
COALESCE(users.email, '') || ' ' ||
COALESCE(france_connect_informations.given_name, '') || ' ' ||
COALESCE(france_connect_informations.family_name, '') || ' ' ||
COALESCE(cerfas.content, '') || ' ' ||
COALESCE(champs.value, '') || ' ' ||
COALESCE(drop_down_lists.value, '') || ' ' ||
COALESCE(entreprises.siren, '') || ' ' ||
COALESCE(entreprises.numero_tva_intracommunautaire, '') || ' ' ||
COALESCE(entreprises.forme_juridique, '') || ' ' ||
COALESCE(entreprises.forme_juridique_code, '') || ' ' ||
COALESCE(entreprises.nom_commercial, '') || ' ' ||
COALESCE(entreprises.raison_sociale, '') || ' ' ||
COALESCE(entreprises.siret_siege_social, '') || ' ' ||
COALESCE(entreprises.nom, '') || ' ' ||
COALESCE(entreprises.prenom, '') || ' ' ||
COALESCE(rna_informations.association_id, '') || ' ' ||
COALESCE(rna_informations.titre, '') || ' ' ||
COALESCE(rna_informations.objet, '') || ' ' ||
COALESCE(etablissements.siret, '') || ' ' ||
COALESCE(etablissements.naf, '') || ' ' ||
COALESCE(etablissements.libelle_naf, '') || ' ' ||
COALESCE(etablissements.adresse, '') || ' ' ||
COALESCE(etablissements.code_postal, '') || ' ' ||
COALESCE(etablissements.localite, '') || ' ' ||
COALESCE(etablissements.code_insee_localite, '') || ' ' ||
COALESCE(individuals.nom, '') || ' ' ||
COALESCE(individuals.prenom, '') || ' ' ||
COALESCE(pieces_justificatives.content, '') AS term
FROM dossiers
INNER JOIN users ON users.id = dossiers.user_id
LEFT JOIN france_connect_informations ON france_connect_informations.user_id = dossiers.user_id
LEFT JOIN cerfas ON cerfas.dossier_id = dossiers.id
LEFT JOIN champs ON champs.dossier_id = dossiers.id
LEFT JOIN drop_down_lists ON drop_down_lists.type_de_champ_id = champs.type_de_champ_id
LEFT JOIN entreprises ON entreprises.dossier_id = dossiers.id
LEFT JOIN rna_informations ON rna_informations.entreprise_id = entreprises.id
LEFT JOIN etablissements ON etablissements.dossier_id = dossiers.id
LEFT JOIN individuals ON individuals.dossier_id = dossiers.id
LEFT JOIN pieces_justificatives ON pieces_justificatives.dossier_id = dossiers.id

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