diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 0766a1914..d9374702e 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -131,6 +131,6 @@ def set_room # Never trust parameters from the scary internet, only allow the white list through. def room_params - params.require(:room).permit(:name, :description, :display_on_home_page, :position, :site_id) + params.require(:room).permit(:name, :description, :display_on_home_page, :position, :status, :site_id) end end diff --git a/app/models/room.rb b/app/models/room.rb index e3c10341b..e5b569f77 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -13,7 +13,7 @@ class Room < ApplicationRecord has_many :frames, through: :bays, dependent: :restrict_with_error has_many :materials, through: :frames, dependent: :restrict_with_error - enum :status, [:active, :passive, :planned] + enum :status, { :active => 0, :passive => 1, :planned => 2 }, default: :active, validate: true scope :sorted, -> { order(:site_id, :position, :name) } scope :not_empty, -> { joins(:servers) } diff --git a/app/processors/rooms_processor.rb b/app/processors/rooms_processor.rb index ce1b7f285..a23a2ed4c 100644 --- a/app/processors/rooms_processor.rb +++ b/app/processors/rooms_processor.rb @@ -2,7 +2,7 @@ class RoomsProcessor < ApplicationProcessor include Sortable - SORTABLE_FIELDS = %w[name position sites.name islets_count display_on_home_page].freeze + SORTABLE_FIELDS = %w[name position sites.name islets_count display_on_home_page status].freeze map :q do |q:| raw.where(Room.arel_table[:name].matches("%#{q}%")) diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index e1f170fb4..f4017a39e 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -4,14 +4,17 @@