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

@ -31,4 +31,9 @@ function error_form_siret(invalid_siret){
function reset_form_siret(){
$("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider');
$("#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-lg-6;
input[type='address'] {
.twitter-typeahead {
width: 100%;
input {
width: 100%;
display: block !important;
}
}
.tt-menu {
width: 100%;
}
}
@ -44,6 +51,11 @@
@extend .col-lg-3;
}
.type_champ-yes_no {
@extend .col-md-3;
@extend .col-lg-3;
}
.type_champ-phone {
@extend .col-md-2;
@extend .col-lg-2;

View file

@ -89,20 +89,22 @@ class Admin::ProceduresController < AdminController
def publish
procedure = current_administrateur.procedures.find(params[:procedure_id])
test_procedure = ProcedurePath.new(
new_procedure_path = ProcedurePath.new(
{
path: params[:procedure_path],
procedure: procedure,
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'
return redirect_to admin_procedures_path
end
procedure_path = ProcedurePath.find_by_path(params[:procedure_path])
if (procedure_path)
if (procedure_path.administrateur_id == current_administrateur.id)
if procedure_path
if procedure_path.administrateur_id == current_administrateur.id
procedure_path.procedure.archive
else
@mine = false
@ -110,7 +112,8 @@ class Admin::ProceduresController < AdminController
end
end
procedure.publish(params[:procedure_path])
procedure.publish!(params[:procedure_path])
flash.notice = "Procédure publiée"
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_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :module_api_carto
accepts_nested_attributes_for :procedure_path
mount_uploader :logo, ProcedureLogoUploader
@ -76,7 +75,7 @@ class Procedure < ActiveRecord::Base
return procedure if procedure.save
end
def publish(path)
def publish!(path)
self.update_attributes!({ published: true, archived: false })
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)
end

View file

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

View file

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

View file

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

View file

@ -22,6 +22,7 @@
= 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 ..." }
- else
%br
#recap_info_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 } ) %>");
the_terms();
<% unless flash.empty? %>
<% if flash.empty? %>
$('.row.etape.etape_2').hide(300, render_new_siret);
$('.row.etape.etape_2').slideDown(400, the_terms);
toggle_etape_1();
<% else %>
error_form_siret('<%= invalid_siret %>');
<% 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!
%br
#form_login
= image_tag('logo-tps.png')
%br

View file

@ -23,6 +23,9 @@
- elsif champ.type_champ == 'datetime'
=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
%input.form-control{name:"champs['#{champ.id}']",
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!
%br
#form_login
= image_tag('logo-tps.png')
%br

View file

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

View file

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

View file

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

File diff suppressed because one or more lines are too long