summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2011-08-27 16:02:37 +0200
committerAlex Legler <alex@a3li.li>2011-08-27 16:02:37 +0200
commit9810d2540658c81bb3fef2a989375d04254c0885 (patch)
tree248543689864b52b2737ce06e8c63ee4ff89f671
parentFix admin route and remove unused "bugzie" route (diff)
downloadglsamaker-9810d2540658c81bb3fef2a989375d04254c0885.tar.gz
glsamaker-9810d2540658c81bb3fef2a989375d04254c0885.tar.bz2
glsamaker-9810d2540658c81bb3fef2a989375d04254c0885.zip
Migrate user administration to rails 3
-rw-r--r--app/assets/stylesheets/admin.css (renamed from public/stylesheets/admin.css)3
-rw-r--r--app/assets/stylesheets/application.css1
-rw-r--r--app/views/admin/users/edit.html.erb15
-rw-r--r--app/views/admin/users/new.html.erb14
-rw-r--r--app/views/admin/users/show.html.erb2
5 files changed, 25 insertions, 10 deletions
diff --git a/public/stylesheets/admin.css b/app/assets/stylesheets/admin.css
index 734ebb1..28c0a9c 100644
--- a/public/stylesheets/admin.css
+++ b/app/assets/stylesheets/admin.css
@@ -22,7 +22,6 @@ table.user-table span.user-email {
}
#errorExplanation {
- width: 400px;
border: 2px solid #A40000;
padding: 5px;
margin-bottom: 20px;
@@ -46,7 +45,7 @@ table.user-table span.user-email {
}
#errorExplanation ul {
- margin: 0;
+ margin-bottom: 0;
}
#errorExplanation ul li {
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 9bc35ec..58fbcb5 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -4,5 +4,6 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require screen
+ *= require admin
*= require modalbox
*/ \ No newline at end of file
diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb
index 52e6f4e..aa5c7b5 100644
--- a/app/views/admin/users/edit.html.erb
+++ b/app/views/admin/users/edit.html.erb
@@ -1,9 +1,16 @@
<div class="box w40em">
<h2>Edit user</h2>
-<!-- <form action="/users/1" class="edit_user" id="edit_user_1" method="post"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="PP49hANhUN/JeBup4VnhNXzfU8yIGW1kLX+H8WitEyU=" /></div> -->
-
- <% form_for(:user, @user, :url => admin_user_path, :html=>{:method=>:put} ) do |f| %>
- <%= f.error_messages %>
+ <%= form_for([:admin, @user]) do |f| %>
+ <% if @user.errors.any? %>
+ <div id="errorExplanation" class="errorExplanation">
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this record from being saved:</h2>
+ <ul>
+ <% @user.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
<table>
<tr>
diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb
index 99458db..276cc61 100644
--- a/app/views/admin/users/new.html.erb
+++ b/app/views/admin/users/new.html.erb
@@ -1,9 +1,17 @@
<div class="box w40em">
<h2>New user</h2>
-<!-- <form action="/users/1" class="edit_user" id="edit_user_1" method="post"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="PP49hANhUN/JeBup4VnhNXzfU8yIGW1kLX+H8WitEyU=" /></div> -->
- <% form_for(:user, @user, :url => admin_users_path, :html=>{:method=>:post} ) do |f| %>
- <%= f.error_messages %>
+ <%= form_for([:admin, @user]) do |f| %>
+ <% if @user.errors.any? %>
+ <div id="errorExplanation" class="errorExplanation">
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this record from being saved:</h2>
+ <ul>
+ <% @user.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
<table>
<tr>
diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb
index 24ef7f3..becdd6e 100644
--- a/app/views/admin/users/show.html.erb
+++ b/app/views/admin/users/show.html.erb
@@ -30,5 +30,5 @@
</div>
<%= link_to 'Edit', edit_admin_user_path(@user) %> |
-<%= link_to 'Destroy', admin_user_path(@user), :confirm => 'Are you sure?', :method => :delete %> |
+<%= link_to 'Delete', admin_user_path(@user), :confirm => 'Are you sure?', :method => :delete %> |
<%= link_to 'Back', admin_users_path %> \ No newline at end of file