diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 1a1935d0d..8a4ce5286 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -42,6 +42,7 @@ class WatchersController < ApplicationController render :update do |page| page.replace_html 'ajax-modal', :partial => 'watchers/new', :locals => {:watched => @watched} page << "showModal('ajax-modal', '400px');" + page << "$('ajax-modal').addClassName('new-watcher');" end end end diff --git a/app/views/watchers/_watchers.html.erb b/app/views/watchers/_watchers.html.erb index 1f40707be..29cf7539b 100644 --- a/app/views/watchers/_watchers.html.erb +++ b/app/views/watchers/_watchers.html.erb @@ -5,7 +5,8 @@ :action => 'new', :object_type => watched.class.name.underscore, :object_id => watched}, - :method => 'get' %> + :method => 'get', + :before => "if ($('ajax-modal').hasClassName('new-watcher')) {showModal('ajax-modal'); return false;}" %> <% end %>