Skip to content

Commit dd5a4b3

Browse files
author
Kritin Vij
committed
CSS changes: minor, so that participant number shows up aligned on event pages. Index.html: Filtering on events by shifts is now fixed and working. _details changes: html safe on a no break.
1 parent 3adafce commit dd5a4b3

File tree

3 files changed

+108
-75
lines changed

3 files changed

+108
-75
lines changed

app/assets/stylesheets/dreamsis.css

+1
Original file line numberDiff line numberDiff line change
@@ -4586,6 +4586,7 @@ ul.mentor_stats_summary .section_id.tag {
45864586
.signup-numbers {
45874587
font-size: 85%;
45884588
color: #656565;
4589+
clear: both;
45894590
}
45904591

45914592
.signup-numbers span {
+106-74
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,123 @@
11
<h3 class="pre-title"><%= @event.name %></h3>
22
<h1><%=h @audience.to_s %> Attendance</h1>
3-
3+
44
<table class="attendees">
5-
<thead>
6-
<tr>
7-
<th>Attendee</th>
8-
<%= content_tag(:th, "High School") if @audience.to_s.downcase == "participant" || @audience.to_s.downcase == "student" %>
9-
<th>Program(s)</th>
10-
<th>Phone</th>
11-
<th>Shift</th>
12-
<%= "<th class='centered'>Trained?</th>" if @event.training_required?(@audience.to_s) %>
13-
<th class="centered">RSVP'd?
14-
<%= link_to "E-mail",
15-
"mailto:#{@event.attendees.rsvpd(@audience).collect{|a| a.email rescue nil }.compact.join(",")}",
16-
:class => 'email button',
17-
:id => 'attending_email_link' %>
18-
</th>
19-
<th class="centered">Attended?
20-
<%= link_to "E-mail",
21-
"mailto:#{@event.attendees.attended(@audience).collect{|a| a.email rescue nil }.compact.join(",")}",
22-
:class => 'email button',
23-
:id => 'attended_email_link' %>
24-
</th>
25-
<th>Functions</th>
26-
</tr>
27-
</thead>
28-
29-
<tbody>
30-
<%= render :partial => 'event_attendance', :collection => @event.attendees.audience(@audience).select{|a| a.rsvp? || a.attended? || a.admin? }, :locals => { :audience => @audience } %>
31-
32-
<%- if @event.attendees.empty? -%>
33-
<tr class="empty">
34-
<td colspan=10>No event attendees yet.</td>
35-
</tr>
36-
<% end -%>
37-
</tbody>
5+
<thead>
6+
<tr>
7+
<th>Attendee</th>
8+
<%= content_tag(:th, "High School") if @audience.to_s.downcase == "participant" || @audience.to_s.downcase == "student" %>
9+
<th>Program(s)</th>
10+
<th>Phone</th>
11+
<th>Shift</th>
12+
<%= "<th class='centered'>Trained?</th>" if @event.training_required?(@audience.to_s) %>
13+
<th class="centered">RSVP'd?
14+
<%= link_to "E-mail",
15+
"mailto:#{@event.attendees.rsvpd(@audience).collect{|a| a.email rescue nil }.compact.join(",")}",
16+
:class => 'email button',
17+
:id => 'attending_email_link' %>
18+
</th>
19+
<th class="centered">Attended?
20+
<%= link_to "E-mail",
21+
"mailto:#{@event.attendees.attended(@audience).collect{|a| a.email rescue nil }.compact.join(",")}",
22+
:class => 'email button',
23+
:id => 'attended_email_link' %>
24+
</th>
25+
<th>Functions</th>
26+
</tr>
27+
</thead>
28+
29+
<tbody>
30+
<%= render :partial => 'event_attendance', :collection => @event.attendees.audience(@audience).select{|a| a.rsvp? || a.attended? || a.admin? }, :locals => { :audience => @audience } %>
31+
32+
<%- if @event.attendees.empty? -%>
33+
<tr class="empty">
34+
<td colspan=10>No event attendees yet.</td>
35+
</tr>
36+
<% end -%>
37+
</tbody>
3838
</table>
3939

4040
<div id="sidebar">
41-
<p><%= link_to "Back to Event", event_path(@event), :class => 'back button' %></p>
42-
<p><%= link_to "Take Attendnace", checkin_event_event_attendances_path(@event, :audience => @audience), :class => "edit button" %></p>
43-
44-
<%- form_tag({}, :method => :get) do -%>
45-
<p><%= label_tag :audience, "View Attendance For:" %>
46-
<%= select_tag :audience,
47-
options_for_select(%w[Participant Student Mentor Volunteer].collect{|a| ["#{a} (#{@event.rsvpd_count(a)})", a]},
48-
@audience.to_s.classify),
49-
:onchange => "this.form.submit()" %>
50-
<%= submit_tag "Go" %>
51-
</p>
52-
<% end -%>
53-
54-
<%- if @event.has_shifts?(@audience.to_s.classify) %>
55-
<h3>Filter by Shift</h3>
56-
57-
<div id="event_shift_selectors">
58-
<%- for event_shift in @event.shifts.for(@audience.to_s.classify) -%>
59-
<label for="event_shift_selector_<%= event_shift.id %>">
60-
<input type="checkbox" id="event_shift_selector_<%= event_shift.id %>" data-shift-id="<%= event_shift.id %>" checked onChange="updateShiftSelections(this);">
61-
<%= truncate(event_shift.title) %>
62-
</label><br>
63-
<% end -%>
64-
<small class="light">Filtering the list will also update the email buttons above.</small>
65-
</div>
66-
67-
<% end -%>
41+
<p><%= link_to "Back to Event", event_path(@event), :class => 'back button' %></p>
42+
<p><%= link_to "Take Attendnace", checkin_event_event_attendances_path(@event, :audience => @audience), :class => "edit button" %></p>
43+
44+
<%- form_tag({}, :method => :get) do -%>
45+
<p><%= label_tag :audience, "View Attendance For:" %>
46+
<%= select_tag :audience,
47+
options_for_select(%w[Participant Student Mentor Volunteer].collect{|a| ["#{a} (#{@event.rsvpd_count(a)})", a]},
48+
@audience.to_s.classify),
49+
:onchange => "this.form.submit()" %>
50+
<%= submit_tag "Go" %>
51+
</p>
52+
<% end -%>
53+
54+
<%- if @event.has_shifts?(@audience.to_s.classify) %>
55+
<h3>Filter by Shift</h3>
56+
57+
<div id="event_shift_selectors">
58+
<%- for event_shift in @event.shifts.for(@audience.to_s.classify) -%>
59+
<label for="event_shift_selector_<%= event_shift.id %>">
60+
<input type="checkbox" id="event_shift_selector_<%= event_shift.id %>" data-shift-id="<%= event_shift.id %>" checked onChange="updateShiftSelections(this);">
61+
<%= truncate(event_shift.title) %>
62+
</label><br>
63+
<% end -%>
64+
<small class="light">Filtering the list will also update the email buttons above.</small>
65+
</div>
66+
67+
<% end -%>
6868
</div>
6969

7070
<script type="text/javascript">
7171

72+
function filterEvents() {
73+
74+
}
75+
76+
7277
function updateShiftSelections(elem) {
73-
var rows = $$("tr.event_attendance")
74-
rows = rows.findAll(function(e) { return e.readAttribute('data-shift-id') == elem.readAttribute('data-shift-id') })
75-
if(elem.checked == true) {
76-
rows.invoke('show')
77-
} else {
78-
rows.invoke('hide')
79-
}
80-
updateEmailLinks()
78+
// get the data shift id for the filter
79+
var shiftid = elem.getAttribute("data-shift-id");
80+
81+
// get all rows that correspond to that shift id
82+
var rows = $("tr.event_attendance[data-shift-id='" + shiftid + "']");
83+
84+
if (elem.checked) {
85+
rows.show();
86+
} else {
87+
rows.hide();
88+
}
89+
90+
updateEmailLinks();
8191
}
8292

8393
function updateEmailLinks() {
84-
var rows = $$("tr.event_attendance").findAll(function(e) { return e.visible() })
85-
var attending_rows = rows.findAll(function(e) { return e.readAttribute("data-attending") == "true" })
86-
var attended_rows = rows.findAll(function(e) { return e.readAttribute("data-attended") == "true" })
87-
$('attending_email_link').writeAttribute("href", "mailto:" + attending_rows.collect(function(e) { return e.readAttribute("data-email") }).join(","))
88-
$('attended_email_link').writeAttribute("href", "mailto:" + attended_rows.collect(function(e) { return e.readAttribute("data-email") }).join(","))
94+
// get rows which are visible and corresponding attributes are true
95+
var attending_rows = $("tr.event_attendance[data-attending='true']:visible");
96+
var attended_rows = $("tr.event_attendance[data-attended='true']:visible");
97+
98+
// create an email list of those people attending
99+
var emailsAttending = [];
100+
function getAttending() {
101+
attending_rows.each(function(key, value) {
102+
emailsAttending.push(value.getAttribute('data-email'));
103+
});
104+
}
105+
getAttending();
106+
107+
// make the array into string and then set that as a value to the email link
108+
emailsAttending = emailsAttending.splice(',').join(',');
109+
$('#attending_email_link').attr("href", "mailto:" + emailsAttending);
110+
111+
// similarly for the Attended emails
112+
var emailsAttended = [];
113+
function getAttended() {
114+
attended_rows.each(function(key, value) {
115+
emailsAttended.push(value.getAttribute('data-email'));
116+
});
117+
}
118+
getAttended();
119+
emailsAttended = emailsAttended.splice(',').join(',');
120+
$('#attended_email_link').attr("href", "mailto:" + emailsAttended);
89121
}
90122

91123
</script>

app/views/events/_details.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
title="<%= number_to_percentage details.percent_full, :precision => 0 %> full">
2727

2828
<div class="size" style="width: <%= details.percent_full %>%">
29-
<%= details.full? ? content_tag(:span, "full", :class => "full_label") : "&nbsp;" %>
29+
<%= details.full? ? content_tag(:span, "full", :class => "full_label") : "&nbsp;".html_safe %>
3030
</div>
3131
</div>
3232
</div>

0 commit comments

Comments
 (0)