Delete references @opensimplif

This commit is contained in:
Xavier J 2017-02-13 15:46:28 +01:00
parent 3c6ae2d005
commit 5d733c11fd
27 changed files with 54 additions and 457 deletions

View file

@ -36,7 +36,7 @@ class Backoffice::PreferenceListDossierController < Backoffice::DossiersListCont
private private
def path def path
Features.opensimplif ? 'opensimplif/pref_list' : 'backoffice/dossiers/pref_list' 'backoffice/dossiers/pref_list'
end end
def params_procedure_id def params_procedure_id

View file

@ -1,61 +0,0 @@
class OpensimplifController < Backoffice::Dossiers::ProcedureController
def index
if params[:id].nil?
procedure = current_gestionnaire.procedures.order('libelle ASC').first
if procedure.nil?
return redirect_to simplifications_nothing_path
else
return redirect_to simplification_path(id: procedure.id)
end
end
smartlisting_dossier
end
def nothing
end
def reload_smartlisting
smartlisting_dossier
render 'opensimplif/index', formats: :js
end
private
def smartlisting_dossier dossiers_list=nil, liste='all_state'
dossiers_list_facade liste
mes_dossiers_list = current_user.dossiers
follow_dossiers_list = dossiers_list_facade.service.suivi
all_state_dossiers_list = dossiers_list_facade.service.all_state
if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end
smart_listing_create :mes_dossiers,
mes_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :follow_dossiers,
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :all_state_dossiers,
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
def dossiers_list_facade liste='all_state'
@facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure
end
end

View file

@ -7,12 +7,6 @@ class RootController < ApplicationController
route = Rails.application.routes.recognize_path(new_user_session_path) route = Rails.application.routes.recognize_path(new_user_session_path)
end end
if Features.opensimplif
unless !user_signed_in? && !administrateur_signed_in? && !gestionnaire_signed_in?
return redirect_to simplifications_path
end
end
if user_signed_in? && !route[:controller].match('users').nil? if user_signed_in? && !route[:controller].match('users').nil?
return redirect_to users_dossiers_path return redirect_to users_dossiers_path

View file

@ -29,8 +29,6 @@ class Users::SessionsController < Sessions::SessionsController
current_user.update_attributes(loged_in_with_france_connect: '') current_user.update_attributes(loged_in_with_france_connect: '')
end end
check_opensimplif if Features.opensimplif
if user_signed_in? if user_signed_in?
redirect_to after_sign_in_path_for(:user) redirect_to after_sign_in_path_for(:user)
elsif gestionnaire_signed_in? elsif gestionnaire_signed_in?
@ -74,18 +72,6 @@ class Users::SessionsController < Sessions::SessionsController
private private
def check_opensimplif
return if (user_signed_in? && gestionnaire_signed_in?) || administrateur_signed_in?
if gestionnaire_signed_in?
User.create email: params[:user][:email], password: params[:user][:password]
try_to_authenticate User
elsif user_signed_in?
Gestionnaire.create email: params[:user][:email], password: params[:user][:password]
try_to_authenticate Gestionnaire
end
end
def error_procedure def error_procedure
flash.alert = t('errors.messages.procedure_not_found') flash.alert = t('errors.messages.procedure_not_found')
redirect_to url_for root_path redirect_to url_for root_path

View file

@ -6,7 +6,6 @@ class DossiersListFacades
def initialize current_devise_profil, liste, procedure = nil def initialize current_devise_profil, liste, procedure = nil
@current_devise_profil = current_devise_profil @current_devise_profil = current_devise_profil
@liste = liste @liste = liste
@liste = 'all_state' if Features.opensimplif
@procedure = procedure @procedure = procedure
end end

View file

