Fixed User CP cancel button and cleaned user views
This commit is contained in:
@@ -93,10 +93,4 @@ class UsersController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
def check_for_cancel
|
||||
if params[:commit] == 'cancel'
|
||||
redirect_to :back
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div class='module_header'>
|
||||
<h4>User Control Panel </h4>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %>
|
||||
@@ -18,7 +22,9 @@
|
||||
<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>Unhappy?</h3>
|
||||
<%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class =>'btn btn-danger' %>
|
||||
<h3>Unhappy?</h3>
|
||||
<%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class =>'btn btn-danger' %>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -11,24 +11,26 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.label :username %><br />
|
||||
<%= f.text_field :username %></p>
|
||||
<%= f.label :username %>
|
||||
<%= f.text_field :username %>
|
||||
|
||||
<p><%= f.label :is_admin %>
|
||||
<%= f.check_box :is_admin, {checked: @user.admin?} %></p>
|
||||
<p>
|
||||
Administrator <%= f.check_box :is_admin, {checked: @user.admin?} %>
|
||||
</p>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
<%= f.label :email %>
|
||||
<%= f.email_field :email %>
|
||||
<br/>
|
||||
|
||||
<% if action_name == "new" %>
|
||||
<p><%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
<%= f.label :password, "New password" %>
|
||||
<%= f.password_field :password %>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
<%= f.label :password_confirmation %>
|
||||
<%= f.password_field :password_confirmation %>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
<%= f.submit :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
<%= f.label :password, "New password" %>
|
||||
<%= f.password_field :password %>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
<%= f.label :password_confirmation %>
|
||||
<%= f.password_field :password_confirmation %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change password" %>
|
||||
<%= f.submit "Change password", :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<h2>Edit user</h2>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div class='module_header'>
|
||||
<h4>Edit User</h4>
|
||||
</div>
|
||||
|
||||
<%= render 'form' %>
|
||||
<p></p>
|
||||
<%= render 'passwords' %>
|
||||
<%= render 'form' %>
|
||||
<p></p>
|
||||
<%= render 'passwords' %>
|
||||
|
||||
<%= link_to 'All users', users_path %>
|
||||
<%= button_to 'All users', users_path, :class => 'btn', :method=> 'get' %>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div class='module_header'>
|
||||
<h1>All Users</h1>
|
||||
<h4>Users Administration</h4>
|
||||
</div>
|
||||
|
||||
<table id="users">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Login Count</th>
|
||||
<th>Last Sign In</th>
|
||||
<th>Admin</th>
|
||||
<th>Created At</th>
|
||||
<th>Last Edited</th>
|
||||
<th><strong>Username</strong></th>
|
||||
<th><strong>Email</strong</th>
|
||||
<th><strong>Login Count</strong></th>
|
||||
<th><strong>Last Sign In</strong></th>
|
||||
<th><strong>Admin</strong></th>
|
||||
<th><strong>Created At</strong></th>
|
||||
<th><strong>Last Edited</strong></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -27,14 +27,14 @@
|
||||
<th><%= user.admin? %></th>
|
||||
<th><%= user.created_at.to_s(:datetime).downcase %></th>
|
||||
<th><%= user.updated_at.to_s(:datetime).downcase %></th>
|
||||
<th><%= link_to "Edit", edit_user_path(user) %></th>
|
||||
<th><%= link_to "Delete", user, :method => :delete, :confirm => "Are you sure?" %></th>
|
||||
<th><%= button_to "Edit", edit_user_path(user), :class => 'btn', :method => "get" %></th>
|
||||
<th><%= button_to "Delete", user, :method => :delete, :confirm => "Are you sure?", :class => 'btn btn-danger', :method => "get" %></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div align="center"> <%= paginate(@users)%> </div>
|
||||
<p><%= link_to "New User", new_user_path %></p>
|
||||
<p><%= button_to "New User", new_user_path, :class => 'btn btn-primary', :method => "get" %></p>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<h2>Sign up</h2>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div class='module_header'>
|
||||
<h4>New User</h4>
|
||||
</div>
|
||||
|
||||
<%= render 'form' %>
|
||||
<br/>
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'All users', users_path %>
|
||||
<%= link_to 'All users', users_path %>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
<p><%= @user.username %></p>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div class='module_header'>
|
||||
|
||||
<h4>Users Administration</h4>
|
||||
</div>
|
||||
<p><%= @user.username %></p>
|
||||
<p><%= @user.email %></p>
|
||||
|
||||
@@ -8,7 +8,8 @@ Community::Application.routes.draw do
|
||||
root :to => 'categories#index', :via => :get
|
||||
end
|
||||
|
||||
devise_for :users
|
||||
devise_for :users, :controllers => {:registrations => "registrations"}
|
||||
|
||||
scope "/admin" do
|
||||
resources :users
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user