Merge pull request #42 from differentreality/proposal_event_types
Show length of event types in new proposal drop down
This commit is contained in:
commit
406b7dcd2d
3 changed files with 18 additions and 1 deletions
|
|
@ -15,6 +15,21 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_time(length)
|
||||||
|
h = length / 60
|
||||||
|
min = length - h * 60
|
||||||
|
|
||||||
|
if h != 0
|
||||||
|
if min != 0
|
||||||
|
"#{h} h #{min} min"
|
||||||
|
else
|
||||||
|
"#{h} h"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
"#{min} min"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def add_association_link(association_name, form_builder, div_class, html_options = {})
|
def add_association_link(association_name, form_builder, div_class, html_options = {})
|
||||||
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(:class => "assoc btn btn-success")
|
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(:class => "assoc btn btn-success")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,6 @@ class EventType < ActiveRecord::Base
|
||||||
attr_accessible :title, :length, :minimum_abstract_length, :maximum_abstract_length
|
attr_accessible :title, :length, :minimum_abstract_length, :maximum_abstract_length
|
||||||
|
|
||||||
belongs_to :conference
|
belongs_to :conference
|
||||||
|
|
||||||
|
validates :length, :numericality => {:greater_than => 0}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
- else
|
- else
|
||||||
= f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false, :label => "Session Type"
|
= 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 :require_registration
|
= f.input :require_registration
|
||||||
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},
|
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},
|
||||||
:required => true, :label => "Session Abstract"
|
:required => true, :label => "Session Abstract"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue