<% if (description = tool.description) %> <% content_for(:tool_description) { sanitize(description).gsub(/\n/, "<br><br>").html_safe } %> <% end %> <h1> Lessons <small> Week <%= week_in_study %> </small> </h1> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <% weekly_tasks.each do |tasks| %> <div class="panel panel-default <%= 'panel-info' if week_in_study == tasks[:week] %>"> <div class="panel-heading" role="tab" id="heading<%= tasks[:week] %>"> <a data-toggle="collapse" data-parent="#accordion" href="#collapse<%= tasks[:week] %>" aria-expanded="true" aria-controls="collapse<%= tasks[:week] %>"> <h3 class="panel-title<%= ' panel-unreleased' if week_in_study < tasks[:week] %> "> Week <%= tasks[:week] %> · <%= tasks[:date].to_s(:participant_date) %> <span class="badge"><%= tasks[:tasks].select { |t| t.completed_at.nil? }.count %> unread</span> </h3> </a> </div> <div id="collapse<%= tasks[:week] %>" class="panel-collapse collapse <%= 'in' if week_in_study == tasks[:week] %>" role="tabpanel" aria-labelledby="heading<%= tasks[:week] %>"> <div class="list-group"> <% if tasks[:tasks].count == 0 %> <div class="panel-body"> No lessons exist for this week. </div> <% else %> <% tasks[:tasks].each do |ts| %> <% release_date = ts.available_for_learning_on %> <% if release_date <= Date.today %> <span class="list-group-item task-status enabled"> <%= link_to create_task_path(ts), class: "task-status", id: "task-status-#{ ts.id }", data: { :"task-status-id" => ts.id } do %> <h4 class="list-group-item-heading"> <span class="lesson <%= ts.completed_at ? "read" : "unread" %>"><%= ts.task.bit_core_content_module.pretty_title %></span> </h4> <% end %> <p class="list-group-item-text"> <% if release_date < Date.today %> Released on <%= release_date.to_s(:participant_date) %> <% elsif release_date == Date.today %> Released Today <% end %> <% if ts.completed_at %> · Read on <%= ts.completed_at.to_s(:participant_date) %> <span class="visible-md-inline visible-lg-inline"> · <%= link_to "Printable", think_feel_do_engine.participants_lesson_path(ts.bit_core_content_module.id), class: "action" %> </span> <% end %> </p> </span> <% else %> <span class="list-group-item task-status disabled" id="task-status-<%= ts.id %>" data-task-status-id="<%= ts.id %>"> <h4 class="list-group-item-heading"> <span class="lesson unread"><%= ts.task.bit_core_content_module.pretty_title %></span> </h4> <p class="list-group-item-text"> Available on <%= release_date.to_s(:participant_date) %> </p> </span> <% end %> <% end %> <% end %> </div> </div> </div> <% end %> </div>