Add a backup event status

This commit is contained in:
Petko Bordjukov 2014-10-10 20:25:41 +03:00
parent 054ef9c947
commit c83a6fb719
5 changed files with 16 additions and 6 deletions

View File

@ -21,6 +21,11 @@ module Management
render :index
end
def backup
@suggestion_groups = SuggestionGroup.for_conference Conference.current, state: Event.states[:backup]
render :index
end
def show
end

View File

@ -13,11 +13,11 @@ class Event < ActiveRecord::Base
after_create :send_new_event_notification
enum state: [:undecided, :approved, :rejected]
enum state: [:undecided, :approved, :rejected, :backup]
# XXX: this belongs in a decorator
STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'thumbs-down', approved: 'thumbs-up'}
STATE_TO_CLASS = {undecided: 'warning', rejected: 'danger', approved: 'success'}
STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'thumbs-down', approved: 'thumbs-up', backup: 'retweet'}
STATE_TO_CLASS = {undecided: 'warning', rejected: 'danger', approved: 'success', backup: 'info'}
private

View File

@ -7,6 +7,7 @@ html
meta name="viewport" content="width=device-width, initial-scale=1"
title Clarion
= stylesheet_link_tag "management/application"
= stylesheet_link_tag '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.2.4/bootstrap-table.min.css'
= csrf_meta_tags
body
nav.navbar.navbar-default.navbar-fixed-top
@ -30,12 +31,15 @@ html
li class="#{'active' if action_name == 'index'}"
= link_to "Всички", management_events_path
li class="#{'active' if action_name == 'undecided'}"
= link_to "Висящи", undecided_management_events_path
= link_to "Нерешени", undecided_management_events_path
li class="#{'active' if action_name == 'approved'}"
= link_to "Одобрени", approved_management_events_path
li class="#{'active' if action_name == 'backup'}"
= link_to "Резерви", backup_management_events_path
li class="#{'active' if action_name == 'rejected'}"
= link_to "Отхвърлени", rejected_management_events_path
div.container
== yield
= javascript_include_tag "management/application"
= javascript_include_tag '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.2.4/bootstrap-table.min.js'

View File

@ -1,9 +1,9 @@
.btn-group id="suggestion-#{suggestion.id}-state"
button class="btn dropdown-toggle btn-#{Event::STATE_TO_CLASS[suggestion.state.to_sym]}" type="button" data-toggle="dropdown"
button class="btn dropdown-toggle btn-#{Event::STATE_TO_CLASS[suggestion.state.to_sym]}" type="button" title="#{suggestion.state}" data-toggle="dropdown"
=> glyph Event::STATE_TO_GLYPH[suggestion.state.to_sym]
span.caret
ul.dropdown-menu role="menu"
- Event.states.each do |state, number|
- next if state == suggestion.state
li
= link_to glyph(Event::STATE_TO_GLYPH[state.to_sym]), state_management_event_path(suggestion, state: state), class: "btn text-#{Event::STATE_TO_CLASS[state.to_sym]}", remote: true, method: :patch
= link_to glyph(Event::STATE_TO_GLYPH[state.to_sym]), state_management_event_path(suggestion, state: state), title: state, class: "btn text-#{Event::STATE_TO_CLASS[state.to_sym]}", remote: true, method: :patch

View File

@ -22,6 +22,7 @@ Rails.application.routes.draw do
get 'approved'
get 'rejected'
get 'undecided'
get 'backup'
end
end
end