diff --git a/app/controllers/janitor_trials_controller.rb b/app/controllers/janitor_trials_controller.rb index 89816de43..73a234cd7 100644 --- a/app/controllers/janitor_trials_controller.rb +++ b/app/controllers/janitor_trials_controller.rb @@ -19,18 +19,22 @@ class JanitorTrialsController < ApplicationController def create @janitor_trial = JanitorTrial.create(params[:janitor_trial]) - respond_with(@janitor_trial) + respond_with(@janitor_trial, :location => janitor_trials_path) end def promote @janitor_trial = JanitorTrial.find(params[:id]) @janitor_trial.promote! - respond_with(@janitor_trial) + respond_with(@janitor_trial) do |format| + format.js + end end def demote @janitor_trial = JanitorTrial.find(params[:id]) @janitor_trial.demote! - respond_with(@janitor_trial) + respond_with(@janitor_trial) do |format| + format.js + end end end diff --git a/app/models/janitor_trial.rb b/app/models/janitor_trial.rb index f11323599..91d44d22f 100644 --- a/app/models/janitor_trial.rb +++ b/app/models/janitor_trial.rb @@ -15,6 +15,10 @@ class JanitorTrial < ActiveRecord::Base self.original_level = user.level end + def user_name + user.try(:name) + end + def user_name=(name) self.user_id = User.name_to_id(name) end diff --git a/app/views/janitor_trials/_secondary_links.html.erb b/app/views/janitor_trials/_secondary_links.html.erb new file mode 100644 index 000000000..3a4492509 --- /dev/null +++ b/app/views/janitor_trials/_secondary_links.html.erb @@ -0,0 +1,6 @@ +<% content_for(:secondary_links) do %> +
+<% end %> diff --git a/app/views/janitor_trials/demote.js.erb b/app/views/janitor_trials/demote.js.erb new file mode 100644 index 000000000..345366b9b --- /dev/null +++ b/app/views/janitor_trials/demote.js.erb @@ -0,0 +1 @@ +location.reload(); diff --git a/app/views/janitor_trials/index.html.erb b/app/views/janitor_trials/index.html.erb index cc5949421..a60f0e9a8 100644 --- a/app/views/janitor_trials/index.html.erb +++ b/app/views/janitor_trials/index.html.erb @@ -2,7 +2,7 @@| User | @@ -14,7 +14,7 @@ <% @janitor_trials.each do |janitor_trial| %>|||
|---|---|---|---|
| <%= janitor_trial.user.name %> | -<%= janitor_trial.created_at %> | +<%= time_ago_in_words janitor_trial.created_at %> | <%= link_to "Promote", promote_janitor_trial_path(janitor_trial), :remote => true, :method => :put %> | <%= link_to "Demote", demote_janitor_trial_path(janitor_trial), :remote => true, :method => :put %> @@ -25,3 +25,5 @@ |