+
+
@@ -115,7 +132,7 @@
diff --git a/app/controllers/api/machines_controller.rb b/app/controllers/api/machines_controller.rb
index 0d5f3f6db..08379c96c 100644
--- a/app/controllers/api/machines_controller.rb
+++ b/app/controllers/api/machines_controller.rb
@@ -42,7 +42,7 @@ class API::MachinesController < API::ApiController
end
def machine_params
- params.require(:machine).permit(:name, :description, :spec, :plan_ids, plan_ids: [], machine_image_attributes: [:attachment],
+ params.require(:machine).permit(:name, :description, :spec, :disabled, :plan_ids, plan_ids: [], machine_image_attributes: [:attachment],
machine_files_attributes: [:id, :attachment, :_destroy])
end
diff --git a/app/views/api/machines/index.json.jbuilder b/app/views/api/machines/index.json.jbuilder
index 5f642ebe2..2ce82759c 100644
--- a/app/views/api/machines/index.json.jbuilder
+++ b/app/views/api/machines/index.json.jbuilder
@@ -1,5 +1,5 @@
json.array!(@machines) do |machine|
- json.extract! machine, :id, :name, :description, :spec, :slug
+ json.extract! machine, :id, :name, :description, :spec, :slug, :disabled
json.url machine_url(machine, format: :json)
json.machine_image machine.machine_image.attachment.medium.url if machine.machine_image
end
diff --git a/app/views/api/machines/show.json.jbuilder b/app/views/api/machines/show.json.jbuilder
index 4c47d943d..f49255956 100644
--- a/app/views/api/machines/show.json.jbuilder
+++ b/app/views/api/machines/show.json.jbuilder
@@ -1,4 +1,4 @@
-json.extract! @machine, :id, :name, :description, :spec, :created_at, :updated_at, :slug
+json.extract! @machine, :id, :name, :description, :spec, :disabled, :created_at, :updated_at, :slug
json.machine_image @machine.machine_image.attachment.large.url if @machine.machine_image
json.machine_files_attributes @machine.machine_files do |f|
json.id f.id
diff --git a/config/locales/app.shared.fr.yml b/config/locales/app.shared.fr.yml
index a147f9fe0..58fbe2f6e 100644
--- a/config/locales/app.shared.fr.yml
+++ b/config/locales/app.shared.fr.yml
@@ -144,11 +144,20 @@ fr:
machine:
# formulaire d'édition d'une machine
- technical_specifications_are_required: "Les caractéristiques techniques sont requises."
- attached_files_(pdf): "Pièces jointes (pdf)"
- attach_a_file: "Joindre un fichier"
- add_an_attachment: "Ajouter une pièce jointe"
- validate_your_machine: "Valider votre machine"
+ machine_form:
+ name: "Nom"
+ name_is_required: "Le nom est requis."
+ illustration: "Visuel"
+ add_an_illustration: "Ajouter un visuel"
+ description: "Description"
+ description_is_required: "La description est requise."
+ technical_specifications: "Caractéristiques techniques"
+ technical_specifications_are_required: "Les caractéristiques techniques sont requises."
+ attached_files_(pdf): "Pièces jointes (pdf)"
+ attach_a_file: "Joindre un fichier"
+ add_an_attachment: "Ajouter une pièce jointe"
+ disable_machine: "Désactiver la machine"
+ validate_your_machine: "Valider votre machine"
plan_subscribe:
# cadre de souscription à un abonnement
diff --git a/db/migrate/20171011100640_add_disabled_to_machine.rb b/db/migrate/20171011100640_add_disabled_to_machine.rb
new file mode 100644
index 000000000..03986b4ea
--- /dev/null
+++ b/db/migrate/20171011100640_add_disabled_to_machine.rb
@@ -0,0 +1,5 @@
+class AddDisabledToMachine < ActiveRecord::Migration
+ def change
+ add_column :machines, :disabled, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5fb38d7f5..70205b2a5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171010143708) do
+ActiveRecord::Schema.define(version: 20171011100640) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -271,6 +271,7 @@ ActiveRecord::Schema.define(version: 20171010143708) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
+ t.boolean "disabled"
end
add_index "machines", ["slug"], name: "index_machines_on_slug", unique: true, using: :btree