@ -3,11 +3,7 @@
class BaseUploader < CarrierWave::Uploader::Base class BaseUploader < CarrierWave::Uploader::Base
def cache_dir def cache_dir
if Rails.env.production? if Rails.env.production?
if Features.opensimplif? '/tmp/tps-cache'
'/tmp/opensimplif-cache'
else
'/tmp/tps-cache'
end
else else
'/tmp/tps-dev-cache' '/tmp/tps-dev-cache'
end end

View file

@ -3,9 +3,8 @@
- if smart_listing.name.to_s == 'follow_dossiers' - if smart_listing.name.to_s == 'follow_dossiers'
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center %th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%i.fa.fa-bell %i.fa.fa-bell
- unless Features.opensimplif %th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1 État
État
- @facade_data_view.preference_list_dossiers_filter.each do |preference| - @facade_data_view.preference_list_dossiers_filter.each do |preference|
- unless preference.libelle == 'Statut' || preference.libelle == 'État' - unless preference.libelle == 'Statut' || preference.libelle == 'État'
@ -33,9 +32,8 @@
- else - else
.badge.progress-bar-warning .badge.progress-bar-warning
= total_notif = total_notif
- unless Features.opensimplif %td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1 = dossier.decorate.display_state
= dossier.decorate.display_state
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index| - @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
- unless preference.libelle == 'Statut' || preference.libelle == 'État' - unless preference.libelle == 'Statut' || preference.libelle == 'État'
%td %td

View file

@ -17,11 +17,10 @@
%div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Prénom %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Prénom
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-" %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
%div.col-md-5.col-sm-5.col-xs-5.col-lg-5.despositaire-info= @facade.individual.prenom %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.despositaire-info= @facade.individual.prenom
- unless Features.opensimplif .row
.row %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Date de naissance
%div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Date de naissance %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-" %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.birthdate
%div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.birthdate
.row.margin-top-20 .row.margin-top-20
- unless @facade.champs.nil? - unless @facade.champs.nil?
@ -34,15 +33,6 @@
- else - else
.row .row
%div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= champ.libelle %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= champ.libelle
-#- if Features.opensimplif
-# %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments
-# - if gestionnaire_signed_in?
-# = link_to "", "data-href" => backoffice_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
-# %i.fa.fa-comment-o
-# - else
-# = link_to "", "data-href" => users_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
-# %i.fa.fa-commenting-o
-#- else
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off
= "-" = "-"
%div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" } %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" }

View file

@ -1,4 +1,4 @@
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? && !Features.opensimplif - if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
#switch_menu.dropdown.dropup #switch_menu.dropdown.dropup
%button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false} %button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false}
%i.fa.fa-toggle-on %i.fa.fa-toggle-on

View file

@ -2,10 +2,9 @@
%div.dossiers-en-cours %div.dossiers-en-cours
.count= @facade_data_view.total_dossier_follow .count= @facade_data_view.total_dossier_follow
.text= "SUIVIS" .text= "SUIVIS"
- unless Features.opensimplif %div.nouveaux-dossiers
%div.nouveaux-dossiers .count= @facade_data_view.total_new_dossier
.count= @facade_data_view.total_new_dossier .text= "NOUVEAUX"
.text= "NOUVEAUX"
%div.nouvelles-notifications %div.nouvelles-notifications
.count= @facade_data_view.dossiers_with_unread_notifications.count .count= @facade_data_view.dossiers_with_unread_notifications.count
.text= "MODIFIÉS" .text= "MODIFIÉS"
@ -23,13 +22,11 @@
#procedure_list #procedure_list
- @facade_data_view.gestionnaire_procedures_name_and_id_list.each do |procedure| - @facade_data_view.gestionnaire_procedures_name_and_id_list.each do |procedure|
- url_path = Features.opensimplif ? simplification_path(procedure[:id]) : backoffice_dossiers_procedure_path(procedure[:id]) = link_to backoffice_dossiers_procedure_path(procedure[:id]), {title: procedure[:libelle]} do
= link_to url_path, {title: procedure[:libelle]} do
%div.procedure_list_element{ class: ('active' if procedure[:id] == @facade_data_view.procedure.id rescue '') } %div.procedure_list_element{ class: ('active' if procedure[:id] == @facade_data_view.procedure.id rescue '') }
= truncate(procedure[:libelle], length: 50) = truncate(procedure[:libelle], length: 50)
- total_new = @facade_data_view.new_dossier_number procedure[:id] - total_new = @facade_data_view.new_dossier_number procedure[:id]
- if total_new > 0 && !Features.opensimplif - if total_new > 0
.badge.progress-bar-success{title:'Nouveaux dossiers'} .badge.progress-bar-success{title:'Nouveaux dossiers'}
= total_new = total_new
-if procedure[:unread_notifications] > 0 -if procedure[:unread_notifications] > 0

View file

@ -2,39 +2,37 @@
%div.infos %div.infos
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s #dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
- unless Features.opensimplif %div#action-block
%div#action-block - if gestionnaire_signed_in?
- if gestionnaire_signed_in? - if !@facade.dossier.read_only?
- if !@facade.dossier.read_only? = form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do %button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
%button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'} = 'Déclarer complet'.upcase
= 'Déclarer complet'.upcase - elsif @facade.dossier.submitted?
- elsif @facade.dossier.submitted? = form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
= form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do %button.action
%button.action = 'Accuser réception'.upcase
= 'Accuser réception'.upcase - elsif @facade.dossier.received?
- elsif @facade.dossier.received? = form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do %button.action.close-dossier
%button.action.close-dossier %i.fa.fa-check
%i.fa.fa-check = form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
= form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do %button.action.forget-dossier
%button.action.forget-dossier %i.fa.fa-circle-o
%i.fa.fa-circle-o = form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do %button.action.refuse-dossier
%button.action.refuse-dossier %i.fa.fa-times
%i.fa.fa-times
- unless @facade.dossier.archived? - unless @facade.dossier.archived?
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block' = link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
%div#menu-block %div#menu-block
%div#infos-block %div#infos-block
- unless Features.opensimplif %div.split-hr-left
%div.split-hr-left %div.dossier-state= @facade.dossier.display_state
%div.dossier-state= @facade.dossier.display_state
%div.split-hr-left %div.split-hr-left
%div.notifications %div.notifications
- if @facade.dossier.notifications.empty? - if @facade.dossier.notifications.empty?

View file

@ -1,14 +0,0 @@
$.ajax({
method: 'get',
url: '/simplifications/reload_smartlisting?id=<%= @procedure_id %>',
async: true
});
$.ajax({
methd: 'get',
url: '/backoffice/preference_list_dossier/reload_pref_list?procedure_id=<%= @procedure_id %>',
async: true
}).done(function (data) {
$("#pref_list_menu").html(data);
pref_list_dossier_actions();
});

View file

@ -1,43 +0,0 @@
#backoffice_index
#pref_list_menu
= render partial: 'backoffice/dossiers/pref_list'
.default_data_block.default_visible
%div.row.show-block#new_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.carret-right
%div.carret-down
Mes simplifications
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=current_user.dossiers.count
SIMPLIFICATIONS
%div.body
= smart_listing_render :mes_dossiers
.default_data_block.default_visible
%div.row.show-block#new_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.carret-right
%div.carret-down
Les simplifications que je suivis
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=@facade_data_view.suivi_total
simplifications
%div.body
= smart_listing_render :follow_dossiers
.default_data_block
%div.row.show-block#new_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.carret-right
%div.carret-down
Les autres
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=@facade_data_view.all_state_total
simplifications
%div.body
= smart_listing_render :all_state_dossiers

View file

@ -1,6 +0,0 @@
<%= smart_listing_update :mes_dossiers, {force: true} %>
<%= smart_listing_update :follow_dossiers, {force: true} %>
<%= smart_listing_update :all_state_dossiers, {force: true} %>
filters_init();
link_init();

View file

