roseweixel/lacquer-lover

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

Summary

Maintainability
Test Coverage
<div class="row">
  <div class="col-md-3" style="height: 550px;">
    <div class="well" style="height: 100%; overflow: scroll;">
    <legend>Gift 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 %>
    </p>
    <% if @transaction.date_completed %>
      <p>
      <strong><%= @transaction.owner.first_name %> gave this lacquer to <%= @transaction.requester.first_name %> on:</strong> <%= @transaction.date_completed.strftime("%m/%d/%Y") %>
      </p>
    <% end %>
    <br>
    <br>
    <% if !['completed', 'acknowledged'].include? @transaction.state %>
      <p>
      <%= @transaction.owner.first_name %> has not yet given this lacquer to <%= @requester.first_name %>.
      </p>
    <% end %>
    </div>
  </div>
  
  <div class="col-md-6" style="height: 550px;">
    <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 gift</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" %>
          <br>
          <%= label_tag 'Subject' %>
          <%= text_field_tag 'subject', nil, :required => true, value: "Gift 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>