Refactored proposal. Enabled cancancan

This commit is contained in:
Henne Vogelsang 2014-07-23 16:24:05 +02:00
parent 0ae7991943
commit c982cbb88a
13 changed files with 204 additions and 231 deletions

View file

@ -14,7 +14,7 @@
%br
%br
- else
= f.input :event_type_id,:as => :select, :collection => @event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id]}, :include_blank => false, :label => "Session Type"
= f.input :event_type_id,:as => :select, :collection => @conference.event_types.map {|x| ["#{x.title} - #{show_time(x.length)}", x.id]}, :include_blank => false, :label => "Session Type"
= f.input :difficulty_level, :as => :select, :collection => @conference.difficulty_levels, :include_blank => "(Please select)" if @conference.use_difficulty_levels
= f.input :require_registration
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},
@ -41,22 +41,18 @@
= f.input :media_id, :label => "Media ID", :as => :string
%section#information
= f.inputs :name => "Your Information" do
= semantic_fields_for @user do |u|
= u.input :name, :as => :string, :required => true
= u.input :affiliation, :as => :string, :hint => "This could be a company, a user group, or nothing at all."
= u.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
You have used
%span#biography-count #{@user.biography_word_count}
words. Biographies are limited to 150 words.
%br
%br
%section#speakers
= f.inputs :name => "Additional Speakers" do
Will there be any additional speakers? If so, please enter their full names, email address, and a short
biography for each.
= f.input :proposal_additional_speakers, :input_html => {:rows => 5, :class => "span11"}, :label => false
= f.action :submit, :as => :button, :label => "Submit Session", :button_html => {:class => "btn btn-primary"}
- if current_user.name.blank? || current_user.biography.blank?
= f.inputs :name => "Your Information" do
= semantic_fields_for current_user do |u|
- if current_user.name.blank?
= u.input :name, :as => :string, :required => true
- if current_user.biography.blank?
= u.input :biography, :required => true, :input_html => {:rows => 5, :class => 'span11', "onkeyup" => "word_count(this, 'biography-count', 150)"}
You have used
%span#biography-count #{current_user.biography_word_count}
words. Biographies are limited to 150 words.
%p.text-right
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"}
:javascript
var maxcount = 0;

View file

@ -3,8 +3,8 @@
%h1
= "My Proposals for #{@conference.title}"
- if @conference.cfp_open? || organizer_or_admin?
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-primary pull-right"
- if @user.proposal_count(@conference) > 0
= link_to "New Proposal", new_conference_proposal_path(@conference.short_title), :class => "btn btn-success pull-right"
- if current_user.proposal_count(@conference) > 0
.row
.col-md-12
%table.table.table-bordered.table-striped
@ -32,15 +32,15 @@
.pull-right
- if event.transition_possible? :confirm
= link_to 'Confirm',
conference_proposal_confirm_path(@conference.short_title, event),
confirm_conference_proposal_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}"
class: 'btn btn-mini btn-primary', id: "edit_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',
confirm: 'Are you sure you want to withdraw this proposal?', class: 'btn btn-mini btn-warning',
id: "delete_proposal_#{event.id}"
- if event.state == 'withdrawn' || event.state == 'rejected'
= link_to 'Re-Submit',
conference_proposal_restart_path(@conference.short_title, event),
restart_conference_proposal_path(@conference.short_title, event.id),
method: :patch, class: 'btn btn-mini btn-success', id: "review_event_#{event.id}"