<% if org_subfield %>
    <span class="files_tag_icon" >
          <a  title=""
              onclick="search_org_subfield_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','','<%= @q%>','<%= org_subfield.id%>');"
          >全部</a></span>
<% end %>
<% unless tag_list.nil?%>
    <% tag_list.each do |k,v|%>
        <% if tag_name && tag_name == k%>
            <!-- 鼠标不能移动是因为 href="javascript:void(0);"导致的 -->
            <span>    <a  class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
        <% else%>
            <span class="files_tag_icon" >
          <a  title="双击可编辑"
              onclick="search_org_subfield_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','<%= k %>','<%= @q %>','<%= org_subfield.id %>');"
              ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>(<%= v%>)</a></span>
        <% end%>
    <% end%>
<% end%>

<script>
    var clickFunction = null; //单击事件函数
    var isdb = false; //是否双击
    function search_org_subfield_tag_attachment(url,tag_name,q,org_subfield_id,sort) {
        //alert("111");
        //clearTimeout(clickFunction);
        clickFunction = setTimeout(function () {
            search_func();
        }, 500);
        function search_func() {
            if (isdb != false) return;
            $.get(
                    url,
                    {
                        tag_name: tag_name,
                        q: q,
                        org_subfield_id: org_subfield_id
                    },
                    function (data) {

                    }
            );
        }
    }
</script>