app/views/field_test/participants/show.html.erb in field_test-0.6.0 vs app/views/field_test/participants/show.html.erb in field_test-0.6.1

- old
+ new

@@ -8,24 +8,24 @@ <table> <thead> <tr> <th>Experiment</th> - <th style="width: 20%;">Variant</th> - <th style="width: 20%;">Converted</th> - <th style="width: 20%;">Started</th> + <th class="width-20">Variant</th> + <th class="width-20">Converted</th> + <th class="width-20">Started</th> </tr> </thead> <tbody> <% @memberships.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()" %> + <%= f.select "variant", options_for_select(FieldTest::Experiment.find(membership.experiment).variants.map { |v| [v, v] }, membership.variant) %> <% end %> <% else %> <%= membership.variant %> <% end %> </td> @@ -58,5 +58,14 @@ </td> </tr> <% end %> </tbody> </table> + +<%= javascript_tag nonce: true do %> + var selects = document.querySelectorAll(".edit_membership select"); + for (var i = 0; i < selects.length; i++) { + selects[i].addEventListener("change", function () { + this.form.submit(); + }); + } +<% end %>