Merge branch 'develop' into staging

This commit is contained in:
Xavier J 2016-07-18 11:23:18 +02:00
commit 67ce0b7969
19 changed files with 2521 additions and 29 deletions

View file

@ -32,3 +32,8 @@ function reset_form_siret(){
$("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider'); $("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider');
$("#dossier_siret").removeClass('input-error'); $("#dossier_siret").removeClass('input-error');
} }
function toggle_etape_1(){
$('.row.etape.etape_1 .etapes_menu #logos').toggle(100);
$('.row.etape.etape_1 .etapes_informations #description_procedure').toggle(100);
}

View file

@ -25,7 +25,14 @@
@extend .col-md-6; @extend .col-md-6;
@extend .col-lg-6; @extend .col-lg-6;
input[type='address'] { .twitter-typeahead {
width: 100%;
input {
width: 100%;
display: block !important;
}
}
.tt-menu {
width: 100%; width: 100%;
} }
} }
@ -44,6 +51,11 @@
@extend .col-lg-3; @extend .col-lg-3;
} }
.type_champ-yes_no {
@extend .col-md-3;
@extend .col-lg-3;
}
.type_champ-phone { .type_champ-phone {
@extend .col-md-2; @extend .col-md-2;
@extend .col-lg-2; @extend .col-lg-2;

View file

@ -89,20 +89,22 @@ class Admin::ProceduresController < AdminController
def publish def publish
procedure = current_administrateur.procedures.find(params[:procedure_id]) procedure = current_administrateur.procedures.find(params[:procedure_id])
test_procedure = ProcedurePath.new( new_procedure_path = ProcedurePath.new(
{ {
path: params[:procedure_path], path: params[:procedure_path],
procedure: procedure, procedure: procedure,
administrateur: procedure.administrateur administrateur: procedure.administrateur
}) })
unless test_procedure.validate if new_procedure_path.validate
new_procedure_path.delete
else
flash.alert = 'Lien de la procédure invalide' flash.alert = 'Lien de la procédure invalide'
return redirect_to admin_procedures_path return redirect_to admin_procedures_path
end end
procedure_path = ProcedurePath.find_by_path(params[:procedure_path]) procedure_path = ProcedurePath.find_by_path(params[:procedure_path])
if (procedure_path) if procedure_path
if (procedure_path.administrateur_id == current_administrateur.id) if procedure_path.administrateur_id == current_administrateur.id
procedure_path.procedure.archive procedure_path.procedure.archive
else else
@mine = false @mine = false
@ -110,7 +112,8 @@ class Admin::ProceduresController < AdminController
end end
end end
procedure.publish(params[:procedure_path]) procedure.publish!(params[:procedure_path])
flash.notice = "Procédure publiée" flash.notice = "Procédure publiée"
render js: "window.location = '#{admin_procedures_path}'" render js: "window.location = '#{admin_procedures_path}'"

View file

@ -17,7 +17,6 @@ class Procedure < ActiveRecord::Base
accepts_nested_attributes_for :types_de_champ,:reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true accepts_nested_attributes_for :types_de_champ,:reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :types_de_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true accepts_nested_attributes_for :types_de_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :module_api_carto accepts_nested_attributes_for :module_api_carto
accepts_nested_attributes_for :procedure_path
mount_uploader :logo, ProcedureLogoUploader mount_uploader :logo, ProcedureLogoUploader
@ -76,7 +75,7 @@ class Procedure < ActiveRecord::Base
return procedure if procedure.save return procedure if procedure.save
end end
def publish(path) def publish!(path)
self.update_attributes!({ published: true, archived: false }) self.update_attributes!({ published: true, archived: false })
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur) ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
end end

View file

@ -9,7 +9,8 @@ class TypeDeChamp < ActiveRecord::Base
civilite: 'civilite', civilite: 'civilite',
email: 'email', email: 'email',
phone: 'phone', phone: 'phone',
address: 'address' address: 'address',
yes_no: 'yes_no'
} }
belongs_to :procedure belongs_to :procedure

View file

@ -8,13 +8,7 @@
-#- if @facade.procedure.module_api_carto.use_api_carto? -#- if @facade.procedure.module_api_carto.use_api_carto?
-# .row.etape.etape_3 -# .row.etape.etape_3
-# .etape.etapes_menu.col-md-3.col-lg-3 -# = render partial: '/dossiers/etapes/etape3'
-# %h3
-# 3 - Ma zone d'intervention
-# .etape.etapes_informations.col-md-9.col-lg-9
-# -#
-#.row.etape.etape_4 -#.row.etape.etape_4
-# .etape.etapes_menu.col-md-3.col-lg-3 -# = render partial: '/dossiers/etapes/etape4'
-# %h3
-# = "#{@facade.procedure.module_api_carto.use_api_carto? ? '4' : '3'} - Mon dossier"
-# .etape.etapes_informations.col-md-9.col-lg-9

