名师榜新增一个后就不能再新增

This commit is contained in:
huang 2016-05-13 10:50:34 +08:00
parent 83ac35cc94
commit 1673ae451b
4 changed files with 14 additions and 16 deletions

View File

@ -26,4 +26,8 @@ class Organization < ActiveRecord::Base
def switch_type
self.show_mode.to_i == 1 ? true : false
end
def allow_set_teachers
self.allow_teacher.to_i == 1 ? true : false
end
end

View File

@ -4,6 +4,7 @@
:locals => {:subfields => @organization.org_subfields.order("priority") }) %>");
$("#sub_field_left_lists").html("");
$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>");
$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>");
<% end %>
$("#subfield_name").val("");
$("#sub_dir").val("");

View File

@ -0,0 +1,6 @@
<% if @organization.allow_set_teachers && !org_subfield_had_created?(@organization, "Comptec") %>
<li class="fl mr15">
<input type="radio" id="orgTec" value="Comptec" name="field_type" />
<label for="Comptec">教师</label>
</li>
<% end %>

View File

@ -157,22 +157,9 @@
<input type="radio" id="orgMeb" value="Resource" name="field_type" />
<label for="orgMeb">资源</label>
</li>
<li class="fl mr15">
<input type="radio" id="orgCom" value="Complex" name="field_type" />
<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="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="orgStu">学生</label>
</li>
<% end %>
<div id="org_excellent_teachers">
<%= render :partial => 'organizations/setting_excellent_teachers' %>
</div>
<li class="fr"><a href="javascript:void(0);" class="saveBtn db" onclick="add_org_subfield();">新增</a></li>
<li class="cl"></li>
</ul>