<script type="text/javascript">
    // $(this).ready(function(){
    // $('.tag_show').hover(function() {
    // $(this).children("span").show();
    // }, function() {
    // $(this).children("span").hide();
    // });
    // })
</script>
<!-- 1代表是user类型   2代表是project类型  3代表是issue类型   4代表需求 7代表竞赛 9代表课程-->
<% @tags = obj.reload.tag_list %>
<% if non_list_all and (@tags.size > 0) %>
    <!-- 这里是显示的非主页的tag 所以当tag数量较多时 不必全部显示 用“更多”代替  -->
    <% if @tags.size > Setting.show_tags_length.to_i then %>
        <% i = 0 %>
        <% until i>Setting.show_tags_length.to_i do %>
            <div id="tag">
              <%= link_to @tags[i], :controller => "tags", :action => "index", :q => @tags[i], :object_flag => object_flag, :obj_id => obj.id %>
            </div>
            <% i += 1 %>
        <% end %>
        <%= more_tags(obj.id,object_flag)%>
    <% else %>
        <% @tags.each do |tag| %>
            <div id="tag">
              <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
            </div>
        <% end %>
    <% end %>
<% else %>
    <!-- 用来显示三大对象的主页中的tag  故是全部显示  -->
    <% if @tags.size > 0 %>
        <% @tags.each do |tag| %>
            <!--object_flag == '2'为项目 项目暂时单独出来，后面其它几个选项也需样式重构-->
            <% if object_flag == '2' %>
                <span class="re_tag f_l">
                <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
                <% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %>
                    	<%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                     :taggable_id => obj.id, :taggable_type => object_flag %>
                <% end %>
                </span>     
            <% else %>
                <div id="tag">
                <span class="re_tag f_l">
                  <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
                  <!-- 对用户主页 是本人 ，对项目，需求，问题是管理员 -->
                  <% case object_flag %>
                    <% when '1' %>
                      <% if User.current.eql?(obj) %>
                         <span class='del'>
                           <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                        :taggable_id => obj.id, :taggable_type => object_flag %>
                         </span>
                      <% end %>                    
                     <% when '3' %>
                       <% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_id) == User.current.id %>
                        <span class='del'>
                          <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                      :taggable_id => obj.id, :taggable_type => object_flag %>
                        </span>
                     <% end %>
                     <% when '4' %>
                         <% if obj.author_id == User.current.id %>
                          <span class='del'>
                            <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                         :taggable_id => obj.id, :taggable_type => object_flag %>
                          </span>
                         <% end %>
                     <% when '5' %>
                       <%  test = Forum.find(obj.id)    %>
                       <% if test && test.creator_id == User.current.id %>
                         <span class='del'>
                           <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                        :taggable_id => obj.id, :taggable_type => object_flag %>
                         </span>
                       <% end %>
                    <% when '6' %>
                        <%# if (User.current.logged? &&
                                User.current.admin?
                        # && (@project && User.current.member_of?(@project))
                        )
                        %>
                      <% if obj.author_id == User.current.id || User.current.admin?%>
                        <span class='del'>
                          <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                       :taggable_id => obj.id, :taggable_type => object_flag %>
                        </span>
                      <% end %>
                     <% when '7' %>
                        <% if obj.author_id == User.current.id %>
                            <span class='del'>
                              <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                           :taggable_id => obj.id, :taggable_type => object_flag %>
                            </span>
                        <% end %>
                    <% when '9' %>
                     <% if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %>
                       <span class='del'>
                         <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
                                                      :taggable_id => obj.id, :taggable_type => object_flag %>
                       </span>
                     <% end %>
                    <% end %>
                </span>
            </div>
            <% end %>
        <% end %>
    <% end %>
<% end %>