diff options
| author | hukl <contact@smyck.org> | 2009-10-07 21:03:28 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-10-07 21:03:28 +0200 |
| commit | 9dadc61cae2c4c01a97880e89ca86a0e760fc8d1 (patch) | |
| tree | 4c50bccc0339429d669a04e5dc3f2e735dfcb515 /app/views | |
| parent | a57fb0c2084885c35b7ba89917c37696e5df3b3f (diff) | |
implemented complete restful user management interface including functional tests. this enables basic user operation. note that only admins are allowed to create, edit, destroy other users
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/users/_admin_user_item.html.erb | 12 | ||||
| -rw-r--r-- | app/views/users/_user_item.html.erb | 4 | ||||
| -rw-r--r-- | app/views/users/create.html.erb | 2 | ||||
| -rw-r--r-- | app/views/users/destroy.html.erb | 2 | ||||
| -rw-r--r-- | app/views/users/edit.html.erb | 32 | ||||
| -rw-r--r-- | app/views/users/index.html.erb | 15 | ||||
| -rw-r--r-- | app/views/users/new.html.erb | 32 | ||||
| -rw-r--r-- | app/views/users/show.html.erb | 22 | ||||
| -rw-r--r-- | app/views/users/update.html.erb | 2 |
9 files changed, 104 insertions, 19 deletions
diff --git a/app/views/users/_admin_user_item.html.erb b/app/views/users/_admin_user_item.html.erb new file mode 100644 index 0000000..d882dc4 --- /dev/null +++ b/app/views/users/_admin_user_item.html.erb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | <tr> | ||
| 2 | <td><%= admin_user_item.login %></td> | ||
| 3 | <td> | ||
| 4 | <%= link_to "Show", user_path(admin_user_item) %> | ||
| 5 | <%= link_to( | ||
| 6 | "Destroy", | ||
| 7 | user_path(admin_user_item), | ||
| 8 | :method => "delete", | ||
| 9 | :confirm => "Are you sure to delete user: #{admin_user_item.login}?" | ||
| 10 | ) %> | ||
| 11 | </td> | ||
| 12 | </tr> \ No newline at end of file | ||
diff --git a/app/views/users/_user_item.html.erb b/app/views/users/_user_item.html.erb new file mode 100644 index 0000000..c3389ba --- /dev/null +++ b/app/views/users/_user_item.html.erb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | <tr> | ||
| 2 | <td><%= user_item.login %></td> | ||
| 3 | <td></td> | ||
| 4 | </tr> \ No newline at end of file | ||
diff --git a/app/views/users/create.html.erb b/app/views/users/create.html.erb deleted file mode 100644 index 48ea02e..0000000 --- a/app/views/users/create.html.erb +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | <h1>Users#create</h1> | ||
| 2 | <p>Find me in app/views/users/create.html.erb</p> | ||
diff --git a/app/views/users/destroy.html.erb b/app/views/users/destroy.html.erb deleted file mode 100644 index de4bd26..0000000 --- a/app/views/users/destroy.html.erb +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | <h1>Users#destroy</h1> | ||
| 2 | <p>Find me in app/views/users/destroy.html.erb</p> | ||
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 1881fbd..5b73242 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb | |||
| @@ -1,2 +1,30 @@ | |||
| 1 | <h1>Users#edit</h1> | 1 | <h1>Edit existing user</h1> |
| 2 | <p>Find me in app/views/users/edit.html.erb</p> | 2 | |
| 3 | <% form_for @user do |f| %> | ||
| 4 | <table id="new_node"> | ||
| 5 | <tr> | ||
| 6 | <td class="description">Login</td> | ||
| 7 | <td><%= f.text_field :login %></td> | ||
| 8 | </tr> | ||
| 9 | <tr> | ||
| 10 | <td class="description">E-Mail</td> | ||
| 11 | <td><%= f.text_field :email %></td> | ||
| 12 | </tr> | ||
| 13 | <tr> | ||
| 14 | <td class="description">Password</td> | ||
| 15 | <td><%= f.text_field :password %></td> | ||
| 16 | </tr> | ||
| 17 | <tr> | ||
| 18 | <td class="description">Confirm</td> | ||
| 19 | <td><%= f.text_field :password_confirmation %></td> | ||
| 20 | </tr> | ||
| 21 | <tr> | ||
| 22 | <td class="description">Admin?</td> | ||
| 23 | <td><%= f.check_box :admin %></td> | ||
| 24 | </tr> | ||
| 25 | <tr> | ||
| 26 | <td class="description"></td> | ||
| 27 | <td class="right"><%= f.submit "Create" %></td> | ||
| 28 | </tr> | ||
| 29 | </table> | ||
| 30 | <% end %> \ No newline at end of file | ||
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index f0b5b28..8526d84 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | <h1>Users</h1> | 1 | <h1>Users</h1> |
| 2 | 2 | ||
| 3 | <table> | 3 | <table id="user_list"> |
| 4 | <tr> | 4 | <tr> |
| 5 | <td>login</td> | 5 | <td>login</td> |
| 6 | </tr> | 6 | </tr> |
| 7 | <% @users.each do |user| %> | 7 | <%= user_list_by_admin_status %> |
| 8 | <tr> | 8 | </table> |
| 9 | <td><%= user.login %></td> | 9 | |
| 10 | </tr> | 10 | |
| 11 | <% end %> | 11 | <% content_for :subnavigation do %> |
| 12 | </table> \ No newline at end of file | 12 | <%= link_to "create", new_user_path %> |
| 13 | <% end %> \ No newline at end of file | ||
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index c21a1ad..0629641 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb | |||
| @@ -1,2 +1,30 @@ | |||
| 1 | <h1>Users#new</h1> | 1 | <h1>Create new user</h1> |
| 2 | <p>Find me in app/views/users/new.html.erb</p> | 2 | |
| 3 | <% form_for @user do |f| %> | ||
| 4 | <table id="new_node"> | ||
| 5 | <tr> | ||
| 6 | <td class="description">Login</td> | ||
| 7 | <td><%= f.text_field :login %></td> | ||
| 8 | </tr> | ||
| 9 | <tr> | ||
| 10 | <td class="description">E-Mail</td> | ||
| 11 | <td><%= f.text_field :email %></td> | ||
| 12 | </tr> | ||
| 13 | <tr> | ||
| 14 | <td class="description">Password</td> | ||
| 15 | <td><%= f.text_field :password %></td> | ||
| 16 | </tr> | ||
| 17 | <tr> | ||
| 18 | <td class="description">Confirm</td> | ||
| 19 | <td><%= f.text_field :password_confirmation %></td> | ||
| 20 | </tr> | ||
| 21 | <tr> | ||
| 22 | <td class="description">Admin?</td> | ||
| 23 | <td><%= f.check_box :admin %></td> | ||
| 24 | </tr> | ||
| 25 | <tr> | ||
| 26 | <td class="description"></td> | ||
| 27 | <td class="right"><%= f.submit "Create" %></td> | ||
| 28 | </tr> | ||
| 29 | </table> | ||
| 30 | <% end %> \ No newline at end of file | ||
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e5fa3ad..3055d24 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb | |||
| @@ -1,2 +1,20 @@ | |||
| 1 | <h1>Users#show</h1> | 1 | <h1>User: <%= @user.login %></h1> |
| 2 | <p>Find me in app/views/users/show.html.erb</p> | 2 | |
| 3 | <table id="new_node"> | ||
| 4 | <tr> | ||
| 5 | <td class="description">Login</td> | ||
| 6 | <td><%= @user.login %></td> | ||
| 7 | </tr> | ||
| 8 | <tr> | ||
| 9 | <td class="description">E-Mail</td> | ||
| 10 | <td><%= @user.email %></td> | ||
| 11 | </tr> | ||
| 12 | <tr> | ||
| 13 | <td class="description">Admin?</td> | ||
| 14 | <td><%= @user.admin ? "yes" : "no" %></td> | ||
| 15 | </tr> | ||
| 16 | </table> | ||
| 17 | |||
| 18 | <% content_for :subnavigation do %> | ||
| 19 | <%= link_to 'Edit', edit_user_path(@user) %> | ||
| 20 | <% end %> | ||
diff --git a/app/views/users/update.html.erb b/app/views/users/update.html.erb deleted file mode 100644 index cabbde1..0000000 --- a/app/views/users/update.html.erb +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | <h1>Users#update</h1> | ||
| 2 | <p>Find me in app/views/users/update.html.erb</p> | ||
