show supporter level below name in registrations list (if other than free)

This commit is contained in:
differentreality 2013-07-13 10:59:02 +03:00
parent 6a951f1f21
commit 6fc6e924ef
2 changed files with 14 additions and 0 deletions

View file

@ -14,6 +14,15 @@ module ApplicationHelper
var.strftime("%a, %d %b")
end
end
def get_supporter_level(registration)
@conference.supporter_registrations.find_by_sql("SELECT *, supporter_levels.title as title
FROM supporter_registrations
INNER JOIN supporter_levels
ON supporter_registrations.supporter_level_id = supporter_levels.id
WHERE supporter_registrations.conference_id = #{@conference.id}
AND supporter_registrations.registration_id = #{registration.id}").first
end
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")

View file

@ -30,6 +30,11 @@
%td
- if field == "name"
#{registration.last_name} #{registration.first_name} (#{registration.public_name})
- supp_reg = get_supporter_level(registration)
- if supp_reg
%br
%p{:style => "color:red"}
= supp_reg.title unless supp_reg.title == "Free"
-elsif field == 'attended'
= link_to "#{registration.send(field.to_sym)}", admin_conference_registrations_change_field_path(@conference.short_title, :id => registration.id, :view_field => "#{field}"), :method => :put, ":#{field}" => registration.send(field.to_sym), :class => "btn btn-success"