Add UserAttribute model, suppose it will store user model want to use which attribute group

This commit is contained in:
Wen-Tien Chang committed 2010-03-04 17:11:18 +08:00
1 parent 13065aa85a
commit 9f1de1b543
5 files changed
+32 -3

No files matched your search

+2
View File
@@ -3,4 +3,6 @@ class User
devise :authenticatable, :recoverable, :rememberable, :trackable
key :use_attributes
end
+9
View File
@@ -0,0 +1,9 @@
class UserAttribute
include MongoMapper::Document
key :ident, String
key_i18n :name, String
key_i18n :attrs, Array
end
+7 -2
View File
@@ -8,16 +8,21 @@
<table>
<tr>
<th>Name</th>
<th>Attrs</th>
<th>Name</th>
<th>Email</th>
<th>Action</th>
</tr>
<% @users.each do |user| %>
<tr>
<td><%= user.use_attributes.join(",") %></td>
<td><%#= user.name %></td>
<td><%= user.email %></td>
<td><%= link_to 'Edit', edit_panel_user_path(user) %> | <%= link_to 'Destroy', panel_user_path(user), :method => :delete %></td>
<td>
<%= link_to 'Show', panel_user_path(user) %>
<%= link_to 'Edit', edit_panel_user_path(user) %> |
<%= link_to 'Destroy', panel_user_path(user), :method => :delete %></td>
</tr>
<% end %>
</table>
+10
View File
@@ -0,0 +1,10 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:new_user, :scope => :panel), new_panel_user_path, :class => 'button positive' %></li>
</ul>
<% end -%>
<h1>Users panel</h1>
<%=h @user.name %>
<%=h @user.email %>