<%= javascript 'trends' %>
<% title _("Edit Trend %s") % @trend.to_label %>
<div class="col-md-6">
  <%= form_tag trend_path, :method => :put do %>
    <% if @trend.is_a?(FactTrend) %>
      <table class="table">
        <thead>
          <tr>
            <th style='width: 40%'><%= _("Fact Name") %></th>
            <th style="width: 60%"><%= _("Display Name") %></th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <%= fields_for "trend[]", @trend do |f| %>
              <td>
                <%= @trend.fact_name %>
              </td>
              <td>
                <%= f.text_field :name %>
              </td>
            <% end %>
          </tr>
        </tbody>
      </table>
    <% end %>
    <table class="table">
      <thead>
        <tr>
          <th style="width: 40%">Value</th>
          <th style="width: 60%"><%= _("Display Name") %></th>
        </tr>
      </thead>
      <tbody>
        <% @trend.values.each do |trend| %>
          <tr>
            <%= fields_for "trend[]", trend do |f| %>
              <%= render 'fields', :f => f, :trend => trend %>
            <% end %>
          </tr>
        <% end %>
      </tbody>
    </table>
    <%= link_to(_("Cancel"), trends_path, :class => "btn btn-default") %>
    <%= submit_tag _("Submit"), :class => "btn-primary btn" %>
  <% end %>
</div>
