Remove i18n_variable for views

This commit is contained in:
Christophe Vilayphiou 2012-07-26 05:58:09 +08:00
parent 49dd3a1770
commit 53cae0a9ee
32 changed files with 64 additions and 63 deletions

View File

@ -35,7 +35,7 @@ class User
# if(self.cache_dept.nil?)
# self.build_cache_dept key: "dept_cache_user_#{self.id}"
# end
dept_hash[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',')
dept_hash[locale] = sub_roles.collect{|sr| sr.title}.join(',')
# self.cache_dept[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',')
end
self.cache_dept = dept_hash

View File

@ -8,7 +8,7 @@
<div class="modal-body">
<p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
<%= image_tag ad_image.file,:alt => (ad_image.title || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
<% end -%>
</p>
</div>

View File

@ -9,7 +9,7 @@
<div class="modal-body">
<p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
<%= image_tag ad_image.file,:alt => (ad_image.title || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
<% end -%>
</p>
</div>

View File

@ -142,14 +142,14 @@
<% @site_valid_locales.each do |locale|%>
<%= content_tag :div,:class => "tab-pane #{active_when_current_locale_eq locale}",:id=>"#{locale}" do%>
<div class="title">
<%= f.fields_for :title,@ad_image.title do |f| %>
<%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%>
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class=>"ad_image-title post-title", :placeholder => "輸入標題", :value => (@ad_image.title_translations[locale] rescue nil) %>
<% end %>
</div>
<br/>
<div class="context editor">
<%= f.fields_for :context, @ad_image.context do |f| %>
<%= f.text_area locale,:style => "width:100%", :class => "tinymce_textarea post-title" %>
<%= f.fields_for :context_translations, @ad_image.context do |f| %>
<%= f.text_area locale, :style => "width:100%", :class => "tinymce_textarea post-title", :value => (@ad_image.context_translations[locale] rescue nil) %>
<% end %>
</div>

View File

@ -12,6 +12,6 @@
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= asset_category.i18n_variable[locale] rescue nil %></td>
<td><%= asset_category.title_translations[locale] rescue nil %></td>
<% end %>
</tr>

View File

@ -10,12 +10,12 @@
</div>
<div id="widget-title">
<%= f.fields_for :i18n_variable, (@asset_category.new_record? ? @asset_category.build_i18n_variable : @asset_category.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'input-xxlarge' %>
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@asset_category.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>

View File

@ -1,6 +1,6 @@
<tr id="asset_<%= asset.id %>" class="with_action">
<td><%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %></td>
<td><%= asset.title.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= asset.title rescue nil %></td>
<td>
<i class="icons-picture img-peview" rel="popover" data-content="<img src='<%= asset.data.url %>' />" data-original-title="<%= asset.data.filename %>"></i>
<div class="quick-edit">
@ -12,7 +12,7 @@
</td>
<td><%= asset.data.file.content_type %></td>
<td><%= number_to_human_size(asset.data.file.file_length) %></td>
<td><%= asset.description.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= asset.description rescue nil %></td>
<td>
<div class="label-group">
<div class="label-td">

View File

@ -1,12 +1,12 @@
<div class="control-group">
<label for="title" class="control-label"><%= t 'admin.title' %></label>
<div class="controls">
<%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= content_tag :label do -%>
<div>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class => "input-large" %>
<%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %>
</div>
<% end %>
<% end %>
@ -16,7 +16,7 @@
<div class="control-group">
<label class="control-label"><%= f.label :category, t('admin.category') %></label>
<div class="controls">
<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %>
<%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.title, t.id ]}, {}, :class => "input-large" %>
</div>
</div>
<div class="control-group">

View File

@ -11,13 +11,13 @@
<div class="control-group">
<label for="title" class="control-label error"><%= t 'admin.title' %></label>
<div class="controls">
<%= f.fields_for :title, (@asset.new_record? ? @asset.build_title : @asset.title) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<div>
<% @site_valid_locales.each do |locale| %>
<%= content_tag :label do -%>
<div>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class => "input-large" %>
<%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %>
</div>
<% end %>
<% end %>
@ -28,13 +28,13 @@
<div class="control-group">
<label for="description" class="control-label error"><%= t 'admin.description' %></label>
<div class="controls">
<%= f.fields_for :description, (@asset.new_record? ? @asset.build_description : @asset.description) do |f| %>
<%= f.fields_for :description_translations do |f| %>
<div>
<% @site_valid_locales.each do |locale| %>
<%= content_tag :label do -%>
<div>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class => "input-large" %>
<%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %>
</div>
<% end %>
<% end %>

View File

@ -3,9 +3,9 @@
<td class='select_mulitlingual' style='text-align:center'>
<%= f.check_box :locale %>
</td>
<%= f.fields_for :i18n_variable, (attribute_field.new_record? ? attribute_field.build_i18n_variable : attribute_field.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale, :style => "width:130px" %></td>
<td><%= f.text_field locale, :style => "width:130px", :value => (attribute_field.title_translations[locale] rescue nil) %></td>
<% end %>
<% end %>
<td class='select_type'>

View File

@ -16,7 +16,7 @@
<tbody>
<% @attributes.each do |attribute| %>
<tr id="attribute_<%= attribute.id %>" class="have <%= "#{attribute.is_disabled? ? 'disable' : ''}" %>">
<td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span>
<td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.title %></span>
<td class="action">
<%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %>

View File

@ -514,7 +514,7 @@
<tbody>
<% @recent_updated.each do |object| %>
<tr>
<td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td>
<td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td>
<td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td>
</tr>
<% end %>
@ -552,7 +552,7 @@
<tbody>
<% @most_visited.each do |object| %>
<tr>
<td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td>
<td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td>
<td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td>
<td class="span2"><%= object[1] %></td>
</tr>

View File

@ -13,9 +13,9 @@
<tbody>
<tr class="list_item">
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td>
<%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale, :style => "width:150px" %></td>
<td><%= f.text_field locale, :style => "width:150px", :value => (@attribute.title_translations[locale] rescue nil) %></td>
<% end %>
<% end %>
</tr>

View File

@ -6,11 +6,11 @@
<%= f.text_field :name, :class => 'text' %>
</p>
<%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<p>
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %>
<%= f.text_field locale %>
<%= f.text_field locale, :value => (@item.title_translations[locale] rescue nil) %>
</p>
<% end %>
<% end %>

View File

@ -7,7 +7,7 @@
<% @site_valid_locales.each do |locale| %>
<p>
<b><%= "#{t('admin.title')} #{locale}" %></b>
<%= @item.i18n_variable[locale] if @item.i18n_variable %>
<%= @item.title_translations[locale] if @item.title %>
</p>
<% end %>

View File

@ -1,3 +1,3 @@
$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>");
$('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, {:include_blank => true}) if @categories %>");
$('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.title, category.id]}, {:include_blank => true}) if @categories %>");
$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>");

View File

@ -1,9 +1,9 @@
<div>
<%= f.fields_for :title, @part.title do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<p>
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %>
<%= f.text_field locale %>
<%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil) %>
</p>
<% end %>
<% end %>

View File

@ -1,8 +1,8 @@
<%= f.fields_for :i18n_variable, (@part.i18n_variable ? @part.i18n_variable : @part.build_i18n_variable) do |f| %>
<%= f.fields_for :content_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :class => 'tinymce_textarea' %>
<%= f.text_area locale, :class => 'tinymce_textarea', :value => (@part.content_translations[locale] rescue nil) %>
</div>
<% end %>
<% end %>

View File

@ -1 +1 @@
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %>
<%= select 'page_part', 'category', @categories.collect{|category| [category.title, category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %>

View File

@ -1 +1 @@
<%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %>
<%= select 'page_part', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %>

View File

@ -9,12 +9,12 @@
</div>
</div>
<%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'text input-xlarge' %>
<%= f.text_field locale, :class => 'text input-xlarge', :value => (@item.title_translations[locale] rescue nil) %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
@ -43,7 +43,7 @@
<%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
</span>
<span id="app_page_category">
<%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
<%= select('page','category', @categories.collect{|category| [category.title, category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
</span>
<span id="app_page_tag">
<%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%>

View File

@ -14,9 +14,9 @@
<tbody>
<tr class="list_item">
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td>
<%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale, :style => "width:150px" %></td>
<td><%= f.text_field locale, :style => "width:150px", :value => (@attribute.title_translations[locale] rescue nil) %></td>
<% end %>
<% end %>
</tr>

View File

@ -11,9 +11,9 @@
<tbody>
<tr class="list_item">
<td><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td>
<%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale, :style => "width:150px" %></td>
<td><%= f.text_field locale, :style => "width:150px", :value => (sub_role.title_translations[locale] rescue nil) %></td>
<% end %>
<% end %>
</tr>

View File

@ -25,8 +25,8 @@
<div class="control-group">
<label class="control-label"><%= t 'admin.site_title' %></label>
<div class="controls">
<%= f.fields_for :title, @site.title do |f| %>
<%= f.text_field locale, :class => "input-xxlarge" %>
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-xxlarge", :value => (@site.title_translations[locale] rescue nil) %>
<% end %>
<p class="help-block"><%= (t 'admin.site_title_help').html_safe %></p>
</div>
@ -47,6 +47,7 @@
<div class="control-group">
<label class="control-label"><%= t 'admin.site_keywords' %></label>
<div class="controls">
<% #TODO: set keywords into meta %>
<%= f.fields_for :keywords, @site.keywords do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<% end %>
@ -56,8 +57,8 @@
<div class="control-group">
<label class="control-label"><%= t 'admin.site_description' %></label>
<div class="controls">
<%= f.fields_for :description, @site.description do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %>
<%= f.fields_for :description_translations do |f| %>
<%= f.text_area locale, :class => "input-xxlarge textarea-height-s", :value => (@site.description_translations[locale] %>
<% end %>
<p class="help-block"><%= (t 'admin.site_description_help').html_safe %></p>
</div>
@ -65,8 +66,8 @@
<div class="control-group">
<label class="control-label"><%= t 'admin.site_footer' %></label>
<div class="controls">
<%= f.fields_for :footer, @site.footer do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %>
<%= f.fields_for :footer_translations do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge", :value => (@site.footer_translations[locale] %>
<% end %>
<p class="help-block"><%= (t 'admin.site_footer_help').html_safe %></p>
</div>
@ -74,8 +75,8 @@
<div class="control-group">
<label class="control-label"><%= t 'admin.site_sub_menu' %></label>
<div class="controls">
<%= f.fields_for :sub_menu, @site.sub_menu do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %>
<%= f.fields_for :sub_menu_translations do |f| %>
<%= f.text_area locale, :class => "tinymce_textarea input-xxlarge", :value => (@site.sub_menu_translations[locale] %>
<% end %>
</div>
</div>

View File

@ -16,7 +16,7 @@
</label>
<label>
<span><%= t('admin.role') %></span>
<%= f.select :role_id, @roles.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.id ]}, :selected => (@user.role_id || Role.get_role_from_key('student')) %>
<%= f.select :role_id, @roles.sort_by{|role| role.key }.collect {|role| [ role.title, role.id ]}, :selected => (@user.role_id || Role.get_role_from_key('student')) %>
</label>
</div>
@ -27,7 +27,7 @@
<div id='roles'>
<% @roles.each do |role| %>
<div id="<%= role.id %>_block" class="attributes_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.role.id.eql?(role.id) rescue nil) || (role.key.eql?('student') && @user.new_record?)) %>>
<h2><%= role.i18n_variable[I18n.locale] %></h2>
<h2><%= role.title %></h2>
<hr class="<#%= @user.role.key %>_block">
<%= render :partial => 'sub_role_selector', :locals => {:f => f, :role => role} %>
<%= render :partial => 'sub_role', :collection => role.sub_roles, :locals => {:f => f, :role => role} %>

View File

@ -1,5 +1,5 @@
<div id="basic_block" class="attributes_block <%= @class %>">
<h2><%= info.i18n_variable[I18n.locale] %></h2>
<h2><%= info.title %></h2>
<hr>
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
@ -15,7 +15,7 @@
<% info.get_enabled_attribute_fields.each do |attr| %>
<%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %>
<tr class="list_item">
<td><%= attr.i18n_variable[I18n.locale] %></td>
<td><%= attr.title %></td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale %></td>

View File

@ -9,7 +9,7 @@
<tbody>
<% show_attribute.get_enabled_attribute_fields.each do |attr| %>
<tr class="list_item">
<td><%= attr.i18n_variable[I18n.locale] %></td>
<td><%= attr.title %></td>
<% @site_valid_locales.each do |locale| %>
<td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>

View File

@ -1,4 +1,4 @@
<div id="sub_role_<%= show_sub_role.id %>" class="group">
<h2><%= show_sub_role.i18n_variable[I18n.locale] %></h2>
<h2><%= show_sub_role.title %></h2>
<%= render :partial => 'show_attribute', :object => show_sub_role %>
</div>

View File

@ -1,5 +1,5 @@
<div id="sub_role_<%= sub_role.id %>" class="group" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>>
<h2><%= sub_role.i18n_variable[I18n.locale] %></h2>
<h2><%= sub_role.title %></h2>
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
@ -14,7 +14,7 @@
<% sub_role.get_enabled_attribute_fields.each do |attr| %>
<%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %>
<tr class="list_item">
<td><%= attr.i18n_variable[I18n.locale] %></td>
<td><%= attr.title %></td>
<% if attr["locale"] && attr["markup"] == 'text_field' %>
<% @site_valid_locales.each do |locale| %>
<td><%= f.text_field locale %></td>

View File

@ -1,4 +1,4 @@
<% role.sub_roles.each do |sub_role| %>
<%= f.label sub_role.i18n_variable[I18n.locale], :for => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %>
<%= f.label sub_role.title, :for => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %>
<%= check_box_tag "user[sub_role_ids][]", sub_role.id, @user.sub_role_ids.include?(sub_role.id), :id => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %>
<% end %>

View File

@ -20,7 +20,7 @@
<tbody>
<% @users.each do |user| %>
<tr class="have">
<td class="roles <%= user.role.key.downcase rescue nil %>"><%= user.role.i18n_variable[I18n.locale] rescue nil %></td>
<td class="roles <%= user.role.key.downcase rescue nil %>"><%= user.role.title rescue nil %></td>
<td class="name"><%= user.name ? user.name : 'bob' %></td>
<td class="email"><%= user.email %></td>
<td class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></td>

View File

@ -14,14 +14,14 @@
</div>
<% @infos.each do |a| %>
<div id="basic_block" class="roles_block <%= @class %>">
<h2><%= a.i18n_variable[I18n.locale] %></h2>
<h2><%= a.title %></h2>
<hr>
<%= render :partial => 'show_attribute', :object => a %>
</div>
<% end -%>
<div id="basic_block" class="roles_block <%= @class %>">
<h2><%= @user.role.i18n_variable[I18n.locale] %></h2>
<h2><%= @user.role.title %></h2>
<hr class="<%= @user.role.key %>_block">
<%= render :partial => 'show_sub_role', :collection => @user.sub_roles %>
</div>