diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5adfc14..70ae48d0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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") diff --git a/app/views/admin/registrations/show.html.haml b/app/views/admin/registrations/show.html.haml index ed980237..c33ce7d6 100644 --- a/app/views/admin/registrations/show.html.haml +++ b/app/views/admin/registrations/show.html.haml @@ -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"