osem-fcy/app/views/admin/registrations/show.html.haml
2013-07-12 13:37:29 +03:00

51 lines
No EOL
2.2 KiB
Text

.row-fluid
.span12
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
= link_to "New", admin_users_new_path(@conference.short_title), :class => "btn btn-primary"
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-success"
.row-fluid
.span12
%h2
Registrations
- if @registrations
= "(#{@registrations.length})"
- if @attended
= " - Attended (#{@attended.length})"
%table.table.table-striped.table-bordered.table-hover#registrations
%thead
%th
No
- @headers.each do |h|
- h = h.gsub("_", " ")
%th
= h.capitalize
%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.public_name})
-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 "Edit", "#", :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}?"
:javascript
$(document).ready(function() {
$('#registrations').dataTable( {
"bPaginate": false,
"bLengthChange": false
} );
} );