Merge branch 'develop' into staging

This commit is contained in:
gregoirenovel 2017-04-13 15:35:20 +02:00
commit d0b4026793
4 changed files with 9 additions and 9 deletions

View file

@ -64,3 +64,7 @@ jobs:
if [ "${CIRCLE_BRANCH}" == "staging" ]; then if [ "${CIRCLE_BRANCH}" == "staging" ]; then
bundle exec rake deploy_ha bundle exec rake deploy_ha
fi fi
if [ "${CIRCLE_BRANCH}" == "master" ]; then
bundle exec rake deploy_ha to=production
fi

View file

@ -1,5 +1,5 @@
class Procedure < ActiveRecord::Base class Procedure < ActiveRecord::Base
has_many :types_de_piece_justificative, dependent: :destroy has_many :types_de_piece_justificative, -> { order "order_place ASC" }, dependent: :destroy
has_many :types_de_champ, class_name: 'TypeDeChampPublic', dependent: :destroy has_many :types_de_champ, class_name: 'TypeDeChampPublic', dependent: :destroy
has_many :types_de_champ_private, dependent: :destroy has_many :types_de_champ_private, dependent: :destroy
has_many :dossiers has_many :dossiers
@ -64,10 +64,6 @@ class Procedure < ActiveRecord::Base
types_de_champ_private.order(:order_place) types_de_champ_private.order(:order_place)
end end
def types_de_piece_justificative_ordered
types_de_piece_justificative.order(:order_place)
end
def self.active id def self.active id
Procedure.where(archived: false, published: true).find(id) Procedure.where(archived: false, published: true).find(id)
end end
@ -81,7 +77,7 @@ class Procedure < ActiveRecord::Base
end end
def switch_types_de_piece_justificative index_of_first_element def switch_types_de_piece_justificative index_of_first_element
switch_list_order(types_de_piece_justificative_ordered, index_of_first_element) switch_list_order(types_de_piece_justificative, index_of_first_element)
end end
def switch_list_order(list, index_of_first_element) def switch_list_order(list, index_of_first_element)

View file

@ -1,6 +1,6 @@
= form_for [:admin, @procedure], url: admin_procedure_pieces_justificatives_path(@procedure), remote: true do |f| = form_for [:admin, @procedure], url: admin_procedure_pieces_justificatives_path(@procedure), remote: true do |f|
#liste_piece_justificative #liste_piece_justificative
= render partial: 'fields', locals: { types_de_piece_justificative: @procedure.types_de_piece_justificative_ordered.decorate, f: f } = render partial: 'fields', locals: { types_de_piece_justificative: @procedure.types_de_piece_justificative.decorate, f: f }
= f.submit "Enregistrer", class: 'btn btn-success', id: :save = f.submit "Enregistrer", class: 'btn btn-success', id: :save
%hr %hr
#new_type_de_piece_justificative #new_type_de_piece_justificative

View file

@ -63,8 +63,8 @@ FactoryGirl.define do
trait :with_two_type_de_piece_justificative do trait :with_two_type_de_piece_justificative do
after(:build) do |procedure, _evaluator| after(:build) do |procedure, _evaluator|
rib = create(:type_de_piece_justificative, :rib) rib = create(:type_de_piece_justificative, :rib, order_place: 1)
msa = create(:type_de_piece_justificative, :msa) msa = create(:type_de_piece_justificative, :msa, order_place: 2)
procedure.types_de_piece_justificative << rib procedure.types_de_piece_justificative << rib
procedure.types_de_piece_justificative << msa procedure.types_de_piece_justificative << msa