.row .col-md-12 .page-header %h2 Registrations - if @registrations = "(#{@registrations.length})" = " - Attended (#{@attended})" .btn-group.pull-right = link_to "New", admin_conference_registrations_new_path(@conference.short_title), :class => "btn btn-default" = link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-default" = link_to "Export XLS", {:format => :xlsx}, :class => "btn btn-default" %table.table.table-bordered.table-striped.table-hover#registrations %thead %th No - @headers.each do |h| - h = h.gsub("_", " ") %th = h.capitalize %th %th %th - counter = 0 - @registrations.each do |registration| %tr %td = counter +=1 - @headers.each do |field| %td - if field == "name" #{registration.last_name} #{registration.first_name} (#{registration.irc_nickname}) #{registration.company} - if registration.supporter_level && registration.supporter_level.title != 'Free' %p{:style => "color:red"} = registration.supporter_level.title -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" -elsif (registration.send(field.to_sym).class == TrueClass || registration.send(field.to_sym).class == FalseClass) = 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) - elsif field == 'arrival' || field == 'departure' = registration.send(field.to_sym).strftime("%d %b %H:%M") if registration.send(field.to_sym) - else = registration.send(field.to_sym) %td = link_to "Questions", "javascript: void(0)", :class => "questions btn btn-success", :id => counter, :onclick => "toggle('row#{counter}')" %td = link_to "Edit", admin_conference_registrations_edit_path(@conference.short_title, :id => registration.id), :method => :get, :class => "btn btn-primary" %td = link_to "Delete", admin_conference_registrations_path(@conference.short_title, :id => registration.id), :method => :delete, :class => "btn btn-danger", :confirm => "Really delete registration for #{registration.public_name} #{registration.email}?" %tr{:id => "row#{counter}", :style=>"display:none;"} %td{:colspan=>13} = render :partial => "questions", :locals => {:registration => registration} :javascript $(document).ready(function() { $('#registrations').dataTable( { "bPaginate": false, "bLengthChange": false } ); } ); function toggle(rowid) { if( document.getElementById(rowid).style.display=='none' ){ document.getElementById(rowid).style.display = ''; }else{ document.getElementById(rowid).style.display = 'none'; } };