Merge branch 'dev'
This commit is contained in:
commit
d92780b859
20 changed files with 200 additions and 288 deletions
54
.rubocop.yml
54
.rubocop.yml
|
@ -669,7 +669,12 @@ Rails/BulkChangeTable:
|
|||
Enabled: false
|
||||
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- db/migrate/2015*.rb
|
||||
- db/migrate/2016*.rb
|
||||
- db/migrate/2017*.rb
|
||||
- db/migrate/2018*.rb
|
||||
|
||||
Rails/Date:
|
||||
Enabled: false
|
||||
|
@ -806,37 +811,39 @@ Style/Alias:
|
|||
Enabled: false
|
||||
|
||||
Style/AndOr:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/ArrayJoin:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/AsciiComments:
|
||||
Enabled: false
|
||||
|
||||
Style/Attr:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/AutoResourceCleanup:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/BarePercentLiterals:
|
||||
Enabled: false
|
||||
|
||||
Style/BeginBlock:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/BlockComments:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/BlockDelimiters:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- "spec/**/*"
|
||||
|
||||
Style/BracesAroundHashParameters:
|
||||
Enabled: false
|
||||
|
||||
Style/CaseEquality:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/CharacterLiteral:
|
||||
Enabled: false
|
||||
|
@ -845,10 +852,10 @@ Style/ClassAndModuleChildren:
|
|||
Enabled: false
|
||||
|
||||
Style/ClassCheck:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/ClassMethods:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/ClassVars:
|
||||
Enabled: false
|
||||
|
@ -857,7 +864,7 @@ Style/CollectionMethods:
|
|||
Enabled: false
|
||||
|
||||
Style/ColonMethodCall:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/ColonMethodDefinition:
|
||||
Enabled: true
|
||||
|
@ -881,7 +888,7 @@ Style/DateTime:
|
|||
Enabled: false
|
||||
|
||||
Style/DefWithParentheses:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/Dir:
|
||||
Enabled: true
|
||||
|
@ -896,7 +903,7 @@ Style/DoubleNegation:
|
|||
Enabled: false
|
||||
|
||||
Style/EachForSimpleLoop:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/EachWithObject:
|
||||
Enabled: false
|
||||
|
@ -914,43 +921,44 @@ Style/EmptyLambdaParameter:
|
|||
Enabled: true
|
||||
|
||||
Style/EmptyLiteral:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/EmptyMethod:
|
||||
Enabled: false
|
||||
|
||||
Style/Encoding:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/EndBlock:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/EvalWithLocation:
|
||||
Enabled: false
|
||||
|
||||
Style/EvenOdd:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/ExpandPathArguments:
|
||||
Enabled: true
|
||||
|
||||
Style/FlipFlop:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/For:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/FormatStringToken:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
EnforcedStyle: template
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
Style/GlobalVars:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
|
|
|
@ -517,7 +517,7 @@ GEM
|
|||
rspec-support (3.8.0)
|
||||
rspec_junit_formatter (0.4.1)
|
||||
rspec-core (>= 2, < 4, != 2.12.0)
|
||||
rubocop (0.60.0)
|
||||
rubocop (0.61.1)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.5, != 2.5.1.1)
|
||||
|
|
|
@ -93,7 +93,7 @@ class StatsController < ApplicationController
|
|||
else
|
||||
evolution = 0
|
||||
end
|
||||
formatted_evolution = sprintf("%+d", evolution)
|
||||
formatted_evolution = format("%+d", evolution)
|
||||
|
||||
{
|
||||
total: total.to_s,
|
||||
|
@ -111,7 +111,7 @@ class StatsController < ApplicationController
|
|||
else
|
||||
evolution = 0
|
||||
end
|
||||
formatted_evolution = sprintf("%+d", evolution)
|
||||
formatted_evolution = format("%+d", evolution)
|
||||
|
||||
{
|
||||
total: total.to_s,
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
// Include runtime-polyfills for older browsers.
|
||||
// Due to .babelrc's 'useBuiltIns', only polyfills actually
|
||||
// required by the browsers we support will be included.
|
||||
import '@babel/polyfill';
|
||||
|
||||
// This file is copied from mailjet. We serve here a copy of it ourselves
|
||||
// to avoid loading javascript files from other domains on the frontpage.
|
||||
|
||||
// Array of popin translations
|
||||
const i8nMessages = [];
|
||||
i8nMessages['en_US'] = [];
|
||||
i8nMessages['fr_FR'] = [];
|
||||
i8nMessages['de_DE'] = [];
|
||||
i8nMessages['es_ES'] = [];
|
||||
i8nMessages['en_US']['iframe-error'] =
|
||||
'Your browser does not support the IFrame element';
|
||||
i8nMessages['en_US']['close-popin'] = 'Close';
|
||||
i8nMessages['fr_FR']['iframe-error'] =
|
||||
"Votre navigateur ne supporte pas l'élément iframe";
|
||||
i8nMessages['fr_FR']['close-popin'] = 'Fermer';
|
||||
i8nMessages['de_DE']['iframe-error'] =
|
||||
'Ihr navigator verträgt kein Element iframe';
|
||||
i8nMessages['de_DE']['close-popin'] = 'Schließen';
|
||||
i8nMessages['es_ES']['iframe-error'] =
|
||||
'Su navegante no soporta el elemento iframe';
|
||||
i8nMessages['es_ES']['close-popin'] = 'Cerrarse';
|
||||
|
||||
function mjOpenPopin(event, element) {
|
||||
event.preventDefault();
|
||||
//event.stopPropagation();
|
||||
|
||||
//var token = str.substring(btnNode.id.lastIndexOf("-") + 1, btnNode.id.length - btnNode.id.lastIndexOf("-"));
|
||||
var token = element.getAttribute('data-token');
|
||||
|
||||
//Register parameters
|
||||
var widgetPopinData = document.querySelector(
|
||||
".mj-w-data[data-token='" + token + "']"
|
||||
);
|
||||
if (widgetPopinData) {
|
||||
var apiKey = widgetPopinData.getAttribute('data-apikey');
|
||||
var wId = widgetPopinData.getAttribute('data-w-id');
|
||||
var locale = widgetPopinData.getAttribute('data-lang');
|
||||
var base = widgetPopinData.getAttribute('data-base');
|
||||
var width = widgetPopinData.getAttribute('data-width');
|
||||
var height = widgetPopinData.getAttribute('data-height');
|
||||
var statics = widgetPopinData.getAttribute('data-statics');
|
||||
|
||||
// Call to Mailjet CSS file
|
||||
var cssFile = document.createElement('link');
|
||||
cssFile.setAttribute('rel', 'stylesheet');
|
||||
cssFile.setAttribute('type', 'text/css');
|
||||
if (statics) {
|
||||
base += '/' + statics;
|
||||
}
|
||||
cssFile.setAttribute('href', base + '/css/w-popin-less.css');
|
||||
document.getElementsByTagName('head')[0].appendChild(cssFile);
|
||||
|
||||
var htmlCode =
|
||||
'<div id="mj-w-overlay" style="display: none;">' +
|
||||
'<div id="mj-w-popin-block" style="max-width:' +
|
||||
width +
|
||||
'px; max-height:' +
|
||||
height +
|
||||
'px">' +
|
||||
'<div id="mj-w-loader"></div>' +
|
||||
'<img id="mj-w-close-img" alt="' +
|
||||
i8nMessages[locale]['close-popin'] +
|
||||
'" title="' +
|
||||
i8nMessages[locale]['close-popin'] +
|
||||
'" src="' +
|
||||
base +
|
||||
'/images/w-popin-close.png" style="display:none;" />' +
|
||||
'<iframe id="mj-w-iframe" src="' +
|
||||
base +
|
||||
'/widget/iframe/' +
|
||||
apiKey +
|
||||
'/' +
|
||||
wId +
|
||||
'" scrolling="no" width="100% " frameborder="0" allotransparency="true" style="background-color:transparent; border-radius:3px;height: 0px;">' +
|
||||
'<p>' +
|
||||
i8nMessages[locale]['iframe-error'] +
|
||||
'</p>' +
|
||||
'</iframe>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
widgetPopinData.innerHTML = htmlCode;
|
||||
|
||||
document.getElementById('mj-w-iframe').onload = function() {
|
||||
document.getElementById('mj-w-iframe').style.height = height + 'px';
|
||||
document.getElementById('mj-w-close-img').style.display = 'block';
|
||||
document.getElementById('mj-w-loader').style.display = 'none';
|
||||
document.getElementById('mj-w-popin-block').style.border = 'none';
|
||||
if (window.matchMedia('(max-width: 767px)').matches) {
|
||||
document.getElementById('mj-w-iframe').style.width = '100%';
|
||||
document.getElementById('mj-w-popin-block').style.height = 'auto';
|
||||
document.getElementById('mj-w-popin-block').style.width = '90%';
|
||||
}
|
||||
};
|
||||
|
||||
var closeImgNode = document.getElementById('mj-w-close-img');
|
||||
closeImgNode.addEventListener('click', function(event) {
|
||||
closePopin();
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', escapeEvent);
|
||||
document.getElementById('mj-w-iframe').onclick = function(event) {
|
||||
event.stopPropagation();
|
||||
};
|
||||
//document.addEventListener("click");
|
||||
|
||||
document.getElementById('mj-w-overlay').style.display = 'block';
|
||||
document
|
||||
.getElementById('mj-w-overlay')
|
||||
.addEventListener('click', function(event) {
|
||||
closePopin();
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Escape event : close popin
|
||||
function escapeEvent(e) {
|
||||
if (e.keyCode == 27) {
|
||||
// Escape key
|
||||
closePopin();
|
||||
}
|
||||
}
|
||||
|
||||
// Close popin (remove popin HTML code)
|
||||
function closePopin() {
|
||||
var rootContainer = document.getElementById('mj-w-overlay');
|
||||
if (rootContainer) {
|
||||
rootContainer.parentNode.removeChild(rootContainer);
|
||||
}
|
||||
document.removeEventListener('keypress', escapeEvent);
|
||||
}
|
||||
|
||||
addEventListener('load', () => {
|
||||
// Display popin when click event occure on widget button
|
||||
for (let btnNode of document.getElementsByClassName('mj-w-btn')) {
|
||||
btnNode.style.cursor = 'pointer';
|
||||
btnNode.addEventListener('click', function(event) {
|
||||
mjOpenPopin(event, this);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
addEventListener('resize', () => {
|
||||
if (window.matchMedia('(max-width: 767px)').matches) {
|
||||
const popin = document.getElementById('mj-w-popin-block');
|
||||
const iframe = document.getElementById('mj-w-iframe');
|
||||
if (popin) {
|
||||
popin.style.height = 'auto';
|
||||
popin.style.width = '90%';
|
||||
}
|
||||
if (iframe) {
|
||||
iframe.style.width = '100%';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.mjOpenPopin = mjOpenPopin;
|
|
@ -41,11 +41,11 @@ class FileSizeValidator < ActiveModel::EachValidator
|
|||
end
|
||||
|
||||
def validate_each(record, attribute, value)
|
||||
if !value.kind_of?(CarrierWave::Uploader::Base)
|
||||
if !value.is_a?(CarrierWave::Uploader::Base)
|
||||
raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected")
|
||||
end
|
||||
|
||||
if value.kind_of?(String)
|
||||
if value.is_a?(String)
|
||||
value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value)
|
||||
end
|
||||
|
||||
|
|
|
@ -167,13 +167,13 @@ module TagsSubstitutionConcern
|
|||
end
|
||||
|
||||
def types_de_champ_tags(types_de_champ, available_for_states)
|
||||
types_de_champ.map { |tdc|
|
||||
types_de_champ.map do |tdc|
|
||||
{
|
||||
libelle: tdc.libelle,
|
||||
description: tdc.description,
|
||||
available_for_states: available_for_states
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def replace_tags(text, dossier)
|
||||
|
|
|
@ -239,6 +239,10 @@ class Procedure < ApplicationRecord
|
|||
whitelisted_at.present?
|
||||
end
|
||||
|
||||
def has_old_pjs?
|
||||
types_de_piece_justificative.any?
|
||||
end
|
||||
|
||||
def total_dossier
|
||||
self.dossiers.state_not_brouillon.size
|
||||
end
|
||||
|
|
|
@ -5,5 +5,5 @@ class TypeDePieceJustificative < ApplicationRecord
|
|||
|
||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||
|
||||
validates :lien_demarche, format: { with: URI::regexp }, allow_blank: true, allow_nil: true
|
||||
validates :lien_demarche, format: { with: URI.regexp }, allow_blank: true, allow_nil: true
|
||||
end
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
.row.white-back
|
||||
#piece_justificative_form
|
||||
= render 'form'
|
||||
.alert.alert-info
|
||||
.form-group
|
||||
%p
|
||||
Pour vos nouveaux besoins de pièces jointes, nous vous invitons à
|
||||
= link_to(admin_procedure_types_de_champ_path(@procedure)) do
|
||||
rajouter des champs
|
||||
\ <em>pièce justificative</em> à votre formulaire.
|
||||
|
||||
%p
|
||||
Ils offrent les avantages suivants :
|
||||
|
||||
%ul
|
||||
%li Pièces justificatives au fil du formulaire, pour un déroulé plus fluide
|
||||
%li Possibilité de fournir à l’usager un fichier type à remplir et renvoyer
|
||||
%li Possibilité pour l’usager de supprimer les documents joints par erreur
|
||||
%li Support des pièces de grande taille (jusqu’à 200 Mo par pièce)
|
||||
%li Pas de limite de soumission simultanée de plusieurs pièces, pour une expérience usager plus confortable
|
||||
|
||||
= link_to(admin_procedure_types_de_champ_path(@procedure), class: 'btn btn-success') do
|
||||
Ajouter un champ PJ
|
||||
|
||||
- if @procedure.has_old_pjs?
|
||||
#piece_justificative_form
|
||||
= render 'form'
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
%data.mj-w-data{ "data-apikey" => "1v5T", "data-base" => "https://app.mailjet.com", "data-height" => "328", "data-lang" => "fr_FR", "data-statics" => "statics", "data-token" => "11c89e7ddb46fbcdcb7f8fe5fdfca818", "data-w-id" => "39b", "data-width" => "640", "value" => "mj" }
|
||||
= javascript_pack_tag 'mailjet', defer: true, 'data-turbolinks-eval': false
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
- if content_for?(:footer)
|
||||
= content_for(:footer)
|
||||
= render partial: "layouts/mailjet_newsletter"
|
||||
|
||||
- if Rails.env.development?
|
||||
= javascript_include_tag :xray
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
%li.footer-column
|
||||
%ul.footer-logos
|
||||
%li.footer-text
|
||||
Un service fourni par la <a href="http://www.modernisation.gouv.fr/">DINSIC</a>
|
||||
Un service fourni par la
|
||||
= link_to "DINSIC", "http://www.modernisation.gouv.fr/"
|
||||
%br
|
||||
et incubé par <a href="https://beta.gouv.fr">beta.gouv.fr</a>
|
||||
et incubé par
|
||||
= link_to "beta.gouv.fr", "https://beta.gouv.fr"
|
||||
%li
|
||||
= link_to "http://www.modernisation.gouv.fr/" do
|
||||
%span.footer-logo.footer-logo-dinsic{ role: 'img', 'aria-label': 'DINSIC' }
|
||||
|
@ -17,7 +19,7 @@
|
|||
%li.footer-column
|
||||
%ul.footer-links
|
||||
%li.footer-link
|
||||
%a{ href: '#', 'data-token' => '11c89e7ddb46fbcdcb7f8fe5fdfca818', onclick: 'mjOpenPopin(event, this)' } Newsletter
|
||||
= link_to "Newsletter", "https://my.sendinblue.com/users/subscribe/js_id/3s2q1/id/1", :class => "footer-link", :target => "_blank"
|
||||
%li.footer-link
|
||||
= link_to "Nouveautés", "https://github.com/betagouv/tps/releases", :class => "footer-link"
|
||||
%li.footer-link
|
||||
|
@ -25,9 +27,9 @@
|
|||
%li.footer-link
|
||||
= link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link
|
||||
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
= link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
|
||||
%li.footer-link
|
||||
= link_to "Suivi d'audience et vie privée", suivi_path, :class => "footer-link"
|
||||
= link_to "Suivi d'audience et vie privée", suivi_path, :class => "footer-link"
|
||||
|
||||
%li.footer-column
|
||||
%ul.footer-links
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
- content_for :footer do
|
||||
= render partial: "root/footer"
|
||||
|
||||
.tour-de-france-banner
|
||||
.container
|
||||
L'équipe demarches-simplifiees.fr vient à votre rencontre cet automne.
|
||||
= succeed '.' do
|
||||
= link_to "En savoir plus", tour_de_france_path
|
||||
|
||||
.landing
|
||||
.landing-panel.hero-panel
|
||||
.container
|
||||
|
|
6
db/migrate/20181218204707_add_missing_timestamps.rb
Normal file
6
db/migrate/20181218204707_add_missing_timestamps.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddMissingTimestamps < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_timestamps :administrateurs_gestionnaires, null: true
|
||||
add_timestamps :geo_areas, null: true
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_12_18_103212) do
|
||||
ActiveRecord::Schema.define(version: 2018_12_18_204707) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -60,6 +60,8 @@ ActiveRecord::Schema.define(version: 2018_12_18_103212) do
|
|||
create_table "administrateurs_gestionnaires", id: false, force: :cascade do |t|
|
||||
t.integer "administrateur_id"
|
||||
t.integer "gestionnaire_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["administrateur_id"], name: "index_administrateurs_gestionnaires_on_administrateur_id"
|
||||
t.index ["gestionnaire_id", "administrateur_id"], name: "unique_couple_administrateur_gestionnaire", unique: true
|
||||
t.index ["gestionnaire_id"], name: "index_administrateurs_gestionnaires_on_gestionnaire_id"
|
||||
|
@ -344,6 +346,8 @@ ActiveRecord::Schema.define(version: 2018_12_18_103212) do
|
|||
t.jsonb "properties"
|
||||
t.bigint "champ_id"
|
||||
t.string "geo_reference_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["champ_id"], name: "index_geo_areas_on_champ_id"
|
||||
t.index ["source"], name: "index_geo_areas_on_source"
|
||||
end
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace :cloudstorage do
|
|||
Rake::Task['cloudstorage:init'].invoke
|
||||
|
||||
error_count = 0
|
||||
[Cerfa, PieceJustificative, Procedure].each { |c|
|
||||
c.all.each { |entry|
|
||||
[Cerfa, PieceJustificative, Procedure].each do |c|
|
||||
c.all.each do |entry|
|
||||
content = (c == Procedure) ? entry.logo : entry.content
|
||||
if !(content.current_path.nil? || File.exist?(File.dirname(content.current_path) + '/uploaded'))
|
||||
secure_token = SecureRandom.uuid
|
||||
|
@ -56,8 +56,8 @@ namespace :cloudstorage do
|
|||
puts "Skipping #{content.current_path}"
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
puts "There were #{error_count} errors while uploading files. See upload_errors.report file for details."
|
||||
puts 'Enf of migration'
|
||||
|
@ -67,8 +67,8 @@ namespace :cloudstorage do
|
|||
task :revert do
|
||||
Rake::Task['cloudstorage:init'].invoke
|
||||
|
||||
[Cerfa, PieceJustificative, Procedure].each { |c|
|
||||
c.all.each { |entry|
|
||||
[Cerfa, PieceJustificative, Procedure].each do |c|
|
||||
c.all.each do |entry|
|
||||
content = (c == Procedure) ? entry.logo : entry.content
|
||||
if content.current_path.present?
|
||||
if File.exist?(File.dirname(content.current_path) + '/uploaded')
|
||||
|
@ -86,26 +86,26 @@ namespace :cloudstorage do
|
|||
FileUtils.rm(File.dirname(content.current_path) + '/secure_token_cloudstorage')
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Clear old documents in tenant'
|
||||
task :clear do
|
||||
Rake::Task['cloudstorage:init'].invoke
|
||||
|
||||
@cont.objects.each { |object|
|
||||
@cont.objects.each do |object|
|
||||
puts "Removing #{object}"
|
||||
@cont.delete_object(object)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
task :clear_old_objects do
|
||||
Rake::Task['cloudstorage:init'].invoke
|
||||
|
||||
@cont.objects_detail.each { |object, details|
|
||||
@cont.objects_detail.each do |object, details|
|
||||
last_modified = Time.zone.parse(details[:last_modified])
|
||||
@cont.delete_object(object) if last_modified.utc <= (Time.zone.now - 2.years).utc
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: fix_email_templates_subjects'
|
||||
task fix_email_templates_subjects: :environment do
|
||||
puts "Running deploy task 'fix_email_templates_subjects'"
|
||||
|
||||
klasses = [
|
||||
Mails::ClosedMail,
|
||||
Mails::InitiatedMail,
|
||||
Mails::ReceivedMail,
|
||||
Mails::RefusedMail,
|
||||
Mails::WithoutContinuationMail
|
||||
]
|
||||
|
||||
klasses.each do |klass|
|
||||
klass
|
||||
.where("subject LIKE '%--libellé procédure--%'")
|
||||
.each do |instance|
|
||||
|
||||
instance.update(subject: instance.subject.gsub("--libellé procédure--", "--libellé démarche--"))
|
||||
rake_puts "Subject mis-à-jour pour #{klass.to_s}##{instance.id}"
|
||||
end
|
||||
end
|
||||
|
||||
# Update task as completed. If you remove the line below, the task will
|
||||
# run with every deploy (or every time you call after_party:run).
|
||||
AfterParty::TaskRecord.create version: '20181219122438'
|
||||
end # task :fix_email_templates_subjects
|
||||
end # namespace :after_party
|
|
@ -52,7 +52,7 @@ class ProgressReport
|
|||
|
||||
def print_progress
|
||||
elapsed = Time.zone.now - @start
|
||||
percent = sprintf('%5.1f%%', @per_10_000 / 100.0)
|
||||
percent = format('%5.1f%%', @per_10_000 / 100.0)
|
||||
total = @total.to_s
|
||||
count = @count.to_s.rjust(total.length)
|
||||
rake_print("\r#{percent} (#{count}/#{total}) [#{format_duration(elapsed)}/#{format_duration(elapsed * 10_000.0 / @per_10_000)}]")
|
||||
|
|
|
@ -6,28 +6,31 @@ feature 'add a new type de piece justificative', js: true do
|
|||
before do
|
||||
login_as administrateur, scope: :administrateur
|
||||
end
|
||||
context 'when there is no piece justificative' do
|
||||
context 'when there is an existing piece justificative' do
|
||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||
before do
|
||||
# Create a dummy PJ, because adding PJs is no longer allowed on procedures that
|
||||
# do not already have one
|
||||
procedure.types_de_piece_justificative.create(libelle: "dummy PJ")
|
||||
visit admin_procedure_pieces_justificatives_path(procedure)
|
||||
end
|
||||
scenario 'displays a form to add new type de piece justificative' do
|
||||
within '#new_type_de_piece_justificative' do
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_0_libelle')
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
end
|
||||
end
|
||||
context 'when user fills field and submit' do
|
||||
let(:libelle) { 'ma piece' }
|
||||
let(:description) { 'ma description' }
|
||||
before do
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set(libelle)
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_description').set(description)
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle').set(libelle)
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_1_description').set(description)
|
||||
page.click_on 'Ajouter la pièce'
|
||||
wait_for_ajax
|
||||
end
|
||||
subject do
|
||||
procedure.reload
|
||||
procedure.types_de_piece_justificative.first
|
||||
procedure.types_de_piece_justificative.second
|
||||
end
|
||||
scenario 'creates new type de piece' do
|
||||
expect(subject.libelle).to eq(libelle)
|
||||
|
@ -35,23 +38,23 @@ feature 'add a new type de piece justificative', js: true do
|
|||
end
|
||||
scenario 'displays new created pj' do
|
||||
within '#liste_piece_justificative' do
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_0_libelle')
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
expect(page.body).to match(libelle)
|
||||
expect(page.body).to match(description)
|
||||
end
|
||||
within '#new_type_de_piece_justificative' do
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
expect(page).to have_css('#procedure_types_de_piece_justificative_attributes_2_libelle')
|
||||
end
|
||||
end
|
||||
context 'when user delete pj' do
|
||||
before do
|
||||
pj = procedure.types_de_piece_justificative.first
|
||||
pj = procedure.types_de_piece_justificative.second
|
||||
page.find_by_id("delete_type_de_piece_justificative_#{pj.id}").click
|
||||
wait_for_ajax
|
||||
end
|
||||
scenario 'removes pj from page' do
|
||||
within '#liste_piece_justificative' do
|
||||
expect(page).not_to have_css('#procedure_types_de_piece_justificative_attributes_0_libelle')
|
||||
expect(page).not_to have_css('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
expect(page.body).not_to match(libelle)
|
||||
expect(page.body).not_to match(description)
|
||||
end
|
||||
|
@ -60,12 +63,12 @@ feature 'add a new type de piece justificative', js: true do
|
|||
context 'when user change existing type de pj' do
|
||||
let(:new_libelle) { 'mon nouveau libelle' }
|
||||
before do
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_0_libelle').set(new_libelle)
|
||||
page.find_by_id('procedure_types_de_piece_justificative_attributes_1_libelle').set(new_libelle)
|
||||
page.find_by_id('save').click
|
||||
wait_for_ajax
|
||||
end
|
||||
scenario 'saves change in database' do
|
||||
pj = procedure.types_de_piece_justificative.first
|
||||
pj = procedure.types_de_piece_justificative.second
|
||||
expect(pj.libelle).to eq(new_libelle)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -87,60 +87,68 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
procedure.update(service: create(:service))
|
||||
end
|
||||
|
||||
scenario 'Add champ, add file, visualize them in procedure preview' do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
click_on 'add_type_de_champ'
|
||||
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.last))
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_1_libelle')
|
||||
expect(Procedure.last.types_de_champ.first.libelle).to eq('libelle de champ')
|
||||
|
||||
click_on 'onglet-pieces'
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
fill_in 'procedure_types_de_piece_justificative_attributes_0_libelle', with: 'libelle de piece'
|
||||
click_on 'add_piece_justificative'
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
expect(page).to have_selector('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
|
||||
preview_window = window_opened_by { click_on 'onglet-preview' }
|
||||
within_window(preview_window) do
|
||||
expect(page).to have_current_path(apercu_procedure_path(Procedure.last))
|
||||
expect(page).to have_field('libelle de champ')
|
||||
expect(page).to have_field('libelle de piece')
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'After adding champ and file, check impossibility to publish procedure, add instructeur and make publication' do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
click_on 'add_type_de_champ'
|
||||
click_on 'onglet-pieces'
|
||||
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
fill_in 'procedure_types_de_piece_justificative_attributes_0_libelle', with: 'libelle de piece'
|
||||
click_on 'add_piece_justificative'
|
||||
|
||||
click_on 'onglet-infos'
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
expect(page).to have_selector('#disabled-publish-procedure')
|
||||
expect(page.find_by_id('disabled-publish-procedure')[:disabled]).to eq('true')
|
||||
|
||||
click_on 'onglet-instructeurs'
|
||||
expect(page).to have_current_path(admin_procedure_instructeurs_path(Procedure.last))
|
||||
fill_in 'gestionnaire_email', with: 'gestionnaire@apientreprise.fr'
|
||||
click_on 'add-gestionnaire-email'
|
||||
page.first('.gestionnaire-affectation').click
|
||||
|
||||
click_on 'onglet-infos'
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
expect(page).to have_selector('#publish-procedure', visible: true)
|
||||
find('#publish-procedure').click
|
||||
|
||||
within '#publish-modal' do
|
||||
expect(page).to have_field('procedure_path', with: 'lien-de-la-procedure')
|
||||
click_on 'publish'
|
||||
context 'With old PJ' do
|
||||
before do
|
||||
# Create a dummy PJ, because adding PJs is no longer allowed on procedures that
|
||||
# do not already have one
|
||||
Procedure.last.types_de_piece_justificative.create(libelle: "dummy PJ")
|
||||
end
|
||||
|
||||
expect(page).to have_text('Démarche publiée')
|
||||
expect(page).to have_selector('.procedure-lien')
|
||||
scenario 'Add champ, add file, visualize them in procedure preview' do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
click_on 'add_type_de_champ'
|
||||
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.last))
|
||||
expect(page).to have_selector('#procedure_types_de_champ_attributes_1_libelle')
|
||||
expect(Procedure.last.types_de_champ.first.libelle).to eq('libelle de champ')
|
||||
|
||||
click_on 'onglet-pieces'
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
fill_in 'procedure_types_de_piece_justificative_attributes_0_libelle', with: 'libelle de piece'
|
||||
click_on 'add_piece_justificative'
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
expect(page).to have_selector('#procedure_types_de_piece_justificative_attributes_1_libelle')
|
||||
|
||||
preview_window = window_opened_by { click_on 'onglet-preview' }
|
||||
within_window(preview_window) do
|
||||
expect(page).to have_current_path(apercu_procedure_path(Procedure.last))
|
||||
expect(page).to have_field('libelle de champ')
|
||||
expect(page).to have_field('libelle de piece')
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'After adding champ and file, check impossibility to publish procedure, add instructeur and make publication' do
|
||||
fill_in 'procedure_types_de_champ_attributes_0_libelle', with: 'libelle de champ'
|
||||
click_on 'add_type_de_champ'
|
||||
click_on 'onglet-pieces'
|
||||
|
||||
expect(page).to have_current_path(admin_procedure_pieces_justificatives_path(Procedure.last))
|
||||
fill_in 'procedure_types_de_piece_justificative_attributes_0_libelle', with: 'libelle de piece'
|
||||
click_on 'add_piece_justificative'
|
||||
|
||||
click_on 'onglet-infos'
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
expect(page).to have_selector('#disabled-publish-procedure')
|
||||
expect(page.find_by_id('disabled-publish-procedure')[:disabled]).to eq('true')
|
||||
|
||||
click_on 'onglet-instructeurs'
|
||||
expect(page).to have_current_path(admin_procedure_instructeurs_path(Procedure.last))
|
||||
fill_in 'gestionnaire_email', with: 'gestionnaire@apientreprise.fr'
|
||||
click_on 'add-gestionnaire-email'
|
||||
page.first('.gestionnaire-affectation').click
|
||||
|
||||
click_on 'onglet-infos'
|
||||
expect(page).to have_current_path(admin_procedure_path(Procedure.last))
|
||||
expect(page).to have_selector('#publish-procedure', visible: true)
|
||||
find('#publish-procedure').click
|
||||
|
||||
within '#publish-modal' do
|
||||
expect(page).to have_field('procedure_path', with: 'lien-de-la-procedure')
|
||||
click_on 'publish'
|
||||
end
|
||||
|
||||
expect(page).to have_text('Démarche publiée')
|
||||
expect(page).to have_selector('.procedure-lien')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue