event: refactor get_state_color method
This commit is contained in:
parent
82edf7870a
commit
8250e1305e
1 changed files with 10 additions and 16 deletions
|
|
@ -149,22 +149,16 @@ class Event < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_state_color(state)
|
def self.get_state_color(state)
|
||||||
case state
|
color = {
|
||||||
when 'new' # blue
|
new: '#0000FF', # blue
|
||||||
'#0000FF'
|
withdrawn: '#FF8000', # orange
|
||||||
when 'withdrawn' # orange
|
confirmed: '#00FF00', # green
|
||||||
'#FF8000'
|
unconfirmed: '#FFFF00', # yellow
|
||||||
when 'confirmed' # green
|
rejected: '#FF0000', # red
|
||||||
'#00FF00'
|
canceled: '#848484' # grey
|
||||||
when 'unconfirmed' # yellow
|
}[state.to_sym]
|
||||||
'#FFFF00'
|
|
||||||
when 'rejected' # red
|
color || '#00FFFF' # azure
|
||||||
'#FF0000'
|
|
||||||
when 'canceled' # grey
|
|
||||||
'#848484'
|
|
||||||
else
|
|
||||||
'#00FFFF' # azure
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_state(transition, mail = false, subject = false, send_mail = false, send_mail_param)
|
def update_state(transition, mail = false, subject = false, send_mail = false, send_mail_param)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue