fix for showing subroles

This commit is contained in:
Matthew K. Fu JuYuan 2012-11-26 10:08:06 +08:00
parent cc7907f37a
commit 046dbc9524
5 changed files with 12 additions and 8 deletions

View File

@ -22,6 +22,7 @@ class Admin::InfosController < ApplicationController
def edit def edit
@attribute = Info.find(params[:id]) @attribute = Info.find(params[:id])
@attribute_fields_upper_object = [@attribute]
render :template => 'admin/attributes/edit' render :template => 'admin/attributes/edit'
end end

View File

@ -5,7 +5,7 @@ class Admin::RolesController < ApplicationController
before_filter :is_admin? before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit] before_filter :set_attribute, :only => [:index, :show, :new, :edit]
helper Admin::AttributeValuesViewHelper helper Admin::AttributeValuesViewHelper
def index def index
@attributes = Role.all.entries @attributes = Role.all.entries
render :template => 'admin/attributes/index' render :template => 'admin/attributes/index'
@ -22,6 +22,7 @@ class Admin::RolesController < ApplicationController
def edit def edit
@attribute = Role.find(params[:id]) @attribute = Role.find(params[:id])
@attribute_fields_upper_object = @attribute.sub_roles
render :template => 'admin/attributes/edit' render :template => 'admin/attributes/edit'
end end

View File

@ -15,14 +15,16 @@
</div> </div>
</div> </div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%> <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%>
</div> </div>
</div> </div>
</div> </div>
<div class="map-block back attributes">
<h4><span><%= t("admin.attributes")%></span></h4> <% @attribute_fields_upper_object.each do |attribute|%>
<%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%> <div class="map-block back attributes">
</div> <h4><span><%= attribute.title+ t("admin.attributes")%></span></h4>
<%= render :partial=>"shared/attribute_field/attribute_field",:collection=>attribute.attribute_fields%>
</div>
<% end %>
</div> </div>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i,t("admin.infos.add_attribute_field"),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true%> <%= link_to content_tag(:i,t("admin.infos.add_attribute_field"),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true%>

View File

@ -1,5 +1,5 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<%= render 'admin/users/side_bar' %> <%= render 'admin/users_new_interface/side_bar' %>
<% end %> <% end %>
<div class="main_list"> <div class="main_list">

View File

@ -1,5 +1,5 @@
<% content_for :secondary do %> <% content_for :secondary do %>
<%= render 'admin/users/side_bar' %> <%= render 'admin/users_new_interface/side_bar' %>
<% end %> <% end %>
<div id="profile"> <div id="profile">