YaleSTC/shifts

View on GitHub
app/views/calendar_feeds/index.html.erb

Summary

Maintainability
Test Coverage
<% title "Your Calendar Feeds" %>

<div class="feed_shifts">
    <h2>Shifts</h2>
    <% @source_types.each do |source_type|%>
        <h3><%= source_type=="User" ? "All Your Shifts" : "Shifts by #{source_type}"%></h3>
        <% @shift_sources.select {|s| s.type==source_type}.each do |source| %>
            <%=link_to source.name.truncate(50), calendar_feed_path(user_id: current_user, token: source.token.to_s, format: :ics, only_path: false, protocol: "webcal") %><br />
        <% end %>
    <% end %>
</div>

<div class="feed_subs">
    <h2>Subs</h2>
    <% @source_types.each do |source_type|%>
        <h3><%= source_type == "User" ? "All Subs" : "Subs by #{source_type}" %></h3>
        <% @sub_sources.select {|s| s.type==source_type}.each do |source| %>
            <%= link_to source.name.truncate(50), calendar_feed_path(user_id: current_user, token: source.token.to_s, format: :ics, only_path: false, protocol: "webcal") %><br />
        <% end %>
    <% end %>
</div>

<div class="feed_bottom">
    <hr />
    *Note: To avoid duplicates, public feeds will not render your personal shifts.
    <%= link_to 'Reset Feeds', calendar_feed_reset_path, confirm: "Warning: This will reset all of your calendar feeds.\nThis action can not be undone."%>
</div>