Merge branch 'develop' into admin_can_modify_procedure_description_after_published
This commit is contained in:
commit
ff9c95f18e
10 changed files with 105 additions and 40 deletions
21
app/assets/stylesheets/_helpers.scss
Normal file
21
app/assets/stylesheets/_helpers.scss
Normal file
|
@ -0,0 +1,21 @@
|
|||
$default-spacer: 15px;
|
||||
|
||||
.m-1 {
|
||||
margin: $default-spacer;
|
||||
}
|
||||
|
||||
.mt-1 {
|
||||
margin-top: $default-spacer;
|
||||
}
|
||||
|
||||
.mr-1 {
|
||||
margin-right: $default-spacer;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: $default-spacer;
|
||||
}
|
||||
|
||||
.ml-1 {
|
||||
margin-left: $default-spacer;
|
||||
}
|
|
@ -3,10 +3,6 @@
|
|||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@import "bootstrap";
|
||||
|
||||
table {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#carte_page {
|
||||
#map {
|
||||
@extend .col-md-12;
|
||||
|
|
|
@ -30,7 +30,7 @@ class Procedure < ActiveRecord::Base
|
|||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||
|
||||
after_save :build_default_mails, if: Proc.new { id_changed? }
|
||||
after_create :build_default_mails
|
||||
|
||||
def build_default_mails
|
||||
MailReceived.create(procedure: self) unless mail_received
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
= f.button :submit, 'Mettre à jour', class: "btn-success"
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
.col-md-8
|
||||
%table.table
|
||||
%tr
|
||||
%th
|
||||
|
@ -23,8 +23,6 @@
|
|||
%tr
|
||||
%td.center
|
||||
%b.text-success
|
||||
\--
|
||||
= balise.first
|
||||
\--
|
||||
= "--#{balise.first}--"
|
||||
%td
|
||||
=balise.second[:description]
|
||||
|
|
|
@ -25,9 +25,10 @@
|
|||
Fichier accepté : JPG / JPEG / PNG
|
||||
.col-md-6
|
||||
%h4 Drapeau européen
|
||||
%label
|
||||
=f.check_box :euro_flag
|
||||
Afficher le drapeau européen
|
||||
.checkbox
|
||||
%label
|
||||
=f.check_box :euro_flag
|
||||
Afficher le drapeau européen
|
||||
|
||||
- unless @procedure.locked?
|
||||
.row
|
||||
|
@ -35,33 +36,37 @@
|
|||
%h4 Cartographie
|
||||
|
||||
= f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
|
||||
%label
|
||||
=ff.check_box :use_api_carto, id: :procedure_module_api_carto_use_api_carto
|
||||
Utilisation de la cartographie
|
||||
.checkbox
|
||||
%label
|
||||
=ff.check_box :use_api_carto, id: :procedure_module_api_carto_use_api_carto
|
||||
Utilisation de la cartographie
|
||||
|
||||
%ul#modules_api_carto
|
||||
%li
|
||||
%label
|
||||
= ff.check_box :quartiers_prioritaires
|
||||
Quartiers Prioritaires
|
||||
.checkbox
|
||||
%label
|
||||
= ff.check_box :quartiers_prioritaires
|
||||
Quartiers Prioritaires
|
||||
%li
|
||||
%label
|
||||
= ff.check_box :cadastre
|
||||
Cadastre
|
||||
.checkbox
|
||||
%label
|
||||
= ff.check_box :cadastre
|
||||
Cadastre
|
||||
|
||||
.col-md-6
|
||||
- if @procedure.cerfa_flag
|
||||
%h4 Formulaire de demande ou CERFA
|
||||
%label
|
||||
=f.check_box :cerfa_flag
|
||||
Activer l'envoi de formulaire de demande ou CERFA
|
||||
.checkbox
|
||||
%label
|
||||
= f.check_box :cerfa_flag
|
||||
Activer l'envoi de formulaire de demande ou CERFA
|
||||
%br
|
||||
=f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)'
|
||||
= f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)'
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
%h4 Particuliers
|
||||
%div
|
||||
.checkbox
|
||||
%label
|
||||
=f.check_box :for_individual
|
||||
Cette procédure s'adresse à un public qui
|
||||
|
@ -69,8 +74,9 @@
|
|||
ne possède pas (ou pas encore) de numéro SIRET,
|
||||
qui doivent donc s'identifier en tant que personne physique.
|
||||
|
||||
%ul#individual_with_siret{style:'margin-top: 8px'}
|
||||
%li
|
||||
%ul#individual_with_siret
|
||||
%li
|
||||
.checkbox
|
||||
%label
|
||||
=f.check_box :individual_with_siret
|
||||
= f.check_box :individual_with_siret
|
||||
Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
|
||||
|
|
|
@ -70,18 +70,18 @@
|
|||
Champs
|
||||
.badge.progress-bar-info
|
||||
= @facade.procedure.types_de_champ.size
|
||||
- @facade.procedure.types_de_champ.order(:order_place).each do |champ|
|
||||
= champ.libelle
|
||||
%br
|
||||
%ul
|
||||
- @facade.procedure.types_de_champ.order(:order_place).each do |champ|
|
||||
%li= champ.libelle
|
||||
|
||||
.champs_private.col-xs-6.col-md-3
|
||||
%h4.text-info
|
||||
Champs privés
|
||||
.badge.progress-bar-info
|
||||
= @facade.procedure.types_de_champ_private.size
|
||||
- @facade.procedure.types_de_champ_private.order(:order_place).each do |champ|
|
||||
= champ.libelle
|
||||
%br
|
||||
%ul
|
||||
- @facade.procedure.types_de_champ_private.order(:order_place).each do |champ|
|
||||
%li= champ.libelle
|
||||
|
||||
.pieces_justificatives.col-xs-6.col-md-3
|
||||
%h4.text-info
|
||||
|
|
11
db/migrate/20170215102943_remove_duplicate_email_received.rb
Normal file
11
db/migrate/20170215102943_remove_duplicate_email_received.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
all_mails = MailReceived.all
|
||||
groupped = all_mails.group_by { |m| m.procedure_id }
|
||||
filtered = groupped.reject { |k, v| v.length < 2 }
|
||||
filtered.each do |k, duplicate_mails|
|
||||
duplicate_mails.pop
|
||||
duplicate_mails.each(&:destroy)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddTimestampsToMailTemplate < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :mail_templates, :created_at, :datetime
|
||||
add_column :mail_templates, :updated_at, :datetime
|
||||
end
|
||||
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170125152856) do
|
||||
ActiveRecord::Schema.define(version: 20170215142944) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -234,10 +234,12 @@ ActiveRecord::Schema.define(version: 20170125152856) do
|
|||
end
|
||||
|
||||
create_table "mail_templates", force: :cascade do |t|
|
||||
t.string "object"
|
||||
t.text "body"
|
||||
t.string "type"
|
||||
t.integer "procedure_id"
|
||||
t.string "object"
|
||||
t.text "body"
|
||||
t.string "type"
|
||||
t.integer "procedure_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "module_api_cartos", force: :cascade do |t|
|
||||
|
|
25
spec/migrations/remove_duplicate_email_received_spec.rb
Normal file
25
spec/migrations/remove_duplicate_email_received_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
load 'spec/spec_helper.rb'
|
||||
load 'db/migrate/20170215102943_remove_duplicate_email_received.rb'
|
||||
|
||||
describe RemoveDuplicateEmailReceived do
|
||||
context 'with one procedure and one associated mail_received' do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
it 'keeps the procedure mails' do
|
||||
RemoveDuplicateEmailReceived.new.change
|
||||
expect(MailReceived.count).to eq(1)
|
||||
end
|
||||
|
||||
context 'and another mail_received' do
|
||||
before :each do
|
||||
MailReceived.create!(procedure: procedure)
|
||||
end
|
||||
|
||||
it 'destroys the unecessary maiL_received' do
|
||||
RemoveDuplicateEmailReceived.new.change
|
||||
expect(MailReceived.count).to eq(1)
|
||||
expect(procedure.mail_received).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue