Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-08-23 11:00:47 +02:00
commit e654d5c63f
51 changed files with 336 additions and 4991 deletions

View file

@ -6,12 +6,13 @@
// See config/browser.rb
"browsers": [
"> 1%",
"Chrome 40",
"IE 11",
"Edge 12",
"Firefox 45",
"Safari 8",
"iOS 8"
"Chrome >= 50",
"IE >= 11",
"Edge >= 14",
"Firefox >= 50",
"Opera >= 40",
"Safari >= 8",
"iOS >= 8"
],
"uglify": true
},

View file

@ -1,5 +1,7 @@
source 'https://rubygems.org'
# dotenv should always be loaded before rails
gem 'dotenv-rails', require: 'dotenv/rails-now'
gem 'rails'
# Use SCSS for stylesheets
@ -171,7 +173,5 @@ group :development, :test do
# Deploy
gem 'mina', ref: '343a7', git: 'https://github.com/mina-deploy/mina.git'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'dotenv-rails'
gem 'rspec_junit_formatter'
end

View file

@ -67,6 +67,12 @@ Dans le fichier `config/intializers/token.rb`, ajouter
*Note : les valeurs pour ces paramètres sont renseignées dans le Keepass*
## Bouchonnage de la configuration
Créer le fichier de configuration avec les valeurs par défaut :
cp config/env.example .env
## Lancement de l'application
overmind start

View file

@ -23,7 +23,6 @@
//= require franceconnect
//= require bootstrap-wysihtml5
//= require bootstrap-wysihtml5/locales/fr-FR
//= require handlebars
$(document).on('turbolinks:load', application_init);

View file

