Can be check TypeDeChamps with attribut mandatory

This commit is contained in:
Xavier J 2016-03-15 11:23:25 +01:00
parent 26431ac528
commit 494f80afff
4 changed files with 13 additions and 2 deletions

View file

@ -19,7 +19,7 @@ class Admin::TypesDeChampController < AdminController
end
def update_params
params.require(:procedure).permit(types_de_champ_attributes: [:libelle, :description, :order_place, :type_champ, :id])
params.require(:procedure).permit(types_de_champ_attributes: [:libelle, :description, :order_place, :type_champ, :id, :mandatory])
end
def move_up

View file

@ -9,6 +9,11 @@
.form-group
%h4 Description
= ff.text_area :description, class: 'form-control description', placeholder: 'Description'
.form-group
%h4 Obligatoire ?
.center
= ff.check_box :mandatory, placeholder: 'Obligatoire ?'
.form-group
= ff.hidden_field :order_place, value: ff.index
= ff.hidden_field :id

View file

@ -0,0 +1,5 @@
class AddMandatoryToTypeDeChamps < ActiveRecord::Migration
def change
add_column :types_de_champ, :mandatory, :boolean, default: false
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160314161959) do
ActiveRecord::Schema.define(version: 20160315101245) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -244,6 +244,7 @@ ActiveRecord::Schema.define(version: 20160314161959) do
t.integer "order_place"
t.integer "procedure_id"
t.text "description"
t.boolean "mandatory", default: false
end
create_table "types_de_piece_justificative", force: :cascade do |t|