forked from nanego/my-dcim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class RoomDecorator < ApplicationDecorator | ||
BADGE_COLORS = { | ||
active: "text-bg-success", | ||
passive: "text-bg-warning", | ||
planned: "text-bg-primary" | ||
}.freeze | ||
|
||
class << self | ||
def statuses_for_options | ||
Room.statuses.keys.map { |status| [Room.human_attribute_name("status.#{status}"), status] } | ||
end | ||
end | ||
|
||
def badge_color_for_status | ||
case status | ||
when "active" | ||
"text-bg-success" | ||
when "passive" | ||
"text-bg-warning" | ||
when "planned" | ||
"text-bg-primary" | ||
end | ||
BADGE_COLORS[status.to_sym] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters