<% org_teachers.each do |org_teacher| %>
    <% school = School.where("id =?", org_teacher.school_id).first %>
    <div class="teacher-list-row">
      <div>
        <div class="teacher-avatar">
          <%= link_to image_tag(url_to_avatar(org_teacher), :width => "90", :height => "90"), user_url_in_org(org_teacher), :alt => "用户头像" %>
        </div>
        <div class="fl">
          <div class="ml25 mb20"><span class="teacher-name"><%=link_to org_teacher.try(:realname).nil? ? org_teacher.try(:login) : org_teacher.try(:realname), user_url_in_org(org_teacher) %></span>
            <% unless school.nil? %>
                <span class="f12 fontGrey2 mr15"><%= school.name %></span>
            <% end %>
            <% unless org_teacher.nil? %>
                <span class="f12 fontGrey2"><%= org_teacher.technical_title %></span></div>
            <% end %>
            <div class="teacher-social-block">
              <div class="block-num"><%= org_teacher.courses.count %></div>
              <div class="block-title">课程数</div>
            </div>
            <div class="block-slice"></div>
            <div class="teacher-social-block">
              <div class="block-num"><%= org_teacher.my_students %></div>
              <div class="block-title">学生数</div>
            </div>
            <div class="block-slice"></div>
            <div class="teacher-social-block">
              <div class="block-num"><%= org_teacher_resource_count(org_teacher) %></div>
              <div class="block-title">资源数</div>
            </div>
            </div>
        <% if User.current.admin_of_org?(@organization) %>
            <a href="javascript:void(0);" class="fr teacher-select" onclick="hide($(this),'<%= org_teacher.id %>');" id="hide_<%= org_teacher.id %>"><%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %></a>
            <!--<a href="javascript:void(0);" class="fr teacher-select">设为名师</a>-->
        <% else %>
            <!--<%# if(org_teacher.watched_by?(User.current)) %>-->
                <!--<%#= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>org_teacher.id,:target_id=>org_teacher.id),:class => "fr teacher-select", :method => "delete",:remote => "true", :title => "取消关注"%>-->
            <!--<%# else %>-->
                <!--<%#= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>org_teacher.id,:target_id=>org_teacher.id),:class => "fr teacher-select", :method => "post",:remote => "true", :title => "添加关注"%>-->
            <!--<%# end %>-->
        <% end %>
      </div>
      <div class="cl"></div>
    </div>
<% end %>

<script>
    function hide(content, id){
        if (content.text() == '设为名师')
            $.ajax({
                url: "/organizations/set_excellent_teacher?user=" + id,
                type: "post"
            });
        else
            $.ajax({
                url: "/organizations/reset_excellent_teacher?user=" + id,
                type: "post"
            });
    }
</script>