Making the user workflow easier

This commit is contained in:
Matt Barringer 2013-01-08 08:36:21 +01:00
parent 6d415d44e3
commit 3181c1c0d8
6 changed files with 92 additions and 20 deletions

View file

@ -1,5 +1,19 @@
class ProposalController < ApplicationController
before_filter :verify_user
before_filter :verify_access, :only => [:edit, :update, :destroy]
def verify_access
@person = current_user.person
begin
if !organizer_or_admin?
@event = @person.event.find(params[:id])
else
@event = Event.find(params[:id])
end
rescue Exception => e
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
end
end
def index
@person = current_user.person
@ -7,7 +21,7 @@ class ProposalController < ApplicationController
end
def destroy
current_user.person.withdraw_proposal(params[:id])
@person.withdraw_proposal(params[:id])
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Proposal withdrawn.')
end
@ -20,26 +34,23 @@ class ProposalController < ApplicationController
def edit
@url = conference_proposal_path(@conference.short_title, params[:id])
@person = current_user.person
@event_types = @conference.event_types
@event = @person.events.find_by_id(params[:id])
@attachments = @event.event_attachments
if @event.nil? || !@conference.cfp_open?
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid proposal.')
if @event.nil? || !@conference.cfp_open? || @event.unconfirmed? || @event.confirmed?
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
end
end
def update
person = current_user.person
session[:return_to] ||= request.referer
submitter = params[:person]
params[:event].delete :people_attributes
params[:event].delete :person
if submitter[:public_name] != person.public_name || submitter[:biography] != person.biography
person.update_attributes(submitter)
if submitter[:public_name] != @person.public_name || submitter[:biography] != @person.biography
@person.update_attributes(submitter)
end
event = Event.find_by_id(params[:id])

View file

@ -76,6 +76,24 @@ class Event < ActiveRecord::Base
end
def public_state
public_state = "Submitted"
case self.state
when "withdrawn"
public_state = "Withdrawn"
when "new", "review"
public_state = "Review Pending"
when "accepted", "unconfirmed"
public_state = "Accepted (confirmation pending)"
when "confirmed"
public_state = "Confirmed"
when "rejected"
public_state = "Rejected"
when "cancelled"
public_state = "Cancelled"
end
public_state
end
def abstract_word_count
if self.abstract.nil?
0

View file

@ -4,6 +4,11 @@
%h3.pull-left
Registration for
= @conference.title
- if @person.proposal_count(@conference) > 0
.row-fluid
.span12
%i
Please note: Registration is not automatically performed for speakers. If you're scheduled to speak at the conference, you still need to register!
.row-fluid
.span12
= semantic_form_for(@registration, :url => register_conference_path(@conference.short_title), :html => { :method => :put }) do |f|

View file

@ -1,4 +1,22 @@
= link_to "OSEM", root_path, :class => 'brand'
- if @conference.nil? || @conference.short_title.nil?
= link_to "OSEM", root_path, :class => 'brand'
- else
= link_to @conference.title, root_path, :class => 'brand'
%ul.nav
- if !@conference.nil? && @conference.registration_open?
- if current_page?(register_conference_path(@conference.short_title))
%li.active
= link_to "Registration", "#"
- else
%li
= link_to "Registration", register_conference_path(@conference.short_title)
- if !@conference.nil?
- if current_page?(conference_proposal_index_path(@conference.short_title))
%li.active
= link_to "My Proposals", "#"
- else
%li
= link_to "My Proposals", conference_proposal_index_path(@conference.short_title)
%ul.nav.pull-right
- if user_signed_in?
%li

View file

@ -2,18 +2,34 @@
.row-fluid
.span13
%h2.pull-left
My Proposals
= "My Proposals for #{@conference.title}"
.pull-right{:style=>"margin-top:20px;"}
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary"
- @events.each do |event|
- if @person.proposal_count(@conference) > 0
.row-fluid
.span12
.well
.row-fluid
.span10
%table.table.table-bordered.table-striped
%thead
%th
%b Title
%th
%b Status
%th
- @events.each do |event|
%tr
%td
= event.title
%td
= event.public_state
- if event.confirmed? && !@conference.user_registered?(current_user)
%br
= link_to "Register to attend", register_conference_path(@conference.short_title), :style => "font-size:10px;"
%td
.pull-right
- if event.transition_possible? :confirm
= link_to "Confirm", "#", :class => "btn btn-mini btn-success"
- if @conference.cfp_open?
- if !event.unconfirmed? && !event.confirmed?
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, event.id), :class => "btn btn-mini btn-primary"
= 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"

View file

@ -1,2 +1,6 @@
.container
.row
.span12
.center-text
= @conference.call_for_papers.description
= render 'proposal_form'