diff --git a/Gemfile b/Gemfile
index 95f44b15d..84905ae0c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -62,6 +62,7 @@ gem 'fog'
gem 'fog-openstack'
gem 'pg'
+gem 'scenic'
gem 'rgeo-geojson'
gem 'leaflet-rails'
diff --git a/Gemfile.lock b/Gemfile.lock
index 346b3746d..3789d86e8 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,15 +1,15 @@
GIT
remote: https://github.com/mina-deploy/mina.git
- revision: a66b55a72833b19ac0ffb240afb37c86c0227582
+ revision: 5f407b28be1cf05cdfaab0558285aa031c445491
specs:
- mina (0.3.7)
+ mina (1.0.3)
open4 (~> 1.3.4)
rake
GEM
remote: https://rubygems.org/
specs:
- CFPropertyList (2.3.2)
+ CFPropertyList (2.3.3)
actionmailer (4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
@@ -29,8 +29,11 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
- active_model_serializers (0.8.3)
- activemodel (>= 3.0)
+ active_model_serializers (0.10.2)
+ actionpack (>= 4.1, < 6)
+ activemodel (>= 4.1, < 6)
+ jsonapi (~> 0.1.1.beta2)
+ railties (>= 4.1, < 6)
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
globalid (>= 0.3.0)
@@ -47,7 +50,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- addressable (2.3.8)
+ addressable (2.5.0)
+ public_suffix (~> 2.0, >= 2.0.2)
apipie-rails (0.3.1)
json
arel (6.0.3)
@@ -55,74 +59,61 @@ GEM
actionpack (>= 3.0)
activemodel (>= 3.0)
responders
- ast (2.0.0)
- astrolabe (1.3.0)
- parser (>= 2.2.0.pre.3, < 3.0)
- attr_required (1.0.0)
- autoprefixer-rails (5.2.1)
+ ast (2.3.0)
+ attr_required (1.0.1)
+ autoprefixer-rails (6.5.3)
execjs
- json
axlsx (2.0.1)
htmlentities (~> 4.3.1)
nokogiri (>= 1.4.1)
rubyzip (~> 1.0.0)
bcrypt (3.1.11)
- bindata (2.1.0)
+ bindata (2.3.4)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
- bootstrap-datepicker-rails (1.4.0)
+ bootstrap-datepicker-rails (1.6.4.1)
railties (>= 3.0)
- bootstrap-sass (3.3.5)
- autoprefixer-rails (>= 5.0.0.1)
- sass (>= 3.2.19)
+ bootstrap-sass (3.3.7)
+ autoprefixer-rails (>= 5.2.1)
+ sass (>= 3.3.4)
bootstrap-wysihtml5-rails (0.3.3.8)
railties (>= 3.0)
- brakeman (3.1.1)
- erubis (~> 2.6)
- fastercsv (~> 1.5)
- haml (>= 3.0, < 5.0)
- highline (~> 1.6)
- multi_json (~> 1.2)
- ruby2ruby (>= 2.1.1, < 2.3.0)
- ruby_parser (~> 3.7.0)
- sass (~> 3.0)
- slim (>= 1.3.6, < 4.0)
- terminal-table (~> 1.4)
- browser (2.2.0)
+ brakeman (3.4.1)
+ browser (2.3.0)
builder (3.2.2)
- byebug (5.0.0)
- columnize (= 0.9.0)
- capybara (2.4.4)
+ byebug (9.0.6)
+ capybara (2.10.1)
+ addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
- carrierwave (0.10.0)
+ carrierwave (0.11.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
- chartkick (1.3.2)
- childprocess (0.5.5)
+ mimemagic (>= 0.3.0)
+ chartkick (2.1.1)
+ childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
- clamav-client (3.0.0)
+ clamav-client (3.1.0)
cliver (0.3.2)
- coderay (1.1.0)
- coffee-rails (4.1.0)
+ coderay (1.1.1)
+ coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
- railties (>= 4.0.0, < 5.0)
+ railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
- coffee-script-source (1.9.1.1)
- columnize (0.9.0)
+ coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
- crack (0.4.2)
+ crack (0.4.3)
safe_yaml (~> 1.0.0)
- database_cleaner (1.4.1)
+ database_cleaner (1.5.3)
debug_inspector (0.0.2)
- deep_cloneable (2.2.1)
+ deep_cloneable (2.2.2)
activerecord (>= 3.1.0, < 5.2.0)
devise (3.5.10)
bcrypt (~> 3.0)
@@ -133,7 +124,7 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
- domain_name (0.5.24)
+ domain_name (0.5.20161021)
unf (>= 0.0.5, < 1.0.0)
draper (2.1.0)
actionpack (>= 3.0)
@@ -141,14 +132,13 @@ GEM
activesupport (>= 3.0)
request_store (~> 1.0)
erubis (2.7.0)
- excon (0.49.0)
+ excon (0.54.0)
execjs (2.7.0)
- factory_girl (4.5.0)
+ factory_girl (4.7.0)
activesupport (>= 3.0.0)
- faraday (0.9.1)
+ faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- fastercsv (1.5.5)
- ffi (1.9.6)
+ ffi (1.9.14)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.38.0)
@@ -188,12 +178,12 @@ GEM
fog-atmos (0.1.0)
fog-core
fog-xml
- fog-aws (0.9.2)
- fog-core (~> 1.27)
+ fog-aws (0.12.0)
+ fog-core (~> 1.38)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
- fog-brightbox (0.10.1)
+ fog-brightbox (0.11.0)
fog-core (~> 1.22)
fog-json
inflecto (~> 0.0.2)
@@ -202,7 +192,7 @@ GEM
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
- fog-core (1.38.0)
+ fog-core (1.43.0)
builder
excon (~> 0.49)
formatador (~> 0.2)
@@ -220,22 +210,20 @@ GEM
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
- fog-local (0.3.0)
+ fog-local (0.3.1)
fog-core (~> 1.27)
- fog-openstack (0.1.5)
- fog-core (>= 1.38)
+ fog-openstack (0.1.17)
+ fog-core (>= 1.40)
fog-json (>= 1.0)
- fog-xml (>= 0.1)
ipaddress (>= 0.8)
fog-powerdns (0.1.1)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-xml (~> 0.1)
- fog-profitbricks (0.0.5)
- fog-core
- fog-xml
- nokogiri
- fog-rackspace (0.1.1)
+ fog-profitbricks (3.0.0)
+ fog-core (~> 1.42)
+ fog-json (~> 1.0)
+ fog-rackspace (0.1.2)
fog-core (>= 1.35)
fog-json (>= 1.0)
fog-xml (>= 0.1)
@@ -254,7 +242,7 @@ GEM
fog-serverlove (0.1.2)
fog-core
fog-json
- fog-softlayer (1.1.1)
+ fog-softlayer (1.1.4)
fog-core
fog-json
fog-storm_on_demand (0.1.1)
@@ -269,21 +257,21 @@ GEM
fog-voxel (0.1.0)
fog-core
fog-xml
- fog-vsphere (0.6.4)
+ fog-vsphere (1.5.1)
fog-core
- rbvmomi (~> 1.8)
+ rbvmomi (~> 1.9)
fog-xenserver (0.2.3)
fog-core
fog-xml
fog-xml (0.1.2)
fog-core
nokogiri (~> 1.5, >= 1.5.11)
- font-awesome-rails (4.4.0.0)
- railties (>= 3.2, < 5.0)
+ font-awesome-rails (4.7.0.0)
+ railties (>= 3.2, < 5.1)
formatador (0.2.5)
globalid (0.3.7)
activesupport (>= 4.1.0)
- haml (4.0.6)
+ haml (4.0.7)
tilt
haml-rails (0.9.0)
actionpack (>= 4.0.1)
@@ -291,103 +279,113 @@ GEM
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
- hashie (3.4.1)
- highline (1.7.8)
+ hashdiff (0.3.0)
+ hashie (3.4.6)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
htmlentities (4.3.4)
- http-cookie (1.0.2)
+ http-cookie (1.0.3)
domain_name (~> 0.5)
- httpclient (2.6.0.1)
+ httpclient (2.8.2.4)
i18n (0.7.0)
inflecto (0.0.2)
ipaddress (0.8.3)
- jbuilder (2.3.1)
- activesupport (>= 3.0.0, < 5)
+ jbuilder (2.6.0)
+ activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
- jquery-rails (4.0.4)
- rails-dom-testing (~> 1.0)
+ jquery-rails (4.2.1)
+ rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
- json-jwt (1.5.1)
+ json-jwt (1.6.5)
activesupport
bindata
multi_json (>= 1.3)
securecompare
url_safe_base64
- kaminari (0.16.3)
+ jsonapi (0.1.1.beta6)
+ jsonapi-parser (= 0.1.1.beta3)
+ jsonapi-renderer (= 0.1.1.beta1)
+ jsonapi-parser (0.1.1.beta3)
+ jsonapi-renderer (0.1.1.beta1)
+ kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
- kgio (2.9.3)
+ kgio (2.10.0)
leaflet-draw-rails (0.1.0)
leaflet-markercluster-rails (0.7.0)
railties (>= 3.1)
- leaflet-rails (0.7.4)
- libv8 (3.16.14.7)
+ leaflet-rails (0.7.7)
+ libv8 (3.16.14.15)
logstash-event (1.2.02)
- logstasher (0.6.5)
+ logstasher (1.0.1)
+ activerecord (>= 4.0)
+ activesupport (>= 4.0)
logstash-event (~> 1.2.0)
request_store
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
- mailjet (1.1.0)
+ mailjet (1.4.10)
activesupport (>= 3.1.0)
rack (>= 1.4.0)
rest-client
maruku (0.7.2)
method_source (0.8.2)
- mime-types (2.99.2)
+ mime-types (3.1)
+ mime-types-data (~> 3.2015)
+ mime-types-data (3.2016.0521)
+ mimemagic (0.3.2)
mini_portile2 (2.1.0)
minitest (5.9.1)
- multi_json (1.11.2)
+ multi_json (1.12.1)
multipart-post (2.0.0)
- netrc (0.10.3)
+ netrc (0.11.0)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
nyan-cat-formatter (0.11)
rspec (>= 2.99, >= 2.14.2, < 4)
open4 (1.3.4)
- openid_connect (0.9.2)
+ openid_connect (0.12.0)
activemodel
attr_required (>= 1.0.0)
json (>= 1.4.3)
json-jwt (>= 1.5.0)
- rack-oauth2 (>= 1.2.1)
+ rack-oauth2 (>= 1.3.1)
swd (>= 1.0.0)
tzinfo
validate_email
validate_url
webfinger (>= 1.0.1)
- openstack (2.0.2)
+ openstack (3.3.3)
json
orm_adapter (0.5.0)
parallel (1.9.0)
parallel_tests (1.9.0)
parallel
- parser (2.2.2.2)
- ast (>= 1.1, < 3.0)
- pg (0.18.2)
- poltergeist (1.6.0)
+ parser (2.3.1.4)
+ ast (~> 2.2)
+ pg (0.19.0)
+ poltergeist (1.11.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
- multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
- powerpack (0.1.0)
- pry (0.10.1)
+ powerpack (0.1.1)
+ pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- pry-byebug (3.2.0)
- byebug (~> 5.0)
+ pry-byebug (3.4.0)
+ byebug (~> 9.0)
pry (~> 0.10)
- rack (1.6.4)
- rack-oauth2 (1.2.1)
+ public_suffix (2.0.4)
+ rack (1.6.5)
+ rack-oauth2 (1.4.0)
activesupport (>= 2.3)
attr_required (>= 0.0.5)
httpclient (>= 2.4)
@@ -395,7 +393,7 @@ GEM
rack (>= 1.1)
rack-test (0.6.3)
rack (>= 1.0)
- railroady (1.3.0)
+ railroady (1.5.2)
rails (4.2.7.1)
actionmailer (= 4.2.7.1)
actionpack (= 4.2.7.1)
@@ -420,65 +418,63 @@ GEM
activesupport (= 4.2.7.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rainbow (2.0.0)
- raindrops (0.13.0)
- rake (11.2.2)
- rbvmomi (1.8.2)
- builder
- nokogiri (>= 1.4.1)
- trollop
- rdoc (4.2.0)
- json (~> 1.4)
+ rainbow (2.1.0)
+ raindrops (0.17.0)
+ rake (11.3.0)
+ rbvmomi (1.9.4)
+ builder (~> 3.2)
+ json (>= 1.8)
+ nokogiri (~> 1.5)
+ trollop (~> 2.1)
+ rdoc (4.3.0)
ref (2.0.0)
- request_store (1.1.0)
+ request_store (1.3.1)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
- rest-client (1.8.0)
+ rest-client (2.0.0)
http-cookie (>= 1.0.2, < 2.0)
- mime-types (>= 1.16, < 3.0)
- netrc (~> 0.7)
- rgeo (0.3.20)
- rgeo-geojson (0.3.1)
- rgeo (~> 0.3)
+ mime-types (>= 1.16, < 4.0)
+ netrc (~> 0.8)
+ rgeo (0.5.3)
+ rgeo-geojson (0.4.3)
+ rgeo (~> 0.5)
rodf (0.3.7)
activesupport (>= 3.0, < 6.0)
builder (~> 3.0)
rubyzip (~> 1.0)
- rspec (3.2.0)
- rspec-core (~> 3.2.0)
- rspec-expectations (~> 3.2.0)
- rspec-mocks (~> 3.2.0)
- rspec-core (3.2.3)
- rspec-support (~> 3.2.0)
- rspec-expectations (3.2.1)
+ rspec (3.5.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-core (3.5.4)
+ rspec-support (~> 3.5.0)
+ rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.2.0)
- rspec-mocks (3.2.1)
+ rspec-support (~> 3.5.0)
+ rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.2.0)
- rspec-rails (3.2.1)
- actionpack (>= 3.0, < 4.3)
- activesupport (>= 3.0, < 4.3)
- railties (>= 3.0, < 4.3)
- rspec-core (~> 3.2.0)
- rspec-expectations (~> 3.2.0)
- rspec-mocks (~> 3.2.0)
- rspec-support (~> 3.2.0)
- rspec-support (3.2.2)
- rubocop (0.30.1)
- astrolabe (~> 1.3)
- parser (>= 2.2.2.1, < 3.0)
+ rspec-support (~> 3.5.0)
+ rspec-rails (3.5.2)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-support (~> 3.5.0)
+ rspec-support (3.5.0)
+ rubocop (0.45.0)
+ parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
- ruby-progressbar (~> 1.4)
- rubocop-checkstyle_formatter (0.2.0)
- rubocop (>= 0.20.1)
- rubocop-rspec (1.3.0)
- ruby-progressbar (1.7.5)
- ruby2ruby (2.1.4)
- ruby_parser (~> 3.1)
- sexp_processor (~> 4.0)
- ruby_parser (3.7.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (~> 1.0, >= 1.0.1)
+ rubocop-checkstyle_formatter (0.3.0)
+ rubocop (>= 0.30.1)
+ rubocop-rspec (1.8.0)
+ rubocop (>= 0.42.0)
+ ruby-progressbar (1.8.1)
+ ruby_parser (3.8.3)
sexp_processor (~> 4.1)
rubyzip (1.0.0)
safe_yaml (1.0.4)
@@ -489,75 +485,74 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
- sdoc (0.4.1)
+ scenic (1.3.0)
+ activerecord (>= 4.0.0)
+ railties (>= 4.0.0)
+ sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
securecompare (1.0.0)
- selenium-webdriver (2.44.0)
+ selenium-webdriver (3.0.1)
childprocess (~> 0.5)
- multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
- sentry-raven (0.13.1)
- faraday (>= 0.7.6)
- sexp_processor (4.6.0)
- shoulda-matchers (2.8.0)
- activesupport (>= 3.0.0)
- simplecov (0.9.1)
+ sentry-raven (2.1.2)
+ faraday (>= 0.7.6, < 0.10.x)
+ sexp_processor (4.7.0)
+ shoulda-matchers (3.1.1)
+ activesupport (>= 4.0.0)
+ simplecov (0.12.0)
docile (~> 1.1.0)
- multi_json (~> 1.0)
- simplecov-html (~> 0.8.0)
- simplecov-html (0.8.0)
- slim (3.0.6)
- temple (~> 0.7.3)
- tilt (>= 1.3.3, < 2.1)
+ json (>= 1.8, < 3)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.0)
slop (3.6.0)
- smart_listing (1.1.2)
+ smart_listing (1.2.0)
coffee-rails
jquery-rails
- kaminari (~> 0.16.1)
+ kaminari (~> 0.17)
rails (>= 3.2)
spreadsheet_architect (1.4.7)
axlsx (>= 2.0)
rodf (>= 0.3.6)
- spring (1.3.6)
+ spring (2.0.0)
+ activesupport (>= 4.2)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
- sprockets-rails (3.1.1)
+ sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
- swd (1.0.0)
+ swd (1.0.1)
activesupport (>= 3)
attr_required (>= 0.0.5)
httpclient (>= 2.4)
i18n
json (>= 1.4.3)
- temple (0.7.6)
- terminal-table (1.5.2)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
- timecop (0.7.3)
+ timecop (0.8.1)
trollop (2.1.2)
- turbolinks (2.5.3)
- coffee-rails
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
- uglifier (3.0.2)
+ uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
- unf_ext (0.0.7.1)
- unicorn (4.9.0)
+ unf_ext (0.0.7.2)
+ unicode-display_width (1.1.1)
+ unicorn (5.2.0)
kgio (~> 2.6)
- rack
raindrops (~> 0.7)
url_safe_base64 (0.2.2)
validate_email (0.1.6)
@@ -566,26 +561,27 @@ GEM
validate_url (1.0.2)
activemodel (>= 3.0.0)
addressable
- vcr (3.0.1)
+ vcr (3.0.3)
warden (1.2.6)
rack (>= 1.0)
- web-console (2.2.1)
+ web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
- webfinger (1.0.1)
+ webfinger (1.0.2)
activesupport
httpclient (>= 2.4)
multi_json
- webmock (1.21.0)
+ webmock (2.1.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
- websocket (1.2.1)
- websocket-driver (0.5.3)
+ hashdiff
+ websocket (1.2.3)
+ websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
- will_paginate (3.0.7)
+ will_paginate (3.1.5)
will_paginate-bootstrap (1.0.1)
will_paginate (>= 3.0.3)
xml-simple (1.1.5)
@@ -645,6 +641,7 @@ DEPENDENCIES
rubocop-checkstyle_formatter
rubocop-rspec
sass-rails (~> 5.0)
+ scenic
sdoc (~> 0.4.0)
selenium-webdriver
sentry-raven
diff --git a/app/assets/javascripts/dossiers_list_link.js b/app/assets/javascripts/dossiers_list_link.js
new file mode 100644
index 000000000..1764dd571
--- /dev/null
+++ b/app/assets/javascripts/dossiers_list_link.js
@@ -0,0 +1,9 @@
+$(document).on('page:load', link_init);
+$(document).ready(link_init);
+
+
+function link_init() {
+ $('#dossiers_list tr').on('click', function () {
+ $(location).attr('href', $(this).data('dossier_url'))
+ });
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/dossiers.scss b/app/assets/stylesheets/dossiers.scss
index 98ed7d31f..76ce739db 100644
--- a/app/assets/stylesheets/dossiers.scss
+++ b/app/assets/stylesheets/dossiers.scss
@@ -27,4 +27,9 @@ h5 span {
#validate_button {
float: right;
}
+}
+
+#dossiers_list tr:hover{
+ background-color: #eeeeee;
+ cursor: pointer;
}
\ No newline at end of file
diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb
index 0e51c2097..4d8e44af3 100644
--- a/app/controllers/admin/procedures_controller.rb
+++ b/app/controllers/admin/procedures_controller.rb
@@ -179,7 +179,12 @@ class Admin::ProceduresController < AdminController
end
def path_list
- render json: ProcedurePath.where("path LIKE '%#{params[:request]}%'").pluck(:path, :administrateur_id).inject([]) {
+ render json: ProcedurePath
+ .joins(', procedures')
+ .where("procedures.id = procedure_paths.procedure_id AND procedures.archived != true")
+ .where("path LIKE '%#{params[:request]}%'")
+ .pluck(:path, :administrateur_id)
+ .inject([]) {
|acc, value| acc.push({label: value.first, mine: value.second == current_administrateur.id})
}.to_json
end
diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb
index 9d14262fd..3b2a84dba 100644
--- a/app/controllers/backoffice/dossiers_controller.rb
+++ b/app/controllers/backoffice/dossiers_controller.rb
@@ -34,7 +34,12 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
def search
@search_terms = params[:q]
- @dossier = Dossier.search(current_gestionnaire, @search_terms)
+
+ @dossier = Search.new(
+ gestionnaire: current_gestionnaire,
+ query: @search_terms,
+ page: params[:page]
+ ).results
smartlisting_dossier @dossier, 'search'
diff --git a/app/controllers/users/description_controller.rb b/app/controllers/users/description_controller.rb
index a8a08fc09..b74671a45 100644
--- a/app/controllers/users/description_controller.rb
+++ b/app/controllers/users/description_controller.rb
@@ -38,6 +38,15 @@ class Users::DescriptionController < UsersController
return render 'show'
end
+ unless params[:champs].nil?
+ champs_service_errors = ChampsService.save_formulaire @dossier.champs, params, mandatory
+
+ unless champs_service_errors.empty?
+ flash.now.alert = (champs_service_errors.inject('') { |acc, error| acc+= error[:message]+'
' }).html_safe
+ return render 'show'
+ end
+ end
+
if @procedure.cerfa_flag?
unless params[:cerfa_pdf].nil?
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
@@ -48,15 +57,6 @@ class Users::DescriptionController < UsersController
end
end
- unless params[:champs].nil?
- champs_service_errors = ChampsService.save_formulaire @dossier.champs, params, mandatory
-
- unless champs_service_errors.empty?
- flash.now.alert = (champs_service_errors.inject('') { |acc, error| acc+= error[:message]+'
' }).html_safe
- return render 'show'
- end
- end
-
unless (errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?
flash.alert = errors_upload.html_safe
return render 'show'
@@ -82,10 +82,24 @@ class Users::DescriptionController < UsersController
@dossier ||= Dossier.find(params[:dossier_id]) if invite
@dossier ||= current_user_dossier
+ if @dossier.procedure.cerfa_flag?
+ unless params[:cerfa_pdf].nil?
+ cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
+ unless cerfa.save
+ flash.alert = cerfa.errors.full_messages.join('
').html_safe
+ end
+ end
+ end
+
if !((errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?)
- flash.alert = errors_upload.html_safe
+ if flash.alert.nil?
+ flash.alert = errors_upload.html_safe
+ else
+ flash.alert = (flash.alert + '
' + errors_upload.html_safe).html_safe
+ end
+
else
- flash.notice = 'Nouveaux fichiers envoyés'
+ flash.notice = 'Nouveaux fichiers envoyés' if flash.alert.nil?
@dossier.next_step! 'user', 'update'
end
diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb
index 8e175d8b2..f5ef2472f 100644
--- a/app/controllers/users/dossiers_controller.rb
+++ b/app/controllers/users/dossiers_controller.rb
@@ -30,6 +30,13 @@ class Users::DossiersController < UsersController
procedure = ProcedurePath.where(path: params[:procedure_path]).first!.procedure
end
+ if procedure.archived?
+
+ @dossier = Dossier.new(procedure: procedure)
+
+ return render 'commencer/archived'
+ end
+
redirect_to new_users_dossier_path(procedure_id: procedure.id)
rescue ActiveRecord::RecordNotFound
error_procedure
diff --git a/app/facades/dossiers_list_facades.rb b/app/facades/dossiers_list_facades.rb
index 50d2848d7..4f96caa4d 100644
--- a/app/facades/dossiers_list_facades.rb
+++ b/app/facades/dossiers_list_facades.rb
@@ -58,6 +58,10 @@ class DossiersListFacades
(@liste == 'a_traiter' ? 'active' : '')
end
+ def fige_class
+ (@liste == 'fige' ? 'active' : '')
+ end
+
def en_attente_class
(@liste == 'en_attente' ? 'active' : '')
end
@@ -103,13 +107,17 @@ class DossiersListFacades
end
def a_traiter_total
- service.waiting_for_gestionnaire.count
+ service.ouvert.count
end
def en_construction_total
service.en_construction.count
end
+ def fige_total
+ service.fige.count
+ end
+
def en_attente_total
service.waiting_for_user.count
end
@@ -158,6 +166,10 @@ class DossiersListFacades
base_url 'a_traiter'
end
+ def fige_url
+ base_url 'fige'
+ end
+
def en_attente_url
base_url 'en_attente'
end
diff --git a/app/models/dossier.rb b/app/models/dossier.rb
index 700c7da20..8bd92395a 100644
--- a/app/models/dossier.rb
+++ b/app/models/dossier.rb
@@ -46,6 +46,7 @@ class Dossier < ActiveRecord::Base
BROUILLON = %w(draft)
NOUVEAUX = %w(initiated)
+ OUVERT = %w(updated replied)
WAITING_FOR_GESTIONNAIRE = %w(updated)
WAITING_FOR_USER = %w(replied validated)
EN_CONSTRUCTION = %w(initiated updated replied)
@@ -195,6 +196,10 @@ class Dossier < ActiveRecord::Base
EN_CONSTRUCTION.include?(state)
end
+ def ouvert?
+ OUVERT.include?(state)
+ end
+
def deposes?
DEPOSES.include?(state)
end
@@ -203,6 +208,10 @@ class Dossier < ActiveRecord::Base
VALIDES.include?(state)
end
+ def fige?
+ VALIDES.include?(state)
+ end
+
def a_instruire?
A_INSTRUIRE.include?(state)
end
@@ -239,10 +248,18 @@ class Dossier < ActiveRecord::Base
where(state: EN_CONSTRUCTION, archived: false).order("updated_at #{order}")
end
+ def self.ouvert order = 'ASC'
+ where(state: OUVERT, archived: false).order("updated_at #{order}")
+ end
+
def self.valides order = 'ASC'
where(state: VALIDES, archived: false).order("updated_at #{order}")
end
+ def self.fige order = 'ASC'
+ where(state: VALIDES, archived: false).order("updated_at #{order}")
+ end
+
def self.deposes order = 'ASC'
where(state: DEPOSES, archived: false).order("updated_at #{order}")
end
@@ -259,37 +276,6 @@ class Dossier < ActiveRecord::Base
where(state: TERMINE, archived: false).order("updated_at #{order}")
end
- def self.search current_gestionnaire, terms
- return [] if terms.blank?
-
- dossiers = Dossier.arel_table
- users = User.arel_table
- etablissements = Etablissement.arel_table
- entreprises = Entreprise.arel_table
-
- composed_scope = self.joins('LEFT OUTER JOIN users ON users.id = dossiers.user_id')
- .joins('LEFT OUTER JOIN entreprises ON entreprises.dossier_id = dossiers.id')
- .joins('LEFT OUTER JOIN etablissements ON etablissements.dossier_id = dossiers.id')
-
- terms.split.each do |word|
- query_string = "%#{word}%"
- query_string_start_with = "#{word}%"
-
- composed_scope = composed_scope.where(
- users[:email].matches(query_string).or\
- etablissements[:siret].matches(query_string_start_with).or\
- entreprises[:raison_sociale].matches(query_string).or\
- dossiers[:id].eq(word_is_an_integer word))
- end
-
- composed_scope = composed_scope.where(
- dossiers[:id].eq_any(current_gestionnaire.dossiers.ids).and\
- dossiers[:state].does_not_match('draft').and\
- dossiers[:archived].eq(false))
-
- composed_scope
- end
-
def cerfa_available?
procedure.cerfa_flag? && cerfa.size != 0
end
@@ -354,7 +340,7 @@ class Dossier < ActiveRecord::Base
data = []
headers = dossiers.first.export_headers
dossiers.each do |dossier|
- data << dossier.convert_specific_array_values_to_string(data_with_champs)
+ data << dossier.convert_specific_array_values_to_string(dossier.data_with_champs)
end
if ["csv"].include?(format)
return SpreadsheetArchitect.to_csv(data: data, headers: headers)
diff --git a/app/models/procedure.rb b/app/models/procedure.rb
index f8d737532..9a81ed2b6 100644
--- a/app/models/procedure.rb
+++ b/app/models/procedure.rb
@@ -103,7 +103,6 @@ class Procedure < ActiveRecord::Base
end
def archive
- self.procedure_path.destroy! if self.path
self.update_attributes!({archived: true})
end
diff --git a/app/models/search.rb b/app/models/search.rb
new file mode 100644
index 000000000..6b4557677
--- /dev/null
+++ b/app/models/search.rb
@@ -0,0 +1,82 @@
+# See:
+# - https://robots.thoughtbot.com/implementing-multi-table-full-text-search-with-postgres
+# - http://calebthompson.io/talks/search.html
+class Search < ActiveRecord::Base
+ # :nodoc:
+ #
+ # Englobs a search result (actually a collection of Search objects) so it acts
+ # like a collection of regular Dossier objects, which can be decorated,
+ # paginated, ...
+ class Results
+ include Enumerable
+
+ def initialize(results)
+ @results = results
+ end
+
+ def each
+ @results.each do |search|
+ yield search.dossier
+ end
+ end
+
+ def method_missing(name, *args, &block)
+ @results.__send__(name, *args, &block)
+ end
+
+ def decorate!
+ @results.each do |search|
+ search.dossier = search.dossier.decorate
+ end
+ end
+ end
+
+ attr_accessor :gestionnaire
+ attr_accessor :query
+ attr_accessor :page
+
+ belongs_to :dossier
+
+ def results
+ unless @query.present?
+ return Search.none
+ end
+
+ search_term = Search.connection.quote(to_tsquery)
+
+ dossier_ids = @gestionnaire.dossiers
+ .select(:id)
+ .where(archived: false)
+ .where.not(state: "draft")
+
+ q = Search
+ .select("DISTINCT(searches.dossier_id)")
+ .select("COALESCE(ts_rank(to_tsvector('french', searches.term::text), to_tsquery('french', #{search_term})), 0) AS rank")
+ .joins(:dossier)
+ .where(dossier_id: dossier_ids)
+ .where("to_tsvector('french', searches.term::text) @@ to_tsquery('french', #{search_term})")
+ .order("rank DESC")
+ .preload(:dossier)
+
+ if @page.present?
+ q = q.paginate(page: @page)
+ end
+
+ Results.new(q)
+ end
+
+ #def self.refresh
+ # # TODO: could be executed concurrently
+ # # See https://github.com/thoughtbot/scenic#what-about-materialized-views
+ # Scenic.database.refresh_materialized_view(table_name, concurrently: false)
+ #end
+
+ private
+
+ def to_tsquery
+ @query.gsub(/['?\\:&|!]/, "") # drop disallowed characters
+ .split(/\s+/) # split words
+ .map { |x| "#{x}:*" } # enable prefix matching
+ .join(" & ")
+ end
+end
diff --git a/app/services/dossiers_list_gestionnaire_service.rb b/app/services/dossiers_list_gestionnaire_service.rb
index 0d84f33d3..cfd6bf63e 100644
--- a/app/services/dossiers_list_gestionnaire_service.rb
+++ b/app/services/dossiers_list_gestionnaire_service.rb
@@ -7,8 +7,8 @@ class DossiersListGestionnaireService
def dossiers_to_display
{'nouveaux' => nouveaux,
- 'a_traiter' => waiting_for_gestionnaire,
- 'en_attente' => waiting_for_user,
+ 'a_traiter' => ouvert,
+ 'fige' => fige,
'deposes' => deposes,
'a_instruire' => a_instruire,
'termine' => termine,
@@ -16,7 +16,7 @@ class DossiersListGestionnaireService
end
def self.dossiers_liste_libelle
- ['nouveaux', 'a_traiter', 'en_attente', 'deposes', 'a_instruire', 'termine', 'all_state']
+ ['nouveaux', 'a_traiter', 'fige' ,'deposes', 'a_instruire', 'termine', 'all_state']
end
def all_state
@@ -27,12 +27,12 @@ class DossiersListGestionnaireService
@nouveaux ||= filter_dossiers.nouveaux
end
- def waiting_for_gestionnaire
- @waiting_for_gestionnaire ||= filter_dossiers.waiting_for_gestionnaire
+ def ouvert
+ @ouvert ||= filter_dossiers.ouvert
end
- def waiting_for_user
- @waiting_for_user ||= filter_dossiers.waiting_for_user
+ def fige
+ @fige ||= filter_dossiers.fige
end
def deposes
diff --git a/app/views/backoffice/dossiers/_list.html.haml b/app/views/backoffice/dossiers/_list.html.haml
index 3b6793ef5..7b2f7dbd5 100644
--- a/app/views/backoffice/dossiers/_list.html.haml
+++ b/app/views/backoffice/dossiers/_list.html.haml
@@ -1,4 +1,4 @@
-%table.table
+%table#dossiers_list.table
%thead
- @dossiers_list_facade.preference_list_dossiers_filter.each do |preference|
%th{class: "col-md-#{preference.bootstrap_lg} col-lg-#{preference.bootstrap_lg}"}
@@ -15,7 +15,7 @@
- unless smart_listing.empty?
- @dossiers.each do |dossier|
- %tr
+ %tr{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
- @dossiers_list_facade.preference_list_dossiers_filter.each_with_index do |preference, index|
%td
- if preference.table.nil? || preference.table.empty?
@@ -30,10 +30,7 @@
- rescue NoMethodError
- value = ''
- - if index == 0
- = link_to value, backoffice_dossier_path(id: dossier.id)
- - else
- = value
+ = value
%td.center
- if current_gestionnaire.follow?(dossier.id)
@@ -48,4 +45,4 @@
- if smart_listing.empty?
%h4.center
- Aucun dossier
\ No newline at end of file
+ Aucun dossier
diff --git a/app/views/backoffice/dossiers/_onglets.html.haml b/app/views/backoffice/dossiers/_onglets.html.haml
index fa32c51b0..b35281247 100644
--- a/app/views/backoffice/dossiers/_onglets.html.haml
+++ b/app/views/backoffice/dossiers/_onglets.html.haml
@@ -19,18 +19,18 @@
=@dossiers_list_facade.nouveaux_total
%li{ class: (@dossiers_list_facade.a_traiter_class) }
- %a{:href => "#{url_for @dossiers_list_facade.a_traiter_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.'}
+ %a{:href => "#{url_for @dossiers_list_facade.a_traiter_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ne sont pas encore déclarés complets.'}
%h5.text-danger
- = "Action requise"
+ ="Ouverts"
.badge.progress-bar-danger
=@dossiers_list_facade.a_traiter_total
- %li{ class: (@dossiers_list_facade.en_attente_class) }
- %a{:href => "#{url_for @dossiers_list_facade.en_attente_url}", 'data-toggle' => :tooltip, title: 'Les dossiers en attentes d\'une action de la part de l\'usager.'}
+ %li{ class: (@dossiers_list_facade.fige_class) }
+ %a{:href => "#{url_for @dossiers_list_facade.fige_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui sont déclarés complets et donc figés.'}
%h5.text-default
- ="Attente usager "
+ ="Figés"
.badge.progress-bar-default
- =@dossiers_list_facade.en_attente_total
+ =@dossiers_list_facade.fige_total
%li{ class: (@dossiers_list_facade.deposes_class) }
%a{:href => "#{url_for @dossiers_list_facade.deposes_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été validés et déposés par les usager qui attendent une réponse de bonne réception avant examen.'}
diff --git a/app/views/backoffice/dossiers/_state_description.html.haml b/app/views/backoffice/dossiers/_state_description.html.haml
index 13d1cf58f..b3d1946d1 100644
--- a/app/views/backoffice/dossiers/_state_description.html.haml
+++ b/app/views/backoffice/dossiers/_state_description.html.haml
@@ -11,12 +11,18 @@
n'ont jamais été ouvert par votre service.
Il attende une première lecture et intervention de votre part.
-elsif dossiers_list_facade.liste == 'a_traiter'
- Tous les dossiers présents dans cette liste sont ceux qui
+ Tous les dossiers présents dans cette liste sont ceux qui sont
%b
- attendent une action de votre part.
- Cela peut être par exemple une demande client ou une relecture pour validation de complétude.
- -elsif dossiers_list_facade.liste == 'en_attente'
- Tous les dossiers présents dans cette liste sont ceux qui requière une action de la part de l'usager. À priori, vous n'avez donc pas d'intervention particulière à réaliser.
+ en cours de construction avec l'usager.
+ Ils ne sont pas figés et ne sont donc pas complets.
+ -elsif dossiers_list_facade.liste == 'fige'
+ Tous les dossiers présents dans cette liste ont été déclarés
+ %b
+ complets
+ et ne sont
+ %b
+ plus modifiables par l'usager.
+ Ils attendent donc leurs dépots officiels qui doit être effectué par l'usager.
-elsif dossiers_list_facade.liste == 'deposes'
Tous les dossiers présents dans cette liste ont été
%b
diff --git a/app/views/backoffice/dossiers/index.js.erb b/app/views/backoffice/dossiers/index.js.erb
index 0f7d43419..876f677fd 100644
--- a/app/views/backoffice/dossiers/index.js.erb
+++ b/app/views/backoffice/dossiers/index.js.erb
@@ -1,3 +1,4 @@
<%= smart_listing_update :dossiers %>
-filters_init();
\ No newline at end of file
+filters_init();
+link_init();
\ No newline at end of file
diff --git a/app/views/commencer/archived.html.haml b/app/views/commencer/archived.html.haml
new file mode 100644
index 000000000..5ad9c0f18
--- /dev/null
+++ b/app/views/commencer/archived.html.haml
@@ -0,0 +1,15 @@
+%br
+%div{style: 'text-align: center; max-width:500px; margin-left:auto; margin-right:auto; padding: 20px;'}
+ = render partial: 'users/sessions/resume_procedure'
+
+.center{style:'margin-top: -20px'}
+ %h3
+ La campagne de création de nouveau dossier
+ %br
+ pour cette démarche en ligne est maintenant terminée.
+
+ %br
+ %p
+ Si vous avez déjà déposé un ou plusieurs dossiers :
+ %a.btn.btn-lg.btn-info{href: new_user_session_path}
+ Accéder à mon espace en ligne.
\ No newline at end of file
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index d1bda0bb0..baf25cfeb 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -2,7 +2,8 @@
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
- %title TPS - Téléprocédures simplifiées
+ %title
+ =t('dynamics.page_title')
%meta{'http-equiv' => "X-UA-Compatible", :content => "IE=edge"}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
diff --git a/app/views/notification_mailer/dossier_received.html.erb b/app/views/notification_mailer/dossier_received.html.erb
index 4bcdc394f..2b39f1abe 100644
--- a/app/views/notification_mailer/dossier_received.html.erb
+++ b/app/views/notification_mailer/dossier_received.html.erb
@@ -1 +1 @@
-<%= escape_once (MailTemplate.replace_tags @dossier.procedure.mail_received.body, @dossier).html_safe %>
\ No newline at end of file
+<%= MailTemplate.replace_tags(@dossier.procedure.mail_received.body, @dossier).html_safe %>
\ No newline at end of file
diff --git a/app/views/users/dossiers/_list.html.haml b/app/views/users/dossiers/_list.html.haml
index 34139cce4..398b31876 100644
--- a/app/views/users/dossiers/_list.html.haml
+++ b/app/views/users/dossiers/_list.html.haml
@@ -1,5 +1,5 @@
- unless smart_listing.empty?
- %table.table
+ %table#dossiers_list.table
%thead
%th.col-md-1.col-lg-1= smart_listing.sortable 'Numéro', 'id'
%th.col-md-5.col-lg-5= smart_listing.sortable 'Procédure', 'procedure.libelle'
@@ -13,14 +13,17 @@
-dossier = invite.dossier.decorate
- else
- dossier = dossier.decorate
- %tr
+
+ - dossier_url = users_dossiers_invite_path(id: invite.id) unless invite.nil?
+ - if invite.nil?
+ - dossier_url = users_dossier_recapitulatif_path(dossier) unless dossier.brouillon?
+ - dossier_url = users_dossier_description_path(dossier) if dossier.brouillon?
+
+ %tr{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => dossier_url}
%td.center
= dossier.id
%td
- = link_to(dossier.procedure.libelle, users_dossiers_invite_path(id: invite.id)) unless invite.nil?
- - if invite.nil?
- = link_to(dossier.procedure.libelle, users_dossier_recapitulatif_path(dossier)) unless dossier.brouillon?
- = link_to(dossier.procedure.libelle, users_dossier_description_path(dossier)) if dossier.brouillon?
+ = dossier.procedure.libelle
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
%td= dossier.last_update
diff --git a/app/views/users/dossiers/index.js.erb b/app/views/users/dossiers/index.js.erb
index 1517a60d3..5a2505268 100644
--- a/app/views/users/dossiers/index.js.erb
+++ b/app/views/users/dossiers/index.js.erb
@@ -1 +1,2 @@
<%= smart_listing_update :dossiers %>
+link_init();
\ No newline at end of file
diff --git a/app/views/users/sessions/_resume_procedure.html.haml b/app/views/users/sessions/_resume_procedure.html.haml
new file mode 100644
index 000000000..f99ce8bd8
--- /dev/null
+++ b/app/views/users/sessions/_resume_procedure.html.haml
@@ -0,0 +1,18 @@
+- if @dossier
+ = link_to 'X', users_no_procedure_url, class: 'btn btn-xs', style:'float: right'
+
+ - if @dossier.procedure.euro_flag
+ #euro_flag.flag
+ =image_tag('drapeau_europe.png')
+
+ #logo_procedure.flag
+ =image_tag( @dossier.procedure.decorate.logo_img )
+
+ %h2#titre_procedure.text-info
+ = @dossier.procedure.libelle
+ %p
+ = h @dossier.procedure.description.html_safe
+
+- else
+ = image_tag(image_url(LOGO_NAME), {id: 'logo_tps'})
+%br
\ No newline at end of file
diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml
index c82745969..718da7056 100644
--- a/app/views/users/sessions/new.html.haml
+++ b/app/views/users/sessions/new.html.haml
@@ -1,24 +1,6 @@
#form_login
%br
- - if @dossier
- = link_to 'X', users_no_procedure_url, class: 'btn btn-xs', style:'float: right'
-
- - if @dossier.procedure.euro_flag
- #euro_flag.flag
- =image_tag('drapeau_europe.png')
-
- #logo_procedure.flag
- =image_tag( @dossier.procedure.decorate.logo_img )
-
- %h2#titre_procedure.text-info
- = @dossier.procedure.libelle
- %p
- = h @dossier.procedure.description.html_safe
-
-
- - else
- = image_tag(image_url(LOGO_NAME), {id: 'logo_tps'})
- %br
+ = render partial: 'users/sessions/resume_procedure'
%h2#login_user
=t('dynamics.users.connexion_title')
diff --git a/config/deploy.rb b/config/deploy.rb
index cf3617318..cfa3be8aa 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -98,7 +98,8 @@ set :shared_paths, [
'config/france_connect.yml',
'config/initializers/mailjet.rb',
'config/initializers/storage_url.rb',
- 'app/views/root/landing.html.haml'
+ 'app/views/root/landing.html.haml',
+ 'app/views/cgu/index.html.haml'
]
@@ -139,6 +140,9 @@ task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/shared/app"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/app"]
+ queue! %[mkdir -p "#{deploy_to}/shared/views/cgu"]
+ queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/views/cgu"]
+
queue! %[mkdir -p "#{deploy_to}/shared/config/locales/dynamics"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config/locales/dynamics"]
diff --git a/config/locales/dynamics/fr.yml b/config/locales/dynamics/fr.yml
index 816f75588..7b8e4a9ca 100644
--- a/config/locales/dynamics/fr.yml
+++ b/config/locales/dynamics/fr.yml
@@ -1,5 +1,6 @@
fr:
dynamics:
+ page_title: TPS - Téléprocédures simplifiées
contact_email: contact@tps.apientreprise.fr
users:
connexion_title: Connexion
diff --git a/config/locales/dynamics/fr_opensimplif.yml b/config/locales/dynamics/fr_opensimplif.yml
index ed8b4c7e0..09b11be21 100644
--- a/config/locales/dynamics/fr_opensimplif.yml
+++ b/config/locales/dynamics/fr_opensimplif.yml
@@ -1,5 +1,6 @@
fr_opensimplif:
dynamics:
+ page_title: OpenSimplif
contact_email: simplification.sgmap@modernisation.gouv.fr
users:
connexion_title: "Connectez-vous en tant qu'utilisateur"
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index afe725ff8..bb400f609 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -44,11 +44,11 @@ fr:
piece_justificative:
attributes:
content:
- size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 3Mo."
+ size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 6Mo."
cerfa:
attributes:
content:
- size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 3Mo."
+ size_too_big: "La taille du fichier joint est trop importante. Elle doit être inférieure à 6Mo."
user:
attributes:
reset_password_token:
diff --git a/db/migrate/20161025150900_create_searches.rb b/db/migrate/20161025150900_create_searches.rb
new file mode 100644
index 000000000..911948c7d
--- /dev/null
+++ b/db/migrate/20161025150900_create_searches.rb
@@ -0,0 +1,27 @@
+class CreateSearches < ActiveRecord::Migration
+ def up
+ add_index :champs, :dossier_id
+ add_index :champs, :type_de_champ_id
+ add_index :drop_down_lists, :type_de_champ_id
+ add_index :etablissements, :dossier_id
+ add_index :entreprises, :dossier_id
+ add_index :france_connect_informations, :user_id
+ add_index :individuals, :dossier_id
+ add_index :pieces_justificatives, :dossier_id
+ add_index :rna_informations, :entreprise_id
+ create_view :searches #, materialized: true
+ end
+
+ def down
+ remove_index :champs, :dossier_id
+ remove_index :champs, :type_de_champ_id
+ remove_index :drop_down_lists, :type_de_champ_id
+ remove_index :etablissements, :dossier_id
+ remove_index :entreprises, :dossier_id
+ remove_index :france_connect_informations, :user_id
+ remove_index :individuals, :dossier_id
+ remove_index :pieces_justificatives, :dossier_id
+ remove_index :rna_informations, :entreprise_id
+ drop_view :searches #, materialized: true
+ end
+end
diff --git a/db/migrate/20161102154835_update_searches_to_version_2.rb b/db/migrate/20161102154835_update_searches_to_version_2.rb
new file mode 100644
index 000000000..55223b4cf
--- /dev/null
+++ b/db/migrate/20161102154835_update_searches_to_version_2.rb
@@ -0,0 +1,9 @@
+class UpdateSearchesToVersion2 < ActiveRecord::Migration
+ def up
+ replace_view :searches, version: 2
+ end
+
+ def down
+ replace_view :searches, version: 1
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 17762a2b4..7ef1e735e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20161011125345) do
+ActiveRecord::Schema.define(version: 20161102154835) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -102,6 +102,9 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.string "type"
end
+ add_index "champs", ["dossier_id"], name: "index_champs_on_dossier_id", using: :btree
+ add_index "champs", ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id", using: :btree
+
create_table "commentaires", force: :cascade do |t|
t.string "email"
t.datetime "created_at", null: false
@@ -135,6 +138,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.integer "type_de_champ_id"
end
+ add_index "drop_down_lists", ["type_de_champ_id"], name: "index_drop_down_lists_on_type_de_champ_id", using: :btree
+
create_table "entreprises", force: :cascade do |t|
t.string "siren"
t.integer "capital_social"
@@ -151,6 +156,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.integer "dossier_id"
end
+ add_index "entreprises", ["dossier_id"], name: "index_entreprises_on_dossier_id", using: :btree
+
create_table "etablissements", force: :cascade do |t|
t.string "siret"
t.boolean "siege_social"
@@ -168,6 +175,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.integer "entreprise_id"
end
+ add_index "etablissements", ["dossier_id"], name: "index_etablissements_on_dossier_id", using: :btree
+
create_table "exercices", force: :cascade do |t|
t.string "ca"
t.datetime "dateFinExercice"
@@ -194,6 +203,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.string "email_france_connect"
end
+ add_index "france_connect_informations", ["user_id"], name: "index_france_connect_informations_on_user_id", using: :btree
+
create_table "gestionnaires", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
@@ -221,6 +232,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.string "gender"
end
+ add_index "individuals", ["dossier_id"], name: "index_individuals_on_dossier_id", using: :btree
+
create_table "invites", force: :cascade do |t|
t.string "email"
t.string "email_sender"
@@ -255,6 +268,7 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.string "content_secure_token"
end
+ add_index "pieces_justificatives", ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id", using: :btree
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
create_table "preference_list_dossiers", force: :cascade do |t|
@@ -324,6 +338,8 @@ ActiveRecord::Schema.define(version: 20161011125345) do
t.integer "entreprise_id"
end
+ add_index "rna_informations", ["entreprise_id"], name: "index_rna_informations_on_entreprise_id", using: :btree
+
create_table "types_de_champ", force: :cascade do |t|
t.string "libelle"
t.string "type_champ"
@@ -369,4 +385,21 @@ ActiveRecord::Schema.define(version: 20161011125345) do
add_foreign_key "dossiers", "users"
add_foreign_key "procedure_paths", "administrateurs"
add_foreign_key "procedure_paths", "procedures"
+
+ create_view :searches, sql_definition: <<-SQL
+ SELECT dossiers.id AS dossier_id,
+ (((((((((((((((((((((((((((((((((((((((((((((((((((((((COALESCE(users.email, ''::character varying))::text || ' '::text) || (COALESCE(france_connect_informations.given_name, ''::character varying))::text) || ' '::text) || (COALESCE(france_connect_informations.family_name, ''::character varying))::text) || ' '::text) || (COALESCE(cerfas.content, ''::character varying))::text) || ' '::text) || (COALESCE(champs.value, ''::character varying))::text) || ' '::text) || (COALESCE(drop_down_lists.value, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.siren, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.numero_tva_intracommunautaire, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.forme_juridique, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.forme_juridique_code, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.nom_commercial, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.raison_sociale, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.siret_siege_social, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.nom, ''::character varying))::text) || ' '::text) || (COALESCE(entreprises.prenom, ''::character varying))::text) || ' '::text) || (COALESCE(rna_informations.association_id, ''::character varying))::text) || ' '::text) || (COALESCE(rna_informations.titre, ''::character varying))::text) || ' '::text) || COALESCE(rna_informations.objet, ''::text)) || ' '::text) || (COALESCE(etablissements.siret, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.naf, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.libelle_naf, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.adresse, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.code_postal, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.localite, ''::character varying))::text) || ' '::text) || (COALESCE(etablissements.code_insee_localite, ''::character varying))::text) || ' '::text) || (COALESCE(individuals.nom, ''::character varying))::text) || ' '::text) || (COALESCE(individuals.prenom, ''::character varying))::text) || ' '::text) || (COALESCE(pieces_justificatives.content, ''::character varying))::text) AS term
+ FROM ((((((((((dossiers
+ 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)));
+ SQL
+
end
diff --git a/db/views/searches_v01.sql b/db/views/searches_v01.sql
new file mode 100644
index 000000000..e5f2cfd71
--- /dev/null
+++ b/db/views/searches_v01.sql
@@ -0,0 +1,59 @@
+-- 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
diff --git a/db/views/searches_v02.sql b/db/views/searches_v02.sql
new file mode 100644
index 000000000..8a168f465
--- /dev/null
+++ b/db/views/searches_v02.sql
@@ -0,0 +1,43 @@
+-- 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
diff --git a/lib/tasks/opensimplif_import.rake b/lib/tasks/opensimplif_import.rake
new file mode 100644
index 000000000..7131153ed
--- /dev/null
+++ b/lib/tasks/opensimplif_import.rake
@@ -0,0 +1,118 @@
+require 'csv'
+require 'json'
+
+namespace :opensimplif_import do
+ task :import_all => :environment do
+ puts 'start opensimplif'
+
+ Rake::Task['opensimplif_import:import_proposition'].invoke
+ Rake::Task['opensimplif_import:import_piste'].invoke
+ Rake::Task['opensimplif_import:import_mesure'].invoke
+
+ puts 'end import opensimplif'
+ end
+
+ task :import_proposition do
+ file_path = "lib/tasks/161102_OS_Inputs_test_propositions.csv"
+ procedure_id = 35
+
+ matching = [
+ {id: 44, key: 'Intitulé de la proposition'},
+ {id: 43, key: 'Champ concerné'},
+ {id: 45, key: 'Champ ministériel chef de file'},
+ {id: 59, key: 'Date de la proposition'},
+ {id: 60, key: 'Moment de vie'},
+ {id: 61, key: 'Source'},
+ {id: 48, key: 'Description de la proposition'}
+ ]
+
+ puts 'start propositions'
+ import file_path, procedure_id, matching
+ puts 'done propositions'
+ end
+
+ task :import_piste do
+ file_path = "lib/tasks/161102_OS_Inputs_test_pistes.csv"
+ procedure_id = 36
+
+ matching = [
+ {id: 81, key: 'Intitulé de la piste *'},
+ {id: 82, key: 'Usager concerné *'},
+ {id: 83, key: 'Champ ministériel chef de file *'},
+ {id: 84, key: 'Champ ministériel contributeur'},
+ {id: 85, key: 'Date de saisine'},
+ {id: 66, key: 'Moment de vie'},
+ {id: 80, key: 'Source de la piste'},
+ {id: 70, key: 'Description de la piste '},
+ {id: 68, key: 'Objectifs / bénéfices attendus'},
+ {id: 65, key: 'Description détaillée des démarches impactées par la piste'},
+ {id: 69, key: 'Levier de mise en oeuvre'},
+ {id: 67, key: 'Précision sur le levier de meo'},
+ {id: 64, key: 'Calendrier de mise en oeuvre'}
+ ]
+
+ puts 'start piste'
+ import file_path, procedure_id, matching
+ puts 'done pistes'
+ end
+
+ task :import_mesure do
+ file_path = "lib/tasks/161102_OS_Inputs_test_mesures.csv"
+ procedure_id = 37
+
+ matching = [
+ {id: 107, key: 'Intitulé projet / mesure'},
+ {id: 104, key: 'Champ concerné'},
+ {id: 105, key: 'Champ ministériel chef de file'},
+ {id: 112, key: 'Direction chef de file'},
+ {id: 106, key: 'Champ ministériel contributeur'},
+ {id: 113, key: 'Direction contributrice'},
+ {id: 92, key: 'Moment de vie'},
+ {id: 109, key: 'Date d\'annonce'},
+ {id: 114, key: 'N° de la mesure'},
+ {id: 115, key: 'Responsable ministère'},
+ {id: 116, key: 'Responsable SGMAP'},
+ {id: 89, key: 'Actions réalisées'},
+ {id: 95, key: 'Etapes nécessaires à l\'atteinte de la cible et alertes'},
+ {id: 102, key: 'Alertes'},
+ {id: 101, key: 'Échéance initiale'},
+ {id: 96, key: 'Échéance prévisionnelle / réelle'},
+ {id: 94, key: 'Appréciation avancement'},
+ {id: 91, key: 'Etat d\'avancement LOLF'},
+ {id: 111, key: '§ de com'}
+ ]
+
+ puts 'start mesures'
+ import file_path, procedure_id, matching
+ puts 'done mesures'
+ end
+
+ def self.import file_path, procedure_id, matching
+ user = User.find_or_create_by(email: 'import@opensimplif.modernisation.fr')
+
+ unless user.valid?
+ user.password = 'TPSpassword2016'
+ user.save
+ end
+
+ file ||= CSV.open(file_path, :col_sep => ";", :headers => true).map { |x| x.to_h }.to_json
+ file = JSON.parse(file)
+
+ procedure = Procedure.find(procedure_id)
+
+ user.dossiers.where(procedure_id: procedure.id).destroy_all
+
+ file.each do |proposition|
+ dossier = Dossier.create procedure: procedure, user: user, state: :initiated
+
+ dossier.champs.each do |champ|
+ matching.each do |match|
+ if match[:id] == champ.type_de_champ.id
+ champ.update_column :value, proposition[match[:key]]
+ break
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb
index c6ddc9462..c72a02d35 100644
--- a/spec/controllers/admin/procedures_controller_spec.rb
+++ b/spec/controllers/admin/procedures_controller_spec.rb
@@ -299,7 +299,7 @@ describe Admin::ProceduresController, type: :controller do
it 'archive previous procedure' do
expect(procedure2.published).to be_truthy
expect(procedure2.archived).to be_truthy
- expect(procedure2.path).to be_nil
+ expect(procedure2.path).not_to be_nil
end
end
@@ -427,21 +427,31 @@ describe Admin::ProceduresController, type: :controller do
let!(:procedure) { create(:procedure, :published, administrateur: admin) }
let(:admin2) { create(:administrateur) }
let!(:procedure2) { create(:procedure, :published, administrateur: admin2) }
+ let!(:procedure3) { create(:procedure, :published, administrateur: admin2) }
+
subject { get :path_list }
+
let(:body) { JSON.parse(response.body) }
- before do
- subject
+ describe 'when no params' do
+ before do
+ subject
+ end
+
+ it { expect(response.status).to eq(200) }
+ it { expect(body.size).to eq(3) }
+ it { expect(body.first['label']).to eq(procedure.path) }
+ it { expect(body.first['mine']).to be_truthy }
+ it { expect(body.second['label']).to eq(procedure2.path) }
+ it { expect(body.second['mine']).to be_falsy }
+
end
- it { expect(response.status).to eq(200) }
- it { expect(body.size).to eq(2) }
- it { expect(body.first['label']).to eq(procedure.path) }
- it { expect(body.first['mine']).to be_truthy }
- it { expect(body.second['label']).to eq(procedure2.path) }
- it { expect(body.second['mine']).to be_falsy }
-
context 'filtered' do
+ before do
+ subject
+ end
+
subject { get :path_list, request: procedure2.path }
it { expect(response.status).to eq(200) }
@@ -449,6 +459,18 @@ describe Admin::ProceduresController, type: :controller do
it { expect(body.first['label']).to eq(procedure2.path) }
it { expect(body.first['mine']).to be_falsy }
end
+
+ context 'when procedure is archived' do
+
+ before do
+ procedure3.update_attribute :archived, true
+ subject
+ end
+
+ it 'do not return on the json' do
+ expect(body.size).to eq(2)
+ end
+ end
end
describe 'POST transfer' do
@@ -467,7 +489,7 @@ describe Admin::ProceduresController, type: :controller do
let(:email_admin) { new_admin.email }
it { expect(subject.status).to eq 200 }
- it { expect {subject}.to change(Procedure, :count).by(1) }
+ it { expect { subject }.to change(Procedure, :count).by(1) }
context {
before do
diff --git a/spec/controllers/backoffice/dossiers_controller_spec.rb b/spec/controllers/backoffice/dossiers_controller_spec.rb
index 61c5c0428..542b7fc12 100644
--- a/spec/controllers/backoffice/dossiers_controller_spec.rb
+++ b/spec/controllers/backoffice/dossiers_controller_spec.rb
@@ -63,14 +63,14 @@ describe Backoffice::DossiersController, type: :controller do
end
end
- describe 'GET #en_attente' do
+ describe 'GET #fige' do
context 'when gestionnaire is connected' do
before do
sign_in gestionnaire
end
it 'returns http success' do
- get :index, liste: :en_attente
+ get :index, liste: :fige
expect(response).to have_http_status(200)
end
end
diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb
index d88ae049a..9bdb158de 100644
--- a/spec/controllers/users/dossiers_controller_spec.rb
+++ b/spec/controllers/users/dossiers_controller_spec.rb
@@ -157,6 +157,16 @@ describe Users::DossiersController, type: :controller do
it { expect(subject.status).to eq 302 }
it { expect(subject).to redirect_to new_users_dossier_path(procedure_id: procedure.id) }
+
+ context 'when procedure is archived' do
+ let(:procedure) { create(:procedure, :published, archived: true) }
+
+ before do
+ procedure.update_column :archived, true
+ end
+
+ it { expect(subject.status).to eq 200 }
+ end
end
describe 'POST #siret_informations' do
diff --git a/spec/features/backoffice/navigate_to_dossier_spec.rb b/spec/features/backoffice/navigate_to_dossier_spec.rb
index 972c70f58..1c19cb3f9 100644
--- a/spec/features/backoffice/navigate_to_dossier_spec.rb
+++ b/spec/features/backoffice/navigate_to_dossier_spec.rb
@@ -20,9 +20,9 @@ feature 'on backoffice page' do
page.click_on 'Se connecter'
end
- context 'when he click on first dossier' do
+ context 'when he click on first dossier', js: true do
before do
- page.click_on dossier.id
+ page.find("#tr_dossier_#{dossier.id}").click
end
scenario 'it redirect to dossier page' do
@@ -30,7 +30,7 @@ feature 'on backoffice page' do
end
end
- context 'when gestionnaire have enterprise and individual dossier in his inbox' do
+ context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do
let!(:procedure_individual) { create :procedure, libelle: 'procedure individual', administrateur: administrateur, for_individual: true }
let!(:dossier_individual) { create :dossier, procedure: procedure_individual, state: 'updated' }
@@ -38,7 +38,7 @@ feature 'on backoffice page' do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
visit backoffice_path
- page.click_on dossier_individual.id
+ page.find("#tr_dossier_#{dossier_individual.id}").click
end
scenario 'it redirect to dossier page' do
diff --git a/spec/features/backoffice/onglets_link_spec.rb b/spec/features/backoffice/onglets_link_spec.rb
index 3232d02c4..087bb3d95 100644
--- a/spec/features/backoffice/onglets_link_spec.rb
+++ b/spec/features/backoffice/onglets_link_spec.rb
@@ -37,7 +37,7 @@ feature 'on click on tabs button' do
context 'when he click on tabs a traite' do
before do
visit backoffice_dossiers_url(liste: :a_traiter)
- page.click_on 'Action requise 1'
+ page.click_on 'Ouverts 2'
end
scenario 'it redirect to backoffice dossier termine' do
@@ -47,8 +47,8 @@ feature 'on click on tabs button' do
context 'when he click on tabs en attente' do
before do
- visit backoffice_dossiers_url(liste: :en_attente)
- page.click_on 'Attente usager 2'
+ visit backoffice_dossiers_url(liste: :figes)
+ page.click_on 'Figés 1'
end
scenario 'it redirect to backoffice dossier en attente' do
diff --git a/spec/features/users/list_dossiers_spec.rb b/spec/features/users/list_dossiers_spec.rb
index 85fdc963f..b3a767551 100644
--- a/spec/features/users/list_dossiers_spec.rb
+++ b/spec/features/users/list_dossiers_spec.rb
@@ -32,9 +32,9 @@ feature 'user access to the list of his dossier' do
expect(page).to have_css("#dossier_#{dossier1.id}_state")
end
- context 'when user clicks on a projet in list' do
+ context 'when user clicks on a projet in list', js: true do
before do
- page.click_on dossier1.procedure.libelle
+ page.find("#tr_dossier_#{dossier1.id}").click
end
scenario 'user is redirected to dossier page' do
expect(page).to have_css('#recap_dossier')
diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb
index 1cc26e1b4..6cc4ebed6 100644
--- a/spec/models/dossier_spec.rb
+++ b/spec/models/dossier_spec.rb
@@ -556,87 +556,6 @@ describe Dossier do
end
end
- describe '.search' do
- subject { liste_dossiers }
-
- let(:liste_dossiers) { described_class.search(gestionnaire_1, terms) }
- # let(:dossier) { described_class.search(gestionnaire_1, terms)[1] }
-
- let(:administrateur_1) { create(:administrateur) }
- let(:administrateur_2) { create(:administrateur) }
-
- let(:gestionnaire_1) { create(:gestionnaire, administrateurs: [administrateur_1]) }
- let(:gestionnaire_2) { create(:gestionnaire, administrateurs: [administrateur_2]) }
-
- before do
- create :assign_to, gestionnaire: gestionnaire_1, procedure: procedure_1
- create :assign_to, gestionnaire: gestionnaire_2, procedure: procedure_2
- end
-
- let(:procedure_1) { create(:procedure, administrateur: administrateur_1) }
- let(:procedure_2) { create(:procedure, administrateur: administrateur_2) }
-
- let!(:dossier_0) { create(:dossier, state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
- let!(:dossier_1) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
- let!(:dossier_2) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
- let!(:dossier_3) { create(:dossier, state: 'initiated', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
- let!(:dossier_archived) { create(:dossier, state: 'initiated', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) }
-
- let!(:etablissement_1) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Academy', dossier: dossier_1), dossier: dossier_1, siret: '41636169600051') }
- let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
- let!(:etablissement_3) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Technology', dossier: dossier_3), dossier: dossier_3, siret: '41816609600051') }
-
- describe 'search is empty' do
- let(:terms) { '' }
-
- it { expect(subject.size).to eq(0) }
- end
-
- describe 'search draft file' do
- let(:terms) { 'brouillon' }
-
- it { expect(subject.size).to eq(0) }
- it { expect(subject.class).to eq Dossier::ActiveRecord_Relation }
- end
-
- describe 'search on contact email' do
- let(:terms) { 'clap' }
-
- it { expect(subject.size).to eq(0) }
- end
-
- describe 'search on ID dossier' do
- let(:terms) { "#{dossier_2.id}" }
-
- it { expect(subject.size).to eq(1) }
- end
-
- describe 'search on SIRET' do
- context 'when is part of SIRET' do
- let(:terms) { '4181' }
-
- it { expect(subject.size).to eq(1) }
- end
-
- context 'when is a complet SIRET' do
- let(:terms) { '41816602300012' }
-
- it { expect(subject.size).to eq(1) }
- end
- end
-
- describe 'search on raison social' do
- let(:terms) { 'OCTO' }
-
- it { expect(subject.size).to eq(2) }
- end
-
- describe 'search on multiple fields' do
- let(:terms) { 'octo test' }
-
- it { expect(subject.size).to eq(1) }
- end
- end
end
describe '#cerfa_available?' do
diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb
index 47356f165..db62fda24 100644
--- a/spec/models/procedure_spec.rb
+++ b/spec/models/procedure_spec.rb
@@ -243,14 +243,14 @@ describe Procedure do
end
it 'is not available from a valid path anymore' do
- expect(procedure.path).to be_nil
+ expect(procedure.path).to eq procedure_path.path
expect(procedure.published).to be_truthy
expect(procedure.archived).to be_truthy
end
it 'is not in ProcedurePath table anymore' do
- expect(ProcedurePath.where(path: procedure.path).count).to eq(0)
- expect(ProcedurePath.find_by_procedure_id(procedure.id)).to be_nil
+ expect(ProcedurePath.where(path: procedure.path).count).to eq(1)
+ expect(ProcedurePath.find_by_procedure_id(procedure.id)).not_to be_nil
end
end
diff --git a/spec/models/search_spec.rb b/spec/models/search_spec.rb
new file mode 100644
index 000000000..4e7d20ec2
--- /dev/null
+++ b/spec/models/search_spec.rb
@@ -0,0 +1,79 @@
+require 'rails_helper'
+
+describe Search do
+ describe '.results' do
+ subject { liste_dossiers }
+
+ let(:liste_dossiers) do
+ described_class.new(gestionnaire: gestionnaire_1, query: terms).results
+ end
+
+ let(:administrateur_1) { create(:administrateur) }
+ let(:administrateur_2) { create(:administrateur) }
+
+ let(:gestionnaire_1) { create(:gestionnaire, administrateurs: [administrateur_1]) }
+ let(:gestionnaire_2) { create(:gestionnaire, administrateurs: [administrateur_2]) }
+
+ before do
+ create :assign_to, gestionnaire: gestionnaire_1, procedure: procedure_1
+ create :assign_to, gestionnaire: gestionnaire_2, procedure: procedure_2
+ end
+
+ let(:procedure_1) { create(:procedure, administrateur: administrateur_1) }
+ let(:procedure_2) { create(:procedure, administrateur: administrateur_2) }
+
+ let!(:dossier_0) { create(:dossier, state: 'draft', procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
+ let!(:dossier_1) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'contact@test.com')) }
+ let!(:dossier_2) { create(:dossier, state: 'initiated', procedure: procedure_1, user: create(:user, email: 'plop@gmail.com')) }
+ let!(:dossier_3) { create(:dossier, state: 'initiated', procedure: procedure_2, user: create(:user, email: 'peace@clap.fr')) }
+ let!(:dossier_archived) { create(:dossier, state: 'initiated', procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) }
+
+ let!(:etablissement_1) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Academy', dossier: dossier_1), dossier: dossier_1, siret: '41636169600051') }
+ let!(:etablissement_2) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'Plop octo', dossier: dossier_2), dossier: dossier_2, siret: '41816602300012') }
+ let!(:etablissement_3) { create(:etablissement, entreprise: create(:entreprise, raison_sociale: 'OCTO Technology', dossier: dossier_3), dossier: dossier_3, siret: '41816609600051') }
+
+ describe 'search is empty' do
+ let(:terms) { '' }
+
+ it { expect(subject.size).to eq(0) }
+ end
+
+ describe 'search draft file' do
+ let(:terms) { 'brouillon' }
+
+ it { expect(subject.size).to eq(0) }
+ end
+
+ describe 'search on contact email' do
+ let(:terms) { 'clap' }
+
+ it { expect(subject.size).to eq(0) }
+ end
+
+ describe 'search on SIRET' do
+ context 'when is part of SIRET' do
+ let(:terms) { '4181' }
+
+ it { expect(subject.size).to eq(1) }
+ end
+
+ context 'when is a complet SIRET' do
+ let(:terms) { '41816602300012' }
+
+ it { expect(subject.size).to eq(1) }
+ end
+ end
+
+ describe 'search on raison social' do
+ let(:terms) { 'OCTO' }
+
+ it { expect(subject.size).to eq(2) }
+ end
+
+ describe 'search on multiple fields' do
+ let(:terms) { 'octo plop' }
+
+ it { expect(subject.size).to eq(1) }
+ end
+ end
+end
diff --git a/spec/views/backoffice/dossiers/index_html.haml_spec.rb b/spec/views/backoffice/dossiers/index_html.haml_spec.rb
index ddca9e976..879b76cf2 100644
--- a/spec/views/backoffice/dossiers/index_html.haml_spec.rb
+++ b/spec/views/backoffice/dossiers/index_html.haml_spec.rb
@@ -95,29 +95,27 @@ describe 'backoffice/dossiers/index.html.haml', type: :view do
end
describe 'on tab a_traiter' do
- let(:total_dossiers) { 1 }
+ let(:total_dossiers) { 2 }
let(:active_class) { '.active .text-danger' }
- let(:dossiers_to_display) { gestionnaire.dossiers.waiting_for_gestionnaire }
+ let(:dossiers_to_display) { gestionnaire.dossiers.ouvert }
let(:liste) { 'a_traiter' }
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_updated }
end
+
+ it_behaves_like 'check_tab_content' do
+ let(:decorate_dossier_at_check) { decorate_dossier_replied }
+ end
end
- describe 'on tab en_attente' do
- let(:total_dossiers) { 2 }
+ describe 'on tab figes' do
+ let(:total_dossiers) { 1 }
let(:active_class) { '.active .text-default' }
- let(:dossiers_to_display) { gestionnaire.dossiers.waiting_for_user }
- let(:liste) { 'en_attente' }
+ let(:dossiers_to_display) { gestionnaire.dossiers.fige }
+ let(:liste) { 'fige' }
describe 'for state replied' do
- it_behaves_like 'check_tab_content' do
- let(:decorate_dossier_at_check) { decorate_dossier_replied }
- end
- end
-
- describe 'for state validated' do
it_behaves_like 'check_tab_content' do
let(:decorate_dossier_at_check) { decorate_dossier_validated }
end