Sha256: ad49e730225dd5fa5b37028b1cf26e30fb8837bd64d7764944498422005b2762

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

<p>
  <%= link_to root_path do %>
    &laquo; Experiments
  <% end %>
</p>

<h1><%= @participant %></h1>

<table>
  <thead>
    <tr>
      <th>Experiment</th>
      <th style="width: 20%;">Variant</th>
      <th style="width: 20%;">Converted</th>
      <th style="width: 20%;">Started</th>
    </tr>
  </thead>
  <tbody>
    <% FieldTest::Membership.where(participant: @participant).each do |membership| %>
      <tr>
        <td><%= link_to membership.experiment, experiment_path(membership.experiment) %></td>
        <td>
          <% experiment = FieldTest::Experiment.find(membership.experiment) rescue nil %>
          <% if experiment %>
            <%= form_for membership do |f| %>
              <%= f.select "variant", options_for_select(FieldTest::Experiment.find(membership.experiment).variants.map { |v| [v, v] }, membership.variant), {}, onchange: "this.form.submit()" %>
            <% end %>
          <% else %>
            <%= membership.variant %>
          <% end %>
        </td>
        <td>
          <% if membership.converted %>
            <span class="check">✓</span>
          <% end %>
        </td>
        <td>
          <% if membership.created_at > 1.day.ago %>
            <%= time_ago_in_words(membership.created_at, include_seconds: true) %> ago
          <% else %>
            <%= membership.created_at.to_formatted_s(:short) %>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
field_test-0.2.0 app/views/field_test/participants/show.html.erb