@ -1,6 +0,0 @@
.center
%h3.text-danger
Vous n'avez aucun droit de lecture sur cette plateforme.
%h4
Merci de prendre contact avec votre reponsable simplification afin de remedier à ce problème.

View file

@ -30,16 +30,15 @@
.col-lg-8 .col-lg-8
= render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier } = render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier }
- unless Features.opensimplif #state_description.row{style:'width: 50%; margin-left:20px'}
#state_description.row{style:'width: 50%; margin-left:20px'} .panel.panel-info
.panel.panel-info .panel-body.center
.panel-body.center .row
.row .col-md-1.col-lg-1.col-sm-1.col-xs-1
.col-md-1.col-lg-1.col-sm-1.col-xs-1 .fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'} .col-md-11.col-sm-11.col-xs-11.col-lg-11
.col-md-11.col-sm-11.col-xs-11.col-lg-11 Les documents administratifs ne sont pas indispensables afin d'initier votre dossier.
Les documents administratifs ne sont pas indispensables afin d'initier votre dossier. Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
-route = Rails.application.routes.recognize_path(request.referrer) -route = Rails.application.routes.recognize_path(request.referrer)

View file

@ -12,5 +12,4 @@
%div.body %div.body
= smart_listing_render :dossiers = smart_listing_render :dossiers
- unless Features.opensimplif = render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}
= render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}

View file

@ -11,7 +11,7 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# branch - Branch name to deploy. (needed by mina/git) # branch - Branch name to deploy. (needed by mina/git)
ENV['to'] ||= "staging" ENV['to'] ||= "staging"
raise "Bad to=#{+ENV['to']}" unless ["staging", "production", "opensimplif", "tps_v2"].include?(ENV['to']) raise "Bad to=#{+ENV['to']}" unless ["staging", "production", "tps_v2"].include?(ENV['to'])
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil? raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
@ -42,15 +42,6 @@ elsif ENV["to"] == "production"
set :deploy_to, '/var/www/tps' set :deploy_to, '/var/www/tps'
set :user, 'tps' # Username in the server to SSH to. set :user, 'tps' # Username in the server to SSH to.
appname = 'tps' appname = 'tps'
elsif ENV["to"] == "opensimplif"
if ENV['branch'].nil?
set :branch, 'master'
else
set :branch, ENV['branch']
end
set :deploy_to, '/var/www/opensimplif'
set :user, 'opensimplif' # Username in the server to SSH to.
appname = 'opensimplif'
elsif ENV["to"] == "tps_v2" elsif ENV["to"] == "tps_v2"
if ENV['branch'].nil? if ENV['branch'].nil?
set :branch, 'staging_v2' set :branch, 'staging_v2'
@ -64,9 +55,7 @@ end
set :rails_env, ENV["to"] set :rails_env, ENV["to"]
if ENV["to"] == "opensimplif" if ENV["to"] == "tps_v2"
set :rails_env, "production"
elsif ENV["to"] == "tps_v2"
set :rails_env, "staging" set :rails_env, "staging"
end end

View file

@ -1,2 +1 @@
remote_storage: false remote_storage: false
opensimplif: false

View file

@ -1,2 +1 @@
LOGO_NAME = 'logos/logo-tps.png' unless Features.opensimplif LOGO_NAME = 'logos/logo-tps.png'
LOGO_NAME = 'logos/logo-opensimplif.jpg' if Features.opensimplif

View file

@ -42,13 +42,6 @@ Rails.application.routes.draw do
get 'admin' => 'admin#index' get 'admin' => 'admin#index'
get 'backoffice' => 'backoffice#index' get 'backoffice' => 'backoffice#index'
if Features.opensimplif
get 'simplifications' => 'opensimplif#index'
get 'simplifications/reload_smartlisting' => 'opensimplif#reload_smartlisting'
get 'simplifications/nothing' => 'opensimplif#nothing'
get 'simplifications/:id' => 'opensimplif#index', as: :simplification
end
resources :administrations resources :administrations
namespace :france_connect do namespace :france_connect do

