Permalink
Browse files

delete now work for browsers without javascript

  • Loading branch information...
1 parent 0aad221 commit 3f8027b1a4e9c82dacd4edf640c3dac61d2c742c @guedes committed Mar 21, 2011
@@ -20,14 +20,14 @@ def edit
def create
@script_target = ScriptTarget.new(params[:script_target])
- flash[:notice] = 'Data collector was successfully created.' if @script_target.save
+ flash[:notice] = 'Script successfully associated.' if @script_target.save
respond_with @script_target
end
def update
@script_target = ScriptTarget.find(params[:id])
if @script_target.update_attributes(params[:script_target])
- flash[:notice] = 'Data collector was successfully updated.'
+ flash[:notice] = 'Configuration was successfully updated.'
end
respond_with @script_target
@@ -37,7 +37,7 @@ def destroy
@script_target = ScriptTarget.find(params[:id])
@script_target.destroy
- flash[:notice] = 'Data collector was successfully destroyed.'
+ flash[:notice] = 'Configuration was successfully destroyed.'
respond_with @script_target
end
@@ -20,7 +20,7 @@
</td>
<td><%= link_to 'Show', script_target %></td>
<td><%= link_to 'Edit', edit_script_target_path(script_target) %></td>
- <td><%= link_to 'Destroy', script_target, :confirm => 'Are you sure?', :method => :delete %></td>
+ <td><%= link_to 'Destroy', script_target_path(script_target, :destroy => true), :confirm => "Are you sure you want do destroy this?", :method => :delete %></td>
</tr>
<% end %>
</table>
@@ -12,5 +12,9 @@ called
<%= link_to @script_target.targetable_name, @script_target.targetable %>.
</p>
-<%= link_to 'Edit', edit_script_target_path(@script_target) %> |
-<%= link_to 'Back', script_targets_path %>
+<% if params[:destroy] %>
+ <%= render(:partial => 'shared/confirm_destroy', :locals => { :object_to_delete => @script_target }) %>
+<% else %>
+ <%= link_to 'Edit', edit_script_target_path(@script_target) %> |
+ <%= link_to 'Back', script_targets_path %>
+<% end %>
@@ -0,0 +1,11 @@
+<%= simple_form_for object_to_delete, :html => { :method => :delete } do |f| %>
+ <p class=notice>
+ Are you <b>sure</b> you want
+ to <b>destroy</b> this <%= object_to_delete.class.to_s.tableize.humanize %>?
+ </p>
+ <p>
+ <%= submit_tag "Destroy" %>
+ or
+ <%= link_to "Cancel", polymorphic_path(object_to_delete) %>
+ </p>
+<% end %>
View
@@ -1,14 +1,15 @@
Ganesha::Application.routes.draw do
- resources :scripts
+ devise_for :admins
- match '/script_targets/:targetable_type/new', :to => 'script_targets#new', :as => :new_targetable
+ resources :scripts
+
resources :script_targets
-
+ match '/script_targets/:targetable_type/new', :to => 'script_targets#new', :as => :new_targetable
+
resources :databases
-
- devise_for :admins
-
+
resources :instances
+
resources :servers
root :to => "servers#index"

0 comments on commit 3f8027b

Please sign in to comment.