View file

@ -2,7 +2,8 @@
%h3 %h3
Ma procédure Ma procédure
%br %br
.center
#logos.center{class: (@facade.entreprise.nil? ? '' : 'mask')}
- if @facade.procedure.euro_flag - if @facade.procedure.euro_flag
#euro_flag.flag #euro_flag.flag
=image_tag('drapeau_europe.png') =image_tag('drapeau_europe.png')
@ -15,5 +16,5 @@
%h2#titre_procedure.text-info %h2#titre_procedure.text-info
= @facade.procedure.libelle = @facade.procedure.libelle
%p{style:'width: 95%;'} %p#description_procedure{style:'width: 95%;', class: (@facade.entreprise.nil? ? '' : 'mask')}
= h @facade.procedure.description.html_safe = h @facade.procedure.description.html_safe

View file

@ -22,6 +22,7 @@
= f.hidden_field :dossier_id, value: @facade.dossier.id = f.hidden_field :dossier_id, value: @facade.dossier.id
= f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." } = f.submit 'Valider', class: %w(btn btn-lg btn-success), data: { disable_with: "Recherche en cours ..." }
- else - else
%br
#recap_info_entreprise #recap_info_entreprise
= render partial: '/dossiers/infos_entreprise' = render partial: '/dossiers/infos_entreprise'

View file

@ -0,0 +1,6 @@
.etape.etapes_menu.col-md-3.col-lg-3
%h3
Ma zone d'intervention
.etape.etapes_informations.col-md-9.col-lg-9
.row

View file

@ -0,0 +1,6 @@
.etape.etapes_menu.col-md-3.col-lg-3
%h3
Mon dossier
.etape.etapes_informations.col-md-9.col-lg-9
.row

View file

@ -1,7 +1,14 @@
$('.row.etape.etape_2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2', locals: { facade: @facade } ) %>"); <% if flash.empty? %>
the_terms(); $('.row.etape.etape_2').hide(300, render_new_siret);
$('.row.etape.etape_2').slideDown(400, the_terms);
<% unless flash.empty? %> toggle_etape_1();
<% else %>
error_form_siret('<%= invalid_siret %>'); error_form_siret('<%= invalid_siret %>');
<% end %> <% end %>
<% flash.clear %> <% flash.clear %>
function render_new_siret(){
$('.row.etape.etape_2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2', locals: { facade: @facade } ) %>");
}

View file

@ -1,5 +1,6 @@
= devise_error_messages! = devise_error_messages!
%br
#form_login #form_login
= image_tag('logo-tps.png') = image_tag('logo-tps.png')
%br %br

View file

@ -23,6 +23,9 @@
- elsif champ.type_champ == 'datetime' - elsif champ.type_champ == 'datetime'
=render partial: 'users/description/champs/datetime', locals: {champ: champ} =render partial: 'users/description/champs/datetime', locals: {champ: champ}
- elsif champ.type_champ == 'yes_no'
=render partial: 'users/description/champs/yes_no', locals: {champ: champ}
-else -else
%input.form-control{name:"champs['#{champ.id}']", %input.form-control{name:"champs['#{champ.id}']",
placeholder: champ.libelle, placeholder: champ.libelle,

View file

@ -0,0 +1,7 @@
%label.radio-inline
= radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true'
Oui
%label.radio-inline
= radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false'
Non

View file

@ -28,6 +28,7 @@
= devise_error_messages! = devise_error_messages!
%br
#form_login #form_login
= image_tag('logo-tps.png') = image_tag('logo-tps.png')
%br %br

View file

@ -26,6 +26,8 @@ CarrierWave.configure do |config|
if Rails.env.production? if Rails.env.production?
config.fog_directory = "tps" config.fog_directory = "tps"
elsif Rails.env.development?
config.fog_directory= "test_local"
else else
config.fog_directory = "tps_dev" config.fog_directory = "tps_dev"
end end

View file

@ -58,7 +58,7 @@ FactoryGirl.define do
trait :published do trait :published do
after(:create) do |procedure, _evaluator| after(:create) do |procedure, _evaluator|
procedure.publish(generate(:published_path)) procedure.publish!(generate(:published_path))
end end
end end
end end

View file

@ -27,7 +27,7 @@ describe 'admin/procedures/show.html.haml', type: :view do
describe 'procedure is published' do describe 'procedure is published' do
before do before do
procedure.publish('fake_path') procedure.publish!('fake_path')
procedure.reload procedure.reload
render render
end end
@ -45,7 +45,7 @@ describe 'admin/procedures/show.html.haml', type: :view do
describe 'procedure is archived' do describe 'procedure is archived' do
before do before do
procedure.publish('fake_path') procedure.publish!('fake_path')
procedure.archive procedure.archive
procedure.reload procedure.reload
render render

File diff suppressed because one or more lines are too long