first commit for object auth,will take new_blog for experiment

This commit is contained in:
Matthew Kaito Juyuan Fu authored and Christophe Vilayphiou committed 2012-02-15 00:34:21 +08:00
1 parent c3e57f8bde
commit 3ed9b81df9
11 files changed
+271 -122

No files matched your search

@@ -0,0 +1,34 @@
<div id="user_role_management">
<%#= debugger %>
<h1>User Role</h1>
<%= debugger %>
<%= form_tag(polymorphic_path([controller_path.split('/')[0],object,auth.class.name.underscore]),:method => :post) do %>
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add Role' %><br/>
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add SubRole' %><br/>
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add PrivilegeList' %><br/>
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/>
<% end %>
<ul>Roles </ul>
<% unless auth.nil? %>
<% auth.roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %>
<%= link_to '[X]',polymorphic_path(['remove',:admin,object,auth],:type=>'role',:target_id=>role.id),:method => :delete %></li>
<% end %>
<ul>Sub Roles </ul>
<% auth.sub_roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> </li><%= link_to '[X]',polymorphic_path(['remove',:admin,object,auth],:type=>'sub_role',:target_id=>role.id),:method => :delete %>
<% end %>
<ul>PrivilegeList </ul>
<% auth.privilege_users.each do |user| %>
<li> <%= user.name %> <%= link_to '[X]',polymorphic_path(['remove',:admin,object,auth],:type=>'privilege_user',:target_id=>user.id),:method => :delete %> </li>
<% end %>
<ul>BlockedList </ul>
<% auth.blocked_users.each do |user| %>
<li> <%= user.name %><%= link_to '[X]',polymorphic_path(['remove',:admin,object,auth],:type=>'blocked_user',:target_id=>user.id),:method => :delete %> </li>
<% end %>
<% end %>
</div>
+2 -31
View File
@@ -36,34 +36,5 @@
</dd>
</dl>
</div>
<div id="user_role_management">
<h1>User Role</h1>
<%= form_tag(admin_module_app_app_auths_path(@module_app),:method => :post) do %>
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add Role' %><br/>
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add SubRole' %><br/>
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add PrivilegeList' %><br/>
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %>
<%= submit_tag 'Add BlockedList' %><br/>
<% end %>
<ul>Roles </ul>
<% unless @module_app.app_auth.nil? %>
<% @module_app.app_auth.roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> <%= link_to '[X]',remove_admin_module_app_app_auth_path(@module_app,@module_app.app_auth,'role',role),:method => :delete %></li>
<% end %>
<ul>Sub Roles </ul>
<% @module_app.app_auth.sub_roles.each do |role| %>
<li> <%= role.key %> Build in:<%= role.built_in ? 'Yes' : 'No' %> </li><%= link_to '[X]',remove_admin_module_app_app_auth_path(@module_app,@module_app.app_auth,'sub_role',role),:method => :delete %>
<% end %>
<ul>PrivilegeList </ul>
<% @module_app.app_auth.privilege_users.each do |user| %>
<li> <%= user.name %> <%= link_to '[X]',remove_admin_module_app_app_auth_path(@module_app,@module_app.app_auth,'privilege_user',user),:method => :delete %> </li>
<% end %>
<ul>BlockedList </ul>
<% @module_app.app_auth.blocked_users.each do |user| %>
<li> <%= user.name %><%= link_to '[X]',remove_admin_module_app_app_auth_path(@module_app,@module_app.app_auth,'blocked_user',user),:method => :delete %> </li>
<% end %>
<% end %>
</div>
<%= render :partial => "admin/components/user_role_management", :locals => { :object => @module_app ,:auth=> @module_app.app_auth } %>
@@ -0,0 +1,3 @@
<div class="auth_unit">
<%= unit%>
<div>
@@ -0,0 +1,13 @@
<% content_for :secondary do %>
<% end %>
<!-- Remove if CSS done-->
<br />
<br />
<br />
<!-- Remove if CSS done-->
<h3><%= @object_auth.title %></h3>
<%= render :partial => "admin/components/user_role_management", :locals => { :object => @object_auth.auth_obj ,:auth=> @object_auth } %>
@@ -0,0 +1,39 @@
<% content_for :secondary do %>
<% #render 'side_bar' %>
<% end %>
<div class="main_list">
<%= flash_messages %>
<div class="button_bar up">
<% #link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
</div>
<table>
<thead>
<tr>
<td><%= t('admin.object_auth.title') %></td>
<td><%= t('admin.object_auth.obj_type') %></td>
</tr>
</thead>
<tbody>
<% @object_auths.each do |object_auth| %>
<tr>
<td class="name"><%= object_auth.title %></td>
<td class="name"><%= object_auth.obj_authable_type.to_s %></td>
<td class="action">
<%= link_to t(:show), admin_object_auth_path(object_auth), :class => 'show' %>
<%= link_to t(:edit), edit_admin_object_auth_path(object_auth), :class => 'edit' %>
<%= link_to t(:delete), admin_object_auth_path(object_auth), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
</td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<% end %>
</tbody>
</table>
<div class="button_bar">
<%# link_to t('admin.new_user'), new_admin_user_path, :class => 'new' %>
</div>
</div>