
<%
  @log = decorate(@log, LogDecorator)
  @recipe = @log.recipe
%>

<div class="recipe-view">

  <div class="row">
    <div class="col-xs-12">
      <div class="page-header">
        <h1>
          [Log Entry] <%= @recipe.name %>
        </h1>
      </div>

      <p>Date: <%= @log.date %></p>
      <p>Rating: <%= text_field_tag('rating', @log.rating, disabled: true, data: {rating: true}) %></p>
      <p>Notes: <%= @log.notes %></p>

      <p class="lead">
        <%= @recipe.description %>
      </p>
    </div>
  </div>

  <div class="row">
    <% if @recipe.total_time.present? || @recipe.active_time.present? %>
      <div class="col-xs-3">
        <p><%= recipe_time(@recipe) %></p>
      </div>
    <% end %>

    <% if @recipe.yields.present? %>
      <div class="col-xs-3">
        <p>Yields</p><p><%= @recipe.yields  %></p>
      </div>
    <% end %>

    <% if @recipe.source.present? %>
      <div class="source">
        <p>Source</p><p><%= @recipe.source_markup  %></p>
      </div>
    <% end %>

  </div>

  <div class="row">
    <div class="col-xs-12 col-sm-5 col-md-4">
      <div class="panel panel-default">
        <div class="panel-heading">

          <div class="row">
            <h3 class="panel-title col-xs-7">Ingredients</h3>
          </div>


        </div>
        <div class="panel-body">
          <ul class="ingredients">
            <% @recipe.recipe_ingredients.each do |i| %>
              <li><div><%= i.display_name %></div></li>
            <% end %>
          </ul>
        </div>
      </div>

    </div>

    <div class="col-xs-12 col-sm-7 col-md-8">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Directions</h3>
        </div>
        <div class="panel-body steps">
          <%= @recipe.step_text %>
        </div>
      </div>
    </div>
  </div>

</div>

<div class="row">
  <div class="col-xs-12">

    <%= link_to 'Edit', edit_log_path(@log), class: 'btn btn-default' %>
    <%= link_to 'Back', logs_path, class: 'btn btn-default' %>

  </div>
</div>

