Started inital migration to rails 3.2
This commit is contained in:
34
app/views/users/_form.html.erb
Executable file
34
app/views/users/_form.html.erb
Executable file
@@ -0,0 +1,34 @@
|
||||
<%= form_for(@user) do |f| %>
|
||||
<% if @user.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @user.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.label :username %><br />
|
||||
<%= f.text_field :username %></p>
|
||||
|
||||
<p><%= f.label :is_admin %>
|
||||
<%= f.check_box :is_admin, {checked: @user.admin?} %></p>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<% if action_name == "new" %>
|
||||
<p><%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
23
app/views/users/_passwords.html.erb
Executable file
23
app/views/users/_passwords.html.erb
Executable file
@@ -0,0 +1,23 @@
|
||||
<%= form_for(@user) do |f| %>
|
||||
<% if @user.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @user.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p><%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change password" %>
|
||||
</div>
|
||||
<% end %>
|
||||
7
app/views/users/edit.html.erb
Executable file
7
app/views/users/edit.html.erb
Executable file
@@ -0,0 +1,7 @@
|
||||
<h2>Edit user</h2>
|
||||
|
||||
<%= render 'form' %>
|
||||
<p></p>
|
||||
<%= render 'passwords' %>
|
||||
|
||||
<%= link_to 'All users', users_path %>
|
||||
36
app/views/users/index.html.erb
Executable file
36
app/views/users/index.html.erb
Executable file
@@ -0,0 +1,36 @@
|
||||
<h1>All Users</h1>
|
||||
|
||||
<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></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<th><%= user.username %></th>
|
||||
<th><%= user.email %></th>
|
||||
<th><%= user.sign_in_count %></th>
|
||||
<th><%if user.last_sign_in_at.blank? %>Never logged in<% else %><%= time_ago_in_words(user.last_sign_in_at.to_datetime)+' ago' %><% end %></th>
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<p><%= link_to "New User", new_user_path %></p>
|
||||
5
app/views/users/new.html.erb
Executable file
5
app/views/users/new.html.erb
Executable file
@@ -0,0 +1,5 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'All users', users_path %>
|
||||
2
app/views/users/show.html.erb
Executable file
2
app/views/users/show.html.erb
Executable file
@@ -0,0 +1,2 @@
|
||||
<p><%= @user.username %></p>
|
||||
<p><%= @user.email %></p>
|
||||
Reference in New Issue
Block a user