1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

ability to disable space

This commit is contained in:
Sylvain 2017-10-11 14:58:38 +02:00
parent 02baf9097e
commit 1c8d362f11
9 changed files with 32 additions and 4 deletions

View File

@ -107,3 +107,22 @@
<a class="btn btn-default" ng-click="addFile()" role="button"> {{ 'space.add_an_attachment' | translate }} <i class="fa fa-file-o fa-fw"></i></a>
</div>
</div>
<div class="form-group">
<label for="space[disabled]" class="control-label col-sm-2" translate>
{{ 'space.disable_space' }}
</label>
<div class="col-sm-10">
<input bs-switch
ng-model="space.disabled"
name="space[disabled]"
id="space[disabled]"
type="checkbox"
class="form-control"
switch-on-text="{{ 'yes' | translate }}"
switch-off-text="{{ 'no' | translate }}"
switch-animate="true"/>
<input type="hidden" name="space[disabled]" value="{{space.disabled}}">
</div>
</div>

View File

@ -43,7 +43,7 @@ class API::SpacesController < API::ApiController
end
def space_params
params.require(:space).permit(:name, :description, :characteristics, :default_places, space_image_attributes: [:attachment],
params.require(:space).permit(:name, :description, :characteristics, :default_places, :disabled, space_image_attributes: [:attachment],
space_files_attributes: [:id, :attachment, :_destroy])
end
end

View File

@ -1,4 +1,4 @@
json.array!(@spaces) do |space|
json.extract! space, :id, :name, :description, :slug, :default_places
json.extract! space, :id, :name, :description, :slug, :default_places, :disabled
json.space_image space.space_image.attachment.medium.url if space.space_image
end

View File

@ -1,4 +1,4 @@
json.extract! @space, :id, :name, :description, :characteristics, :created_at, :updated_at, :slug, :default_places
json.extract! @space, :id, :name, :description, :characteristics, :created_at, :updated_at, :slug, :default_places, :disabled
json.space_image @space.space_image.attachment.large.url if @space.space_image
json.space_files_attributes @space.space_files do |f|
json.id f.id

View File

@ -415,6 +415,7 @@ en:
add_an_attachment: "Add an attachment"
default_places: "Default maximum tickets"
default_places_is_required: "Default maximum tickets is required."
disable_space: "Disable space"
cart:
# module de panier d'achat de réservations

View File

@ -424,6 +424,7 @@ fr:
add_an_attachment: "Ajouter une pièce jointe"
default_places: "Maximum de places par défaut"
default_places_is_required: "Le nombre de places maximum par défaut est requis."
disable_space: "Désactiver l'espace"
cart:
# module de panier d'achat de réservations

View File

@ -415,6 +415,7 @@ pt:
add_an_attachment: "Adicionar um anexo"
default_places: "Tickets máximo padrão"
default_places_is_required: "Tickets máximo padrão é obrigatório."
disable_space: "Disable space" # TODO
cart:
# module de panier d'achat de réservations

View File

@ -0,0 +1,5 @@
class AddDisabledToSpace < ActiveRecord::Migration
def change
add_column :spaces, :disabled, :boolean
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: 20171011100640) do
ActiveRecord::Schema.define(version: 20171011125217) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -571,6 +571,7 @@ ActiveRecord::Schema.define(version: 20171011100640) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "characteristics"
t.boolean "disabled"
end
create_table "spaces_availabilities", force: :cascade do |t|