diff --git a/lib/split/dashboard.rb b/lib/split/dashboard.rb index ef02f1e8..478a2354 100755 --- a/lib/split/dashboard.rb +++ b/lib/split/dashboard.rb @@ -45,6 +45,12 @@ class Dashboard < Sinatra::Base redirect url('/') end + post '/reopen/:experiment' do + @experiment = Split::Experiment.find(params[:experiment]) + @experiment.reset_winner + redirect url('/') + end + delete '/:experiment' do @experiment = Split::Experiment.find(params[:experiment]) @experiment.delete diff --git a/lib/split/dashboard/public/dashboard.js b/lib/split/dashboard/public/dashboard.js index a64782ab..0f779046 100644 --- a/lib/split/dashboard/public/dashboard.js +++ b/lib/split/dashboard/public/dashboard.js @@ -16,4 +16,9 @@ function confirmWinner() { function confirmStep(step) { var agree = confirm(step); return agree ? true : false; -} \ No newline at end of file +} + +function confirmReopen() { + var agree = confirm("This will reopen the experiment. Are you sure?"); + return agree ? true : false; +} diff --git a/lib/split/dashboard/views/_controls.erb b/lib/split/dashboard/views/_controls.erb index 3be00041..47bc3563 100644 --- a/lib/split/dashboard/views/_controls.erb +++ b/lib/split/dashboard/views/_controls.erb @@ -1,3 +1,8 @@ +<% if experiment.has_winner? %> +
+<% end %> <% if experiment.start_time %>