Started cleanup user forms

the cancel button on user cp is not working yet. before_filter not
called?
This commit is contained in:
2013-01-22 11:38:35 -05:00
parent 8783ed2015
commit b3b954df34
4 changed files with 14 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
class UsersController < ApplicationController
before_filter :check_for_cancel
before_filter :authenticate_user!
before_filter :is_admin?
@@ -92,4 +93,10 @@ class UsersController < ApplicationController
redirect_to root_path
end
end
def check_for_cancel
if params[:commit] == 'cancel'
redirect_to :back
end
end
end

View File

@@ -15,11 +15,10 @@
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password %></p>
<p><%= f.submit "Update" %></p>
<p>
<%= f.submit "Update", :class=> 'btn btn-primary'%> <%= button_tag "Cancel", :confirm => 'Are you sure? Any changes will be lost.', :class => 'btn', :type => 'submit', :name => 'commit', :value => 'cancel' %>
</p>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= link_to "Back", :back %>
<h3>Unhappy?</h3>
<%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class =>'btn btn-danger' %>

View File

@@ -22,7 +22,7 @@
Confirm Password:<br />
<%= f.password_field :password_confirmation, :autocomplete => "off" %><br />
</p>
<p><%= f.submit "Sign up" %></p>
<p><%= f.submit "Sign up", :class=> 'btn btn-primary' %></p>
<% end %>
</div>
<div class="clear"></div>

View File

@@ -26,7 +26,7 @@
<%= form_for("user", :url => user_session_path) do |f| %>
<p><%= f.text_field :username , :value => "username" %></p>
<p><%= f.password_field :password, :value => "password" %></p>
<%= f.submit 'Sign in' %>
<%= f.submit 'Sign in', :class =>'btn btn-primary' %>
<% end %>
</div>
<div class="clear"></div>