Merge pull request #205 from ChrisBr/refactoring_event_state

Refactoring event states
This commit is contained in:
Christian Bruckmayer 2014-06-06 12:03:41 +02:00
commit 069cc0eb4c
12 changed files with 148 additions and 87 deletions

View file

@ -15,7 +15,7 @@
%td #{event.title}
%td #{event.conference.title}
%td
.span{'class'=>label_for(event.public_state)} #{event.public_state}
.span{'class'=>label_for(event.state)} #{event.state.humanize}
- else
%h5.text-warning.text-center
No submissions!

View file

@ -107,33 +107,33 @@
%ul.dropdown-menu{:role=>"menu"}
- if event.transition_possible? :accept
%li= link_to 'Accept event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :accept),
accept_admin_conference_event_path(@conference.short_title, event),
method: :patch, id: "accept_event_#{event.id}"
- if @conference.email_settings.send_on_accepted?
%li= link_to 'Accept event (without email)',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :accept, send_mail: false),
accept_admin_conference_event_path(@conference.short_title, event, send_mail: false),
method: :patch, hint: 'Accept this event without sending an automated email.',
id: "accept_event_without_mail_#{event.id}"
- if event.transition_possible? :reject
%li= link_to 'Reject event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :reject),
reject_admin_conference_event_path(@conference.short_title, event),
method: :patch, confirm: 'Are you sure?', id: "reject_event_#{event.id}"
- if @conference.email_settings.send_on_rejected?
%li= link_to 'Reject event (without email)',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :reject, send_mail: false),
reject_admin_conference_event_path(@conference.short_title, event, send_mail: false),
method: :patch, confirm: 'Are you sure?', id: "reject_event_without_mail_#{event.id}"
- if event.transition_possible? :start_review
- if event.transition_possible? :restart
%li= link_to 'Start review',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :start_review),
method: :patch, id: "review_event_#{event.id}"
restart_admin_conference_event_path(@conference.short_title, event),
method: :patch, id: "restart_event_#{event.id}"
- if event.transition_possible? :confirm
%li= link_to 'Confirm event',
update_state_admin_conference_event_path(@conference.short_title, event, transition: :confirm),
confirm_admin_conference_event_path(@conference.short_title, event),
method: :patch, id: "confirm_event_#{event.id}",
hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.'
- if event.transition_possible? :cancel
%li= link_to 'Cancel event',
update_state_admin_conference_event_path(@conference.short_title, event, :transition => :cancel),
cancel_admin_conference_event_path(@conference.short_title, event),
method: :patch, id: "cancel_event_#{event.id}",
hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.'

View file

@ -19,7 +19,10 @@
%td
= link_to event.title, conference_proposal_path(@conference.short_title, event.id)
%td
= event.public_state
- if event.state == 'new'
Review pending
- else
= event.state.humanize
- if event.state == 'confirmed' && event.require_registration == true
(Pre-registered: #{pre_registered(event).count})
- if event.confirmed? && !@conference.user_registered?(current_user)
@ -29,10 +32,15 @@
.pull-right
- if event.transition_possible? :confirm
= link_to 'Confirm',
conference_proposal_confirm_path(@conference.short_title, event, send_mail: false),
conference_proposal_confirm_path(@conference.short_title, event),
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}"
= link_to 'Edit', edit_conference_proposal_path(@conference.short_title, event.id),
class: 'btn btn-mini btn-primary', id: "edit_proposal_#{event.id}"
= link_to 'Withdraw', conference_proposal_path(@conference.short_title, event.id), method: :delete,
confirm: 'Are you sure you want to withdraw this proposal?', class: 'btn btn-mini btn-danger',
id: "delete_proposal_#{event.id}"
- if event.transition_possible? :withdraw
= link_to 'Withdraw', conference_proposal_path(@conference.short_title, event.id), method: :delete,
confirm: 'Are you sure you want to withdraw this proposal?', class: 'btn btn-mini btn-danger',
id: "delete_proposal_#{event.id}"
- if event.state == 'withdrawn' || event.state == 'rejected'
= link_to 'Re-Submit',
conference_proposal_restart_path(@conference.short_title, event),
method: :patch, class: 'btn btn-mini btn-success', id: "review_event_#{event.id}"