View file

@ -1,118 +0,0 @@
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

View file

@ -83,19 +83,6 @@ describe RootController, type: :controller do
end end
context 'when opensimplif features is true' do
pending
# let(:gestionnaire) { create(:gestionnaire) }
#
# before do
# sign_in gestionnaire
#
# allow_any_instance_of(Features).to receive(:opensimplif).and_return(true)
# end
#
# it { expect(subject).to redirect_to(simplifications_path) }
end
context "unified login" do context "unified login" do
render_views render_views

View file

@ -22,33 +22,4 @@ feature 'backoffice: flux de commentaires' do
comments = find(".commentaires") comments = find(".commentaires")
expect(comments).to have_selector(".content", count: 1) expect(comments).to have_selector(".content", count: 1)
end end
scenario "affichage des commentaires du champs", js: true do
pending 'later: open simplif'
find("#liste_champs th", text: champ1.libelle).click_link("COM")
expect(page).to have_css("#modalCommentairesDossierParChamp.in")
modal = find("#modalCommentairesDossierParChamp")
expect(modal).to have_css(".description", count: 2)
end
scenario "crée un commentaire sur un champ", js: true do
pending 'later: open simplif'
# ouverture modale
find("#liste_champs th", text: champ1.libelle).click_link("COM")
# ajout du commentaire
form = find("#modalCommentairesDossierParChamp").find("#commentaire_new")
form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}")
form.click_on("Poster")
# le commentaire ne s'ajoute pas aux commentaires généraux
comments = find("#commentaires_flux")
expect(comments).to have_selector(".description", count: 1)
# ajout du commentaire aux commentaires du champs
find("#liste_champs th", text: champ1.libelle).click_link("COM")
modal = find("#modalCommentairesDossierParChamp")
expect(modal).to have_css(".description", count: 3)
end
end end

View file

@ -22,34 +22,4 @@ feature 'users: flux de commentaires' do
comments = find(".commentaires") comments = find(".commentaires")
expect(comments).to have_selector(".content", count: 1) expect(comments).to have_selector(".content", count: 1)
end end
scenario "affichage des commentaires du champs", js: true do
pending 'later: open simplif'
th = find("#liste_champs th", text: champ1.libelle)
th.click_link("COM")
expect(page).to have_css("#modalCommentairesDossierParChamp.in")
modal = find("#modalCommentairesDossierParChamp")
expect(modal).to have_css(".description", count: 2)
end
scenario "crée un commentaire sur un champ", js: true do
pending 'later: open simplif'
# ouverture modale
find("#liste_champs th", text: champ1.libelle).click_link("COM")
# ajout du commentaire
form = find("#modalCommentairesDossierParChamp").find("#commentaire_new")
form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}")
form.click_on("Poster")
# le commentaire ne s'ajoute pas aux commentaires généraux
comments = find("#commentaires_flux")
expect(comments).to have_selector(".description", count: 1)
# ajout du commentaire aux commentaires du champs
find("#liste_champs th", text: champ1.libelle).click_link("COM")
modal = find("#modalCommentairesDossierParChamp")
expect(modal).to have_css(".description", count: 3)
end
end end

View file

@ -77,15 +77,4 @@ feature 'on click on tabs button' do
end end
end end
end end
context "OpenSimplif" do
before do
allow(Features).to receive(:opensimplif).and_return(true)
visit users_dossiers_url
end
scenario "it hides the tabs" do
expect(page).to_not have_css('#onglets')
end
end
end end

View file

@ -17,14 +17,6 @@ describe BaseUploader do
end end
it { is_expected.to eq '/tmp/tps-cache' } it { is_expected.to eq '/tmp/tps-cache' }
context 'when is opensimplif' do
before do
allow(Features).to receive(:opensimplif?).and_return(true)
end
it { is_expected.to eq '/tmp/opensimplif-cache' }
end
end end
end end
end end