roseweixel/lacquer-lover

View on GitHub
app/views/users/new_transactional_message.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
  <div class="col-md-3" style="height: 560px;">
    <div class="well" style="height: 100%; overflow: scroll;">
    <legend>Transaction Details:</legend>
    <p>
      <strong>Lacquer:</strong> <%= @transaction.lacquer.name %> (<%= @transaction.lacquer.brand.name %>)
      <p style="text-align: center; background-color: #ccc; padding: 5px 0;">
      <%= picture_for(@transaction.lacquer) %>
      </p>
    </p>
    <p>
      <strong>Owner:</strong> <%= @transaction.owner.name %>
    </p>
    <p>
      <strong>Requester:</strong> <%= @transaction.requester.name %>
    </p>
    <p>
      <strong>Date Initiated:</strong> <%= @transaction.created_at.strftime("%m/%d/%Y") %>
    </p>
    <p>
      <strong>Status:</strong> <%= @transaction.state_string %>
    </p>
    <p>
      <strong>Date transaction became active:</strong><br>
      <% if @transaction.date_became_active %>
        <%= @transaction.owner.name %> loaned <%= @transaction.lacquer.name %> to <%= @transaction.requester.name %> on <%= @transaction.date_became_active.strftime("%m/%d/%Y") %><br>
        <% if @transaction.due_date %>
        <br>
          <strong>Due Date:</strong> <%= @transaction.due_date.strftime("%m/%d/%Y") %>
        <% else %>
        <br>
          <strong>Due Date:</strong> No due date has been set
        <% end %>
      <% else %>
        <%= @transaction.owner.name %> has not yet loaned <%= @transaction.lacquer.name %> to <%= @transaction.requester.name %>
      <% end %>
    </p>
    <% if @transaction.state == 'completed' %>
      <p>
      <strong>Completed on:</strong> <%= @transaction.date_ended.strftime("%m/%d/%Y") %>
      </p>
    <% end %>
    </div>
  </div>
  
  <div class="col-md-7" style="height: 560px;">
    <div class="well" style="height: 100%; overflow: scroll;">
      <fieldset>
        <legend style="font-size: 1.25em;">Send an email message to <strong><%= @other_user.name %></strong> about this transaction</legend>

        <%= form_tag send_transactional_message_path, class:"form-horizontal" do %>
          <%= label_tag 'Your email address' %>
          <%= select_tag 'reply_address', options_for_select([@user.email, "other email address", "do not provide a reply address"]), class:"form-control", id:"email-options" %>
          <%= text_field_tag 'other_reply_address', nil, placeholder: "email address for reply", class:"form-control other-email", style:"display: none;" %>
          <br>
          <%= label_tag 'Subject' %>
          <%= text_field_tag 'subject', nil, :required => true, value: "Transaction for #{@transaction.lacquer.name}", class:"form-control" %>
          <br>
          <%= label_tag 'Message' %>
          <%= text_area_tag 'body', nil, :required => true, placeholder: "Your message to #{@other_user.first_name}", class:"form-control", style:"height: 150px;" %><br>

          <%= hidden_field_tag :to_address, @other_user.email %>
          <%= hidden_field_tag :to_name, @other_user.name %>
          <%= hidden_field_tag :transaction_id, @transaction.id %>
          <%= submit_tag "Send", class:"btn btn-default" %>

        <% end %>
      </fieldset>
    </div>
  </div>
</div>