列表中类型显示方法封装

This commit is contained in:
huang 2016-05-09 15:00:50 +08:00
parent 878bcc8cf1
commit a98678e001
4 changed files with 24 additions and 12 deletions

View File

@ -154,4 +154,19 @@ module OrganizationsHelper
result
end
def org_subfield_type(field)
case field.field_type
when "Post"
result = "帖子"
when "Resource"
result = "资源"
when "Compstu"
result = "学生"
when "Comptec"
result = "教师"
when "Complex"
result = "综合"
end
end
end

View File

@ -91,7 +91,7 @@
<% end %>
<% else %>
<div style="display:<%= field.hide == 0?'block':'none' %>;" id="org_subfield_<%= field.id %>">
<% if field.field_type == "Post" %> <!--讨论帖子-->
<% if field.field_type == ("Post" || "Complex" || "Compstu" || "Comptec") %> <!--讨论帖子-->
<div class="homepageLeftMenuBlock">
<!--<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>-->
<% if !field.subfield_subdomain_dir.nil? %> <!--讨论帖子-->

View File

@ -8,7 +8,6 @@
<li class="orgListOperation fb"><span class="mr10">操作</span></li>
<div class="cl"></div>
</ul>
<% subfields.each do |field| %>
<% if is_default_field?(field) %>
<% name = get_default_name(field) %>
@ -32,10 +31,9 @@
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option_default, { :include_blank => false,:selected => field.status},
{ :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
{ :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
<% end %>
<% end %>
</li>
<li class="orgListType">默认</li>
<a href="javascript:void(0);" class="linkGrey fr mr10" onclick="hide($(this),'<%= field.id %>');" id="hide_<%= field.id %>"><%= field.hide==0?"隐藏":"可见" %></a>
@ -60,20 +58,19 @@
<li class="orgListStatus">新增</li>
<li class="orgListStatusList">
<% if field.field_type == "Resource" %>
列表
默认
<% else %>
<%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
<div class="update_status_class"><span class="hidden"><%= subfield_list_type(field.status) %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2"></a>
</div>
<%= select( :name,:group_id, subfield_status_option,
{ :include_blank => false,:selected => field.status},
{:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
{ :include_blank => false,:selected => field.status},
{ :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %>
<% end %>
<% end %>
</li>
<li class="orgListType"><%= field.field_type == "Post" ? "帖子" : "资源" %></li>
<li class="orgListType"><%= org_subfield_type field %></li>
<li class="orgListCatalog hidden">
<% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
<div id="sub_dir_show_<%= field.id %>" ondblclick="edit_dir('#sub_dir_show_<%= field.id %>','#sub_dir_edit_<%= field.id %>');" style="cursor:pointer;background-color:#fffce6;color: #0d90c3; width:30px; margin-left:20px;" title="双击可编辑">

View File

@ -154,18 +154,18 @@
</li>
<li class="fl mr15">
<input type="radio" id="orgCom" value="Complex" name="field_type" />
<label for="orgMeb">综合</label>
<label for="orgCom">综合</label>
</li>
<% unless org_subfield_had_created?(@organization, "Comptec") %>
<li class="fl mr15">
<input type="radio" id="orgTec" value="Comptec" name="field_type" />
<label for="orgMeb">教师</label>
<label for="Comptec">教师</label>
</li>
<% end %>
<% unless org_subfield_had_created?(@organization, "Compstu") %>
<li class="fl">
<input type="radio" id="orgStu" value="Compstu" name="field_type" />
<label for="orgMeb">学生</label>
<label for="orgStu">学生</label>
</li>
<% end %>
<li class="fr"><a href="javascript:void(0);" class="saveBtn db" onclick="add_org_subfield();">新增</a></li>