@ -57,32 +57,7 @@ function validatePath(path) {
}
function path_type_init() {
display = 'label';
var bloodhound = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(display),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/admin/procedures/path_list?request=%QUERY',
wildcard: '%QUERY'
}
});
bloodhound.initialize();
$("#procedure_path").typeahead({
minLength: 1
}, {
display: display,
source: bloodhound,
templates: {
empty: 'Ce lien est disponible !',
suggestion: Handlebars.compile("<div class='path-mine-{{mine}}'>{{label}}</div>")
},
limit: 5
});
$('#procedure_path').bind('typeahead:select', function(ev, suggestion) {
$('#procedure_path').bind('autocomplete:select', function(ev, suggestion) {
togglePathMessage(true, suggestion['mine']);
});
}

View file

@ -148,8 +148,8 @@ function jsObject_to_array(qp_list) {
}
function add_event_search_address() {
$("#search-by-address input[type='address']").bind('typeahead:select', function (ev, seggestion) {
get_address_point(seggestion['label']);
$("#search-by-address input[type='address']").bind('autocomplete:select', function (ev, suggestion) {
get_address_point(suggestion['label']);
});
$("#search-by-address input[type='address']").keypress(function (e) {

View file

@ -9,16 +9,16 @@
}
#publish-modal {
.twitter-typeahead {
.algolia-autocomplete {
width: 300px;
}
.tt-menu {
.aa-dropdown-menu {
width: 300px;
}
// Fix the input not being displayed on the same line than the text before
.tt-input {
.aa-input {
vertical-align: initial !important;
}
}

View file

@ -40,7 +40,7 @@
// = require siret
// = require support_navigator_banner
// = require switch_menu
// = require typeahead
// = require autocomplete
// = require users
// = require attestation_template_edit
// = require attestation_recapitulatif

View file

@ -0,0 +1,33 @@
.algolia-autocomplete {
width: 100%;
}
.algolia-autocomplete .aa-input,
.algolia-autocomplete .aa-hint {
width: 100%;
}
.algolia-autocomplete .aa-hint {
color: #999999;
}
.algolia-autocomplete .aa-dropdown-menu {
width: 100%;
background-color: #FFFFFF;
border: 1px solid #999999;
border-top: none;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion {
cursor: pointer;
padding: 5px 4px;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion.aa-cursor {
background-color: #B2D7FF;
}
.algolia-autocomplete .aa-dropdown-menu .aa-suggestion em {
font-weight: bold;
font-style: normal;
}

View file

@ -121,11 +121,11 @@
}
#search-by-address {
.twitter-typeahead {
.algolia-autocomplete {
width: 555px;
}
.tt-menu {
.aa-dropdown-menu {
width: 555px;
}
}

View file

@ -45,7 +45,7 @@
@extend .col-md-6;
@extend .col-lg-6;
.twitter-typeahead {
.algolia-autocomplete {
width: 100%;
input {
@ -54,7 +54,7 @@
}
}
.tt-menu {
.aa-dropdown-menu {
width: 100%;
}
}

View file

@ -1,5 +1,6 @@
$blue: #0069CC;
$light-blue: #1C7EC9;
$lighter-blue: #C3D9FF;
$black: #333333;
$grey: #999999;
$light-grey: #F8F8F8;

View file

@ -228,18 +228,18 @@
// scss-lint:enable
}
.twitter-typeahead {
.algolia-autocomplete {
margin-bottom: 2 * $default-padding;
}
input.tt-input,
input.tt-hint {
input.aa-input,
input.aa-hint {
border-radius: 4px;
border: solid 1px $border-grey;
padding: $default-padding;
}
input.tt-hint {
input.aa-hint {
color: $grey;
}

View file

@ -5,6 +5,6 @@
// = require ./fonts
// = require leaflet.1.1.0
// = require select2
// = require typeahead
// = require autocomplete
// = require_tree .
// = stub ./print.scss

View file

@ -14,7 +14,7 @@
z-index: 1000;
a {
color: #C3D9FF;
color: $lighter-blue;
text-decoration: underline;
}
}

View file

@ -1,29 +0,0 @@
.twitter-typeahead {
width: 100%; // http://stackoverflow.com/questions/17957513/extending-the-width-of-bootstrap-typeahead-to-match-input-field
}
.tt-menu {
padding: 8px 0;
background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 8px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.tt-suggestion {
padding: 3px 20px;
font-size: 18px;
line-height: 24px;
}
.tt-suggestion:hover {
cursor: pointer;
color: #FFFFFF;
background-color: #0097CF;
}
.tt-suggestion.tt-cursor {
color: #FFFFFF;
background-color: #0097CF;
}

View file

@ -50,6 +50,10 @@ module ApplicationHelper
current_administrateur&.email
end
def staging?
ENV['APP_NAME'] == 'tps_dev'
end
def root_path_for_profile(nav_bar_profile)
case nav_bar_profile
when :gestionnaire

View file

@ -0,0 +1,15 @@
module TabsHelper
def tab_item(label, url, active: false, badge: nil, notification: false)
render partial: 'shared/tab_item', locals: {
label: label,
url: url,
active: active,
badge: badge,
notification: notification
}
end
def active_tab_item(label, url, badge: nil, notification: false)
tab_item(label, url, active: current_page?(url), badge: badge, notification: notification)
end
end

View file

@ -1,37 +1,35 @@
import $ from 'jquery';
addEventListener('turbolinks:load', () => {
$('[data-siret]').on('input', evt => {
$(document).on('input', '[data-siret]', evt => {
const input = $(evt.target);
const value = input.val();
const url = input.attr('data-siret');
const url = input.data('siret');
switch (value.length) {
case 0:
input.removeAttr('data-invalid');
$.get(`${url}?siret=blank`);
input.removeData('invalid');
$.get(url, { siret: 'blank' });
break;
case 14:
input.attr('disabled', 'disabled');
input.attr('disabled', true);
$('.spinner').show();
$.get(`${url}?siret=${value}`).then(
$.get(url, { siret: value }).then(
() => {
input.removeAttr('data-invalid');
input.removeData('invalid');
input.removeAttr('disabled');
$('.spinner').hide();
},
() => {
input.removeAttr('disabled');
input.attr('data-invalid', true);
input.data('invalid', true);
$('.spinner').hide();
}
);
break;
default:
if (!input.attr('data-invalid')) {
input.attr('data-invalid', true);
$.get(`${url}?siret=invalid`);
if (!input.data('invalid')) {
input.data('invalid', true);
$.get(url, { siret: 'invalid' });
}
}
});
});

View file

@ -1,4 +1,5 @@
import $ from 'jquery';
import 'select2';
addEventListener('turbolinks:load', () => {
$('select.select2').select2({

View file

@ -1,9 +1,6 @@
import Turbolinks from 'turbolinks';
import Rails from 'rails-ujs';
import ActiveStorage from '../shared/activestorage/ujs';
import Chartkick from 'chartkick';
import Highcharts from 'highcharts';
import Bloodhound from 'bloodhound-js';
import jQuery from 'jquery';
// Include runtime-polyfills for older browsers.
@ -11,14 +8,11 @@ import jQuery from 'jquery';
// required by the browsers we support will be included.
import 'babel-polyfill';
import 'typeahead.js';
import '../shared/sentry';
import '../shared/rails-ujs-fix';
import '../shared/champs/address';
import '../shared/autocomplete';
// Start Rails helpers
Chartkick.addAdapter(Highcharts);
Rails.start();
Turbolinks.start();
ActiveStorage.start();
@ -28,9 +22,6 @@ if (process.env['RAILS_ENV'] === 'test') {
jQuery.fx.off = true;
}
// Expose globals
window.Bloodhound = Bloodhound;
window.Chartkick = Chartkick;
// Export jQuery globally for legacy Javascript files used in the old design
jQuery.rails = Rails;
window.$ = jQuery;

View file

@ -10,20 +10,17 @@ import jQuery from 'jquery';
// required by the browsers we support will be included.
import 'babel-polyfill';
import 'select2';
import 'typeahead.js';
import '../shared/sentry';
import '../shared/rails-ujs-fix';
import '../shared/champs/address';
import '../shared/autocomplete';
import '../new_design/buttons';
import '../new_design/form-validation';
import '../new_design/carto';
import '../new_design/select2';
import '../new_design/champs/dossier-link';
import '../new_design/champs/linked-drop-down-list';
import '../new_design/champs/multiple-drop-down-list';
import '../new_design/champs/siret';
import { toggleCondidentielExplanation } from '../new_design/avis';

View file

@ -0,0 +1,47 @@
import $ from 'jquery';
import autocomplete from 'autocomplete.js';
const sources = [
{
type: 'address',
url: '/ban/search'
},
{
type: 'path',
url: '/admin/procedures/path_list'
}
];
const options = {
autoselect: true,
minLength: 1
};
function selector(type) {
return `[data-autocomplete=${type}]`;
}
function source(url) {
return {
source(query, callback) {
$.getJSON(url, { request: query }).then(callback);
},
templates: {
suggestion({ label, mine }) {
const mineClass = `path-mine-${mine ? 'true' : 'false'}`;
const openTag = `<div class="aa-suggestion ${mineClass}">`;
return autocomplete.escapeHighlightedString(label, openTag, '</div>');
}
}
};
}
addEventListener('turbolinks:load', function() {
for (let { type, url } of sources) {
let select = autocomplete(selector(type), options, [source(url)]);
select.on('autocomplete:selected', ({ target }, suggestion) => {
$(target).trigger('autocomplete:select', suggestion);
select.autocomplete.setVal(suggestion.label);
});
}
});

View file

@ -1,31 +0,0 @@
import $ from 'jquery';
import Bloodhound from 'bloodhound-js';
const display = 'label';
const bloodhound = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(display),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/ban/search?request=%QUERY',
wildcard: '%QUERY'
}
});
bloodhound.initialize();
function bindTypeahead() {
$('input[data-address="true"], input[type="address"]').typeahead(
{
minLength: 1
},
{
display: display,
source: bloodhound,
limit: 5
}
);
}
addEventListener('turbolinks:load', bindTypeahead);

View file

@ -24,3 +24,22 @@ addEventListener('load', () => {
return element.href || href(element);
};
});
// rails-ujs installs CSRFProtection for its own ajax implementation. We might need
// CSRFProtection for jQuery initiated requests. This code is from jquery-ujs.
jQuery.ajaxPrefilter((options, originalOptions, xhr) => {
if (!options.crossDomain) {
CSRFProtection(xhr);
}
});
function csrfToken() {
return jQuery('meta[name=csrf-token]').attr('content');
}
function CSRFProtection(xhr) {
let token = csrfToken();
if (token) {
xhr.setRequestHeader('X-CSRF-Token', token);
}
}

View file

@ -69,10 +69,11 @@ class Dossier < ApplicationRecord
delegate :france_connect_information, to: :user
before_validation :update_state_dates, if: -> { state_changed? }
before_save :build_default_champs, if: Proc.new { procedure_id_changed? }
before_save :build_default_individual, if: Proc.new { procedure.for_individual? }
before_save :update_search_terms
after_save :build_default_champs, if: Proc.new { saved_change_to_procedure_id? }
after_save :build_default_individual, if: Proc.new { procedure.for_individual? }
after_save :send_dossier_received
after_save :send_web_hook
after_create :send_draft_notification_email
@ -84,12 +85,12 @@ class Dossier < ApplicationRecord
user&.email,
france_connect_information&.given_name,
france_connect_information&.family_name,
*ordered_champs.flat_map(&:search_terms),
*champs.flat_map(&:search_terms),
*etablissement&.search_terms,
individual&.nom,
individual&.prenom
].compact.join(' ')
self.private_search_terms = ordered_champs_private.flat_map(&:search_terms).compact.join(' ')
self.private_search_terms = champs_private.flat_map(&:search_terms).compact.join(' ')
end
def was_piece_justificative_uploaded_for_type_id?(type_id)
@ -105,14 +106,17 @@ class Dossier < ApplicationRecord
end
def build_default_champs
procedure.all_types_de_champ.each do |type_de_champ|
type_de_champ.champ.create(dossier: self)
procedure.types_de_champ.each do |type_de_champ|
champs << type_de_champ.champ.build
end
procedure.types_de_champ_private.each do |type_de_champ|
champs_private << type_de_champ.champ.build
end
end
def build_default_individual
if Individual.where(dossier_id: self.id).count == 0
Individual.create(dossier: self)
build_individual
end
end

View file

@ -24,6 +24,7 @@
= text_field_tag('procedure_path', @procedure.default_path,
id: 'procedure_path',
placeholder: 'Chemin vers la procédure',
data: { autocomplete: 'path' },
class: 'form-control',
maxlength: 50,
style: 'width: 300px; display: inline;')

View file

@ -2,12 +2,10 @@
- if !browser.modern?
#support-navigator-banner.row
.col-xs-12
= browser.name
= browser.version
\-
Attention, votre navigateur est trop ancien pour utiliser Démarches Simplifiées : certaines parties du site ne fonctionneront pas correctement.
Attention, votre navigateur (#{browser.name} #{browser.version}) est trop ancien pour utiliser demarches-simplifiees.fr : certaines parties du site ne fonctionneront pas correctement.
%br/
%br/
Nous vous recommendons fortement de
%a{ href: "https://browser-update.org/fr/update.html" }mettre à jour votre navigateur
%a{ href: "https://browser-update.org/fr/update.html", target: "_blank" }mettre à jour votre navigateur
%span<>
\.

View file

@ -23,7 +23,7 @@
%body
= render partial: 'layouts/support_navigator_banner'
= render partial: 'layouts/pre_maintenance'
- if Rails.env == 'staging'
- if staging?
#beta
Env Test

View file

@ -29,7 +29,7 @@
.page-wrapper
= render partial: "layouts/support_navigator_banner"
= render partial: 'layouts/pre_maintenance'
- if Rails.env == "staging"
- if staging?
#beta
Env Test

View file

@ -3,13 +3,13 @@
%h1.page-title Prévisualisation de la procédure «&nbsp;#{@dossier.procedure.libelle}&nbsp;»
%ul.tabs
%li{ class: (@tab == 'dossier') ? 'active' : nil }>
= link_to(apercu_procedure_path(@dossier.procedure, tab: 'dossier')) do
le dossier
= tab_item('le dossier',
apercu_procedure_path(@dossier.procedure, tab: 'dossier'),
active: @tab == 'dossier')
- if @dossier.champs_private.size > 0
%li{ class: (@tab == 'annotations-privees') ? 'active' : nil }>
= link_to(apercu_procedure_path(@dossier.procedure, tab: 'annotations-privees')) do
les annotations privées
= tab_item('les annotations privées',
apercu_procedure_path(@dossier.procedure, tab: 'annotations-privees'),
active: @tab == 'annotations-privees')
- if @tab == 'dossier'
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: true }

View file

@ -5,11 +5,6 @@
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
%ul.tabs
%li{ class: current_page?(gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Demande', gestionnaire_avis_path(avis)
%li{ class: current_page?(instruction_gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Avis', instruction_gestionnaire_avis_path(avis)
- if avis.answer == nil
%span.notifications{ 'aria-label': 'notifications' }
%li{ class: current_page?(messagerie_gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Messagerie', messagerie_gestionnaire_avis_path(avis)
= active_tab_item('Demande', gestionnaire_avis_path(avis))
= active_tab_item('Avis', instruction_gestionnaire_avis_path(avis), notification: avis.answer.blank?)
= active_tab_item('Messagerie', messagerie_gestionnaire_avis_path(avis))

View file

@ -6,17 +6,16 @@
.width-100
%h1.tab-title Avis
%ul.tabs
%li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }>
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do
avis à donner
%span.badge= @avis_a_donner.count
- if @avis_a_donner.any?
%span.notifications
= tab_item('avis à donner',
gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS),
active: @statut == NewGestionnaire::AvisController::A_DONNER_STATUS,
badge: @avis_a_donner.count,
notification: @avis_a_donner.any?)
%li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }>
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do
avis #{'donné'.pluralize(@avis_donnes.count)}
%span.badge= @avis_donnes.count
= tab_item("avis #{'donné'.pluralize(@avis_donnes.count)}",
gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS),
active: @statut == NewGestionnaire::AvisController::DONNES_STATUS,
badge: @avis_donnes.count)
.container
- if @avis.present?

View file

@ -17,26 +17,28 @@
= render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
= render partial: "state_button", locals: { dossier: dossier }
%ul.tabs
- notifications_summary = current_gestionnaire.notifications_for_dossier(dossier)
%li{ class: current_page?(gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:demande]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Demande", gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:annotations_privees]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Annotations privées", annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:avis]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Avis externes", avis_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:messagerie]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Messagerie", messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Personnes impliquées", personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)
= active_tab_item('Demande',
gestionnaire_dossier_path(dossier.procedure, dossier),
notification: notifications_summary[:demande])
= active_tab_item('Annotations privées',
annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier),
notification: notifications_summary[:annotations_privees])
= active_tab_item('Avis externes',
avis_gestionnaire_dossier_path(dossier.procedure, dossier),
notification: notifications_summary[:avis])
= active_tab_item('Messagerie',
messagerie_gestionnaire_dossier_path(dossier.procedure, dossier),
notification: notifications_summary[:messagerie])
= active_tab_item('Personnes impliquées',
personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier))
.container
.print-header

View file

@ -9,35 +9,34 @@
.procedure-header
%h1= procedure_libelle @procedure
%ul.tabs
%li{ class: (@statut == 'a-suivre') ? 'active' : nil }>
= link_to(gestionnaire_procedure_path(@procedure, statut: 'a-suivre')) do
à suivre
%span.badge= @a_suivre_dossiers.count
= tab_item('à suivre',
gestionnaire_procedure_path(@procedure, statut: 'a-suivre'),
active: @statut == 'a-suivre',
badge: @a_suivre_dossiers.count)
%li{ class: (@statut == 'suivis') ? 'active' : nil }>
- if current_gestionnaire.notifications_for_procedure(@procedure).present?
%span.notifications{ 'aria-label': 'notifications' }
= link_to(gestionnaire_procedure_path(@procedure, statut: 'suivis')) do
= t('pluralize.followed', count: @followed_dossiers.count)
%span.badge= @followed_dossiers.count
= tab_item(t('pluralize.followed', count: @followed_dossiers.count),
gestionnaire_procedure_path(@procedure, statut: 'suivis'),
active: @statut == 'suivis',
badge: @followed_dossiers.count,
notification: current_gestionnaire.notifications_for_procedure(@procedure).present?)
%li{ class: (@statut == 'traites') ? 'active' : nil }>
- if current_gestionnaire.notifications_for_procedure(@procedure, :termine).present?
%span.notifications{ 'aria-label': 'notifications' }
= link_to(gestionnaire_procedure_path(@procedure, statut: 'traites')) do
= t('pluralize.processed', count: @termines_dossiers.count)
%span.badge= @termines_dossiers.count
= tab_item(t('pluralize.processed', count: @termines_dossiers.count),
gestionnaire_procedure_path(@procedure, statut: 'traites'),
active: @statut == 'traites',
badge: @termines_dossiers.count,
notification: current_gestionnaire.notifications_for_procedure(@procedure, :termine).present?)
%li{ class: (@statut == 'tous') ? 'active' : nil }>
= link_to(gestionnaire_procedure_path(@procedure, statut: 'tous')) do
tous les dossiers
%span.badge= @all_state_dossiers.count
= tab_item('tous les dossiers',
gestionnaire_procedure_path(@procedure, statut: 'tous'),
active: @statut == 'tous',
badge: @all_state_dossiers.count)
%li{ class: (@statut == 'archives') ? 'active' : nil }>
= link_to(gestionnaire_procedure_path(@procedure, statut: 'archives')) do
= t('pluralize.archived', count: @archived_dossiers.count)
%span.badge= @archived_dossiers.count
= tab_item(t('pluralize.archived', count: @archived_dossiers.count),
gestionnaire_procedure_path(@procedure, statut: 'archives'),
active: @statut == 'archives',
badge: @archived_dossiers.count)
.procedure-actions
= render partial: "download_dossiers", locals: { procedure: @procedure }

View file

@ -8,12 +8,13 @@
- else
%h1.page-title Dossiers
%ul.tabs
%li{ class: (@current_tab == 'mes-dossiers') ? 'active' : nil }>
= link_to(dossiers_path(current_tab: 'mes-dossiers')) do
mes dossiers
%li{ class: (@current_tab == 'dossiers-invites') ? 'active' : nil }>
= link_to(dossiers_path(current_tab: 'dossiers-invites')) do
dossiers invités
= tab_item('mes dossiers',
dossiers_path(current_tab: 'mes-dossiers'),
active: @current_tab == 'mes-dossiers')
= tab_item('dossiers invités',
dossiers_path(current_tab: 'dossiers-invites'),
active: @current_tab == 'dossiers-invites')
.container
- if @dossiers.present?

View file

@ -8,7 +8,5 @@
%h2 Dossier nº #{dossier.id}
%ul.tabs
%li{ class: current_page?(dossier_path(dossier)) ? 'active' : nil }
= link_to "Résumé", dossier_path(dossier)
%li{ class: current_page?(formulaire_dossier_path(dossier)) ? 'active' : nil }
= link_to "Formulaire", formulaire_dossier_path(dossier)
= active_tab_item('Résumé', dossier_path(dossier))
= active_tab_item('Formulaire', formulaire_dossier_path(dossier))

View file

@ -168,14 +168,10 @@
.container
Titre
%ul.tabs
%li.active
= link_to "Onglet actif", "#"
%li
= link_to "Onglet inactif", "#"
%li
= link_to "#" do
Onglet avec badge
%span.badge 2
= tab_item("Onglet actif", "#", active: true)
= tab_item("Onglet inactif", "#")
= tab_item("Onglet avec badge", "#", badge: 2)
= tab_item("Onglet avec notification", "#", notification: true)
.container
%h1 Breadcrumbs

View file

@ -0,0 +1,7 @@
%li{ class: (active ? 'active' : nil) }
- if notification
%span.notifications{ 'aria-label': 'notifications' }
= link_to(url) do
= label
- if badge.present?
%span.badge= badge

View file

@ -1,4 +1,4 @@
= form.text_field :value,
'data-address': 'true',
data: { address: true, autocomplete: 'address' },
placeholder: champ.libelle,
required: champ.mandatory?

View file

@ -12,7 +12,7 @@
Ajouter une zone
%span#search-by-address{ style: 'margin-left: 20px;' }
%input.form-control{ type: :address, placeholder: 'Rechercher une adresse' }
%input.form-control{ type: :address, data: { autocomplete: 'address' }, placeholder: 'Rechercher une adresse' }
%br
%br

View file

@ -6,6 +6,8 @@ require 'rails/all'
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
Dotenv::Railtie.load
module TPS
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
@ -27,13 +29,7 @@ module TPS
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
config.assets.precompile += %w(.woff)
if Rails.env.production?
URL = "https://www.demarches-simplifiees.fr/"
elsif Rails.env.staging?
URL = "https://dev.demarches-simplifiees.fr/"
else
URL = "http://localhost:3000/"
end
URL = ENV['APP_HOST'] || "http://localhost:3000/"
config.active_job.queue_adapter = :delayed_job

View file

@ -58,7 +58,6 @@ set :shared_paths, [
"config/fog_credentials.yml",
'config/storage.yml',
'config/initializers/secret_token.rb',
'config/initializers/features.yml',
"config/environments/#{rails_env}.rb",
"config/initializers/token.rb",
"config/unicorn.rb",

2
config/env.example Normal file
View file

@ -0,0 +1,2 @@
APP_NAME="tps_local"
APP_HOST="http://localhost:3000/"

View file

@ -1,8 +1,8 @@
# See .babelrc
Browser.modern_rules.clear
Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 40 }
Browser.modern_rules << -> b { b.ie?([">=11"]) }
Browser.modern_rules << -> b { b.edge? }
Browser.modern_rules << -> b { b.firefox? && b.version.to_i >= 45 }
Browser.modern_rules << -> b { b.opera? && b.version.to_i >= 19 }
Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 50 }
Browser.modern_rules << -> b { b.ie? && b.version.to_i >= 11 && !b.compatibility_view? }
Browser.modern_rules << -> b { b.edge? && b.version.to_i >= 14 && !b.compatibility_view? }
Browser.modern_rules << -> b { b.firefox? && b.version.to_i >= 50 }
Browser.modern_rules << -> b { b.opera? && b.version.to_i >= 40 }
Browser.modern_rules << -> b { b.safari? && b.version.to_i >= 8 }

View file

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

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_08_08_142237) do
ActiveRecord::Schema.define(version: 2018_08_22_162952) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -158,16 +158,6 @@ ActiveRecord::Schema.define(version: 2018_08_08_142237) do
t.datetime "updated_at"
end
create_table "cerfas", id: :serial, force: :cascade do |t|
t.string "content"
t.integer "dossier_id"
t.datetime "created_at"
t.integer "user_id"
t.string "original_filename"
t.string "content_secure_token"
t.index ["dossier_id"], name: "index_cerfas_on_dossier_id"
end
create_table "champs", id: :serial, force: :cascade do |t|
t.string "value"
t.integer "type_de_champ_id"
@ -629,7 +619,6 @@ ActiveRecord::Schema.define(version: 2018_08_08_142237) do
add_foreign_key "attestation_templates", "procedures"
add_foreign_key "attestations", "dossiers"
add_foreign_key "avis", "gestionnaires", column: "claimant_id"
add_foreign_key "cerfas", "dossiers"
add_foreign_key "closed_mails", "procedures"
add_foreign_key "commentaires", "dossiers"
add_foreign_key "dossiers", "users"

View file

@ -3,15 +3,14 @@
"@rails/webpacker": "4.0.0-pre.2",
"@sentry/browser": "^4.0.0-beta.12",
"activestorage": "^5.2.0",
"bloodhound-js": "^1.2.2",
"autocomplete.js": "^0.31.0",
"chartkick": "^2.3.6",
"highcharts": "^6.1.1",
"jquery": "^3.3.1",
"leaflet": "^1.3.1",
"rails-ujs": "^5.2.0",
"select2": "^4.0.6-rc.1",
"turbolinks": "^5.1.1",
"typeahead.js": "^0.11.1"
"turbolinks": "^5.1.1"
},
"devDependencies": {
"eslint": "^5.2.0",

View file

@ -39,16 +39,30 @@ describe Dossier do
let(:dossier) { create(:dossier, etablissement: etablissement, user: user, procedure: procedure) }
let(:france_connect_information) { build(:france_connect_information, given_name: 'Chris', family_name: 'Harrisson') }
let(:user) { build(:user, france_connect_information: france_connect_information) }
let(:champ_public) { dossier.champs.first }
let(:champ_private) { dossier.champs_private.first }
before do
dossier.champs.each { |c| c.update_attribute(:value, "champ public") }
dossier.champs_private.each { |c| c.update_attribute(:value, "champ privé") }
champ_public.update_attribute(:value, "champ public")
champ_private.update_attribute(:value, "champ privé")
dossier.update_search_terms
end
it { expect(dossier.search_terms).to eq("#{user.email} #{france_connect_information.given_name} #{france_connect_information.family_name} champ public #{etablissement.entreprise_siren} #{etablissement.entreprise_numero_tva_intracommunautaire} #{etablissement.entreprise_forme_juridique} #{etablissement.entreprise_forme_juridique_code} #{etablissement.entreprise_nom_commercial} #{etablissement.entreprise_raison_sociale} #{etablissement.entreprise_siret_siege_social} #{etablissement.entreprise_nom} #{etablissement.entreprise_prenom} #{etablissement.association_rna} #{etablissement.association_titre} #{etablissement.association_objet} #{etablissement.siret} #{etablissement.naf} #{etablissement.libelle_naf} #{etablissement.adresse} #{etablissement.code_postal} #{etablissement.localite} #{etablissement.code_insee_localite}") }
it { expect(dossier.private_search_terms).to eq('champ privé') }
context 'with an update' do
before do
dossier.update(
champs_attributes: [{ id: champ_public.id, value: 'nouvelle valeur publique' }],
champs_private_attributes: [{ id: champ_private.id, value: 'nouvelle valeur privee' }]
)
end
it { expect(dossier.search_terms).to include('nouvelle valeur publique') }
it { expect(dossier.private_search_terms).to include('nouvelle valeur privee') }
end
end
describe '#types_de_piece_justificative' do

File diff suppressed because one or more lines are too long

110
yarn.lock
View file

@ -488,7 +488,7 @@ async-foreach@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"
async@^1.4.0, async@^1.5.0, async@^1.5.2:
async@^1.5.0, async@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
@ -506,6 +506,12 @@ atob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a"
autocomplete.js@^0.31.0:
version "0.31.0"
resolved "https://registry.yarnpkg.com/autocomplete.js/-/autocomplete.js-0.31.0.tgz#2387c4e9759dbfd03558777705f6f14a66ba446c"
dependencies:
immediate "^3.2.3"
autoprefixer@^6.3.1:
version "6.7.7"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.7.tgz#1dbd1c835658e35ce3f9984099db00585c782014"
@ -1235,15 +1241,6 @@ block-stream@*:
dependencies:
inherits "~2.0.0"
bloodhound-js@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/bloodhound-js/-/bloodhound-js-1.2.2.tgz#47c2791a524f8c6606133fd5d947a01903da7d50"
dependencies:
es6-promise "^3.0.2"
object-assign "^4.0.1"
storage2 "^0.1.0"
superagent "^1.2.0"
bluebird@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9"
@ -1820,7 +1817,7 @@ commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
component-emitter@^1.2.1, component-emitter@~1.2.0:
component-emitter@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6"
@ -1903,10 +1900,6 @@ cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
cookiejar@2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.0.6.tgz#0abf356ad00d1c5a219d88d44518046dd026acfe"
copy-concurrently@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
@ -2144,7 +2137,7 @@ dateformat@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
debug@2, debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
dependencies:
@ -2456,10 +2449,6 @@ es6-iterator@~2.0.3:
es5-ext "^0.10.35"
es6-symbol "^3.1.1"
es6-promise@^3.0.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"
es6-symbol@^3.1.1, es6-symbol@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
@ -2708,10 +2697,6 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2:
assign-symbols "^1.0.0"
is-extendable "^1.0.1"
extend@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4"
extend@~3.0.0, extend@~3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
@ -2945,14 +2930,6 @@ forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
form-data@1.0.0-rc3:
version "1.0.0-rc3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-1.0.0-rc3.tgz#d35bc62e7fbc2937ae78f948aaa0d38d90607577"
dependencies:
async "^1.4.0"
combined-stream "^1.0.5"
mime-types "^2.1.3"
form-data@~2.1.1:
version "2.1.4"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1"
@ -2969,10 +2946,6 @@ form-data@~2.3.1:
combined-stream "1.0.6"
mime-types "^2.1.12"
formidable@~1.0.14:
version "1.0.17"
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.17.tgz#ef5491490f9433b705faa77249c99029ae348559"
forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
@ -3553,6 +3526,10 @@ ignore@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.2.tgz#0a8dd228947ec78c2d7f736b1642a9f7317c1905"
immediate@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c"
import-cwd@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9"
@ -3926,10 +3903,6 @@ is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@ -3983,7 +3956,7 @@ jquery-mousewheel@~3.1.13:
version "3.1.13"
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
jquery@>=1.7, jquery@^3.3.1:
jquery@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
@ -4482,7 +4455,7 @@ merge2@^1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.2.tgz#03212e3da8d86c4d8523cebd6318193414f94e34"
methods@~1.1.1, methods@~1.1.2:
methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
@ -4537,16 +4510,12 @@ mime-db@~1.33.0:
version "1.33.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
mime-types@^2.1.12, mime-types@^2.1.3, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.7:
mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.7:
version "2.1.18"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8"
dependencies:
mime-db "~1.33.0"
mime@1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53"
mime@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
@ -5906,10 +5875,6 @@ q@^1.1.2:
version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
qs@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404"
qs@6.5.1:
version "6.5.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8"
@ -6051,15 +6016,6 @@ read-pkg@^3.0.0:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
readable-stream@1.0.27-1:
version "1.0.27-1"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.27-1.tgz#6b67983c20357cefd07f0165001a16d710d91078"
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"
readdirp@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"
@ -6101,10 +6057,6 @@ redent@^1.0.0:
indent-string "^2.1.0"
strip-indent "^1.0.1"
reduce-component@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/reduce-component/-/reduce-component-1.0.1.tgz#e0c93542c574521bea13df0f9488ed82ab77c5da"
reduce-css-calc@^1.2.6, reduce-css-calc@^1.2.7:
version "1.3.0"
resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716"
@ -6828,10 +6780,6 @@ stdout-stream@^1.4.0:
dependencies:
readable-stream "^2.0.1"
storage2@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/storage2/-/storage2-0.1.0.tgz#a2215c6c479d1c84df006a58ef5525e5d8cea00e"
stream-browserify@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db"
@ -6899,10 +6847,6 @@ string_decoder@^1.0.0, string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
stringstream@~0.0.4:
version "0.0.6"
resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.6.tgz#7880225b0d4ad10e30927d167a1d6f2fd3b33a72"
@ -6961,22 +6905,6 @@ style-loader@^0.20.3:
loader-utils "^1.1.0"
schema-utils "^0.4.5"
superagent@^1.2.0:
version "1.8.5"
resolved "https://registry.yarnpkg.com/superagent/-/superagent-1.8.5.tgz#1c0ddc3af30e80eb84ebc05cb2122da8fe940b55"
dependencies:
component-emitter "~1.2.0"
cookiejar "2.0.6"
debug "2"
extend "3.0.0"
form-data "1.0.0-rc3"
formidable "~1.0.14"
methods "~1.1.1"
mime "1.3.4"
qs "2.3.3"
readable-stream "1.0.27-1"
reduce-component "1.0.1"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
@ -7179,12 +7107,6 @@ type-is@~1.6.15, type-is@~1.6.16:
media-typer "0.3.0"
mime-types "~2.1.18"
typeahead.js@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/typeahead.js/-/typeahead.js-0.11.1.tgz#4e64e671b22310a8606f4aec805924ba84b015b8"
dependencies:
jquery ">=1.7"
typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"