Started cleanup user forms
the cancel button on user cp is not working yet. before_filter not called?
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :check_for_cancel
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :is_admin?
|
before_filter :is_admin?
|
||||||
|
|
||||||
@@ -92,4 +93,10 @@ class UsersController < ApplicationController
|
|||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_for_cancel
|
||||||
|
if params[:commit] == 'cancel'
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||||
<%= f.password_field :current_password %></p>
|
<%= 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 %>
|
<% end %>
|
||||||
|
|
||||||
<h3>Cancel my account</h3>
|
<h3>Unhappy?</h3>
|
||||||
|
<%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class =>'btn btn-danger' %>
|
||||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
|
||||||
|
|
||||||
<%= link_to "Back", :back %>
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
Confirm Password:<br />
|
Confirm Password:<br />
|
||||||
<%= f.password_field :password_confirmation, :autocomplete => "off" %><br />
|
<%= f.password_field :password_confirmation, :autocomplete => "off" %><br />
|
||||||
</p>
|
</p>
|
||||||
<p><%= f.submit "Sign up" %></p>
|
<p><%= f.submit "Sign up", :class=> 'btn btn-primary' %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<%= form_for("user", :url => user_session_path) do |f| %>
|
<%= form_for("user", :url => user_session_path) do |f| %>
|
||||||
<p><%= f.text_field :username , :value => "username" %></p>
|
<p><%= f.text_field :username , :value => "username" %></p>
|
||||||
<p><%= f.password_field :password, :value => "password" %></p>
|
<p><%= f.password_field :password, :value => "password" %></p>
|
||||||
<%= f.submit 'Sign in' %>
|
<%= f.submit 'Sign in', :class =>'btn btn-primary' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user