Making the user workflow easier
This commit is contained in:
parent
6d415d44e3
commit
3181c1c0d8
6 changed files with 92 additions and 20 deletions
|
|
@ -1,5 +1,19 @@
|
||||||
class ProposalController < ApplicationController
|
class ProposalController < ApplicationController
|
||||||
before_filter :verify_user
|
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
|
def index
|
||||||
@person = current_user.person
|
@person = current_user.person
|
||||||
|
|
@ -7,7 +21,7 @@ class ProposalController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
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.')
|
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Proposal withdrawn.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -20,26 +34,23 @@ class ProposalController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@url = conference_proposal_path(@conference.short_title, params[:id])
|
@url = conference_proposal_path(@conference.short_title, params[:id])
|
||||||
@person = current_user.person
|
|
||||||
@event_types = @conference.event_types
|
@event_types = @conference.event_types
|
||||||
@event = @person.events.find_by_id(params[:id])
|
|
||||||
@attachments = @event.event_attachments
|
@attachments = @event.event_attachments
|
||||||
|
|
||||||
if @event.nil? || !@conference.cfp_open?
|
if @event.nil? || !@conference.cfp_open? || @event.unconfirmed? || @event.confirmed?
|
||||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid proposal.')
|
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Invalid or uneditable proposal.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
person = current_user.person
|
|
||||||
session[:return_to] ||= request.referer
|
session[:return_to] ||= request.referer
|
||||||
submitter = params[:person]
|
submitter = params[:person]
|
||||||
|
|
||||||
params[:event].delete :people_attributes
|
params[:event].delete :people_attributes
|
||||||
params[:event].delete :person
|
params[:event].delete :person
|
||||||
|
|
||||||
if submitter[:public_name] != person.public_name || submitter[:biography] != person.biography
|
if submitter[:public_name] != @person.public_name || submitter[:biography] != @person.biography
|
||||||
person.update_attributes(submitter)
|
@person.update_attributes(submitter)
|
||||||
end
|
end
|
||||||
|
|
||||||
event = Event.find_by_id(params[:id])
|
event = Event.find_by_id(params[:id])
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,24 @@ class Event < ActiveRecord::Base
|
||||||
|
|
||||||
end
|
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
|
def abstract_word_count
|
||||||
if self.abstract.nil?
|
if self.abstract.nil?
|
||||||
0
|
0
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
%h3.pull-left
|
%h3.pull-left
|
||||||
Registration for
|
Registration for
|
||||||
= @conference.title
|
= @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
|
.row-fluid
|
||||||
.span12
|
.span12
|
||||||
= semantic_form_for(@registration, :url => register_conference_path(@conference.short_title), :html => { :method => :put }) do |f|
|
= semantic_form_for(@registration, :url => register_conference_path(@conference.short_title), :html => { :method => :put }) do |f|
|
||||||
|
|
|
||||||
|
|
@ -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
|
%ul.nav.pull-right
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
%li
|
%li
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,34 @@
|
||||||
.row-fluid
|
.row-fluid
|
||||||
.span13
|
.span13
|
||||||
%h2.pull-left
|
%h2.pull-left
|
||||||
My Proposals
|
= "My Proposals for #{@conference.title}"
|
||||||
.pull-right{:style=>"margin-top:20px;"}
|
.pull-right{:style=>"margin-top:20px;"}
|
||||||
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary"
|
= 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
|
.row-fluid
|
||||||
.span12
|
.span12
|
||||||
.well
|
%table.table.table-bordered.table-striped
|
||||||
.row-fluid
|
%thead
|
||||||
.span10
|
%th
|
||||||
= event.title
|
%b Title
|
||||||
.pull-right
|
%th
|
||||||
- if @conference.cfp_open?
|
%b Status
|
||||||
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, event.id), :class => "btn btn-mini btn-primary"
|
%th
|
||||||
= link_to "Withdraw", conference_proposal_path(@conference.short_title, event.id), :method => :delete,
|
- @events.each do |event|
|
||||||
:confirm => "Are you sure you want to withdraw this proposal?", :class => "btn btn-mini btn-danger"
|
%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"
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,6 @@
|
||||||
.container
|
.container
|
||||||
|
.row
|
||||||
|
.span12
|
||||||
|
.center-text
|
||||||
|
= @conference.call_for_papers.description
|
||||||
= render 'proposal_form'
|
= render 'proposal_form'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue