From 9a684f54b441f28f84046c5f90c72859093b9d88 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 26 Nov 2012 10:08:06 +0800 Subject: [PATCH] fix for showing subroles --- app/controllers/admin/infos_controller.rb | 1 + app/controllers/admin/roles_controller.rb | 3 ++- app/views/admin/attributes/edit.html.erb | 12 +++++++----- app/views/admin/attributes/index.html.erb | 2 +- app/views/admin/attributes/new.html.erb | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb index cec5c5f4..c08d1386 100644 --- a/app/controllers/admin/infos_controller.rb +++ b/app/controllers/admin/infos_controller.rb @@ -22,6 +22,7 @@ class Admin::InfosController < ApplicationController def edit @attribute = Info.find(params[:id]) + @attribute_fields_upper_object = [@attribute] render :template => 'admin/attributes/edit' end diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index abae1ece..3e8576c6 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -5,7 +5,7 @@ class Admin::RolesController < ApplicationController before_filter :is_admin? before_filter :set_attribute, :only => [:index, :show, :new, :edit] helper Admin::AttributeValuesViewHelper - + def index @attributes = Role.all.entries render :template => 'admin/attributes/index' @@ -22,6 +22,7 @@ class Admin::RolesController < ApplicationController def edit @attribute = Role.find(params[:id]) + @attribute_fields_upper_object = @attribute.sub_roles render :template => 'admin/attributes/edit' end diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb index f74890dc..44ec57df 100644 --- a/app/views/admin/attributes/edit.html.erb +++ b/app/views/admin/attributes/edit.html.erb @@ -15,14 +15,16 @@ <%= 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]"}%> - -
-

<%= t("admin.attributes")%>

- <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%> -
+ + <% @attribute_fields_upper_object.each do |attribute|%> +
+

<%= attribute.title+ t("admin.attributes")%>

+ <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>attribute.attribute_fields%> +
+ <% end %>
<%= 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%> diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb index 41ed6e12..e51d903b 100644 --- a/app/views/admin/attributes/index.html.erb +++ b/app/views/admin/attributes/index.html.erb @@ -1,5 +1,5 @@ <% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> + <%= render 'admin/users_new_interface/side_bar' %> <% end %>
diff --git a/app/views/admin/attributes/new.html.erb b/app/views/admin/attributes/new.html.erb index 2e96e8f9..8cafdb59 100644 --- a/app/views/admin/attributes/new.html.erb +++ b/app/views/admin/attributes/new.html.erb @@ -1,5 +1,5 @@ <% content_for :secondary do %> - <%= render 'admin/users/side_bar' %> + <%= render 'admin/users_new_interface/side_bar' %> <% end %>