<% if (description = tool.description) %> <% content_for(:tool_description) { sanitize(description).gsub(/\n/, "

").html_safe } %> <% end %> <% if coach.nil? %>

You will be able use this tool once you have been assigned a coach

<% elsif current_user || current_participant.active_membership.group.arm.can_message_after_membership_complete? || current_participant.in_study? %>
<%= link_to compose_path, class: "btn btn-primary" do %> <%= fa_icon "pencil" %> Compose <% end %>
<% end %>
<% if received_messages.empty? %>

No messages to display.

<% end %>
<% received_messages.each do |received_message| %> <%= link_to show_path.call(message_id: received_message.message_id), class: "list-group-item clearfix #{ received_message.is_read ? "text-muted" : "list-group-item-read" }" do %>
<%= truncate received_message.from, length: 18 %>
<%= received_message.subject %>
<%= received_message.created_at.to_s(:standard) %>
<% end %> <% end %>
<% if sent_messages.count > 0 %>
<% user = current_user || current_participant %> <% sent_messages.each do |msg| %> <%= link_to show_path.call(message_id: msg.id), class: "text-muted list-group-item clearfix" do %>
To: <%= truncate msg.to(user), length: 15 %>
<%= msg.subject %>
<%= msg.created_at.to_s(:standard) %>
<% end %> <% end %>
<% end %>