<div id="event-selectedFeedList">
  <%= content_tag :h4, t('.no_feeds'), id: "event-zeroFeedsMsg" if @content.feeds.empty? and not params.has_key?(:feed_id)  %>

  <% if params.has_key?(:feed_id) %>
    <% params[:feed_id].each do |key, value| %>
      <%= render partial: 'contents/form_elements/selected_feed_display', locals: { feed: Feed.find(value), feed_index: value } %>
    <% end %>
  <% else %>
    <% @content.feeds.each_with_index do |feed, i| %>
      <%= render partial: 'contents/form_elements/selected_feed_display', locals: {feed: feed, feed_index: i} %>
    <% end %>
  <% end %>
</div>

<br />
<div class="clearfix">
  <div class="pull-left" style="margin-right: 16px;">
    <%= link_to '#', id: "select-feeds-btn", title: t('.select_a_feed'), class: "btn dropdown-toggle dropdown-control dd-select-feeds", rel: "#select-feeds" do %>
      <%= t('.select_a_feed') %>...
    <% end %>
  </div>
</div>

<div id="select-feeds" style="display: none;">
  <% feeds = dfs_tree(Feed.roots) %>
    <% feeds.reject!{|f| !@feeds.include?(f) } %>
    <% if feeds.empty? %>
      <p><%= t('.no_feeds')%></p>
    <% else %>

    <div class="tooltip-filter-cont">
      <input type="text" class="feed_filter fillWidth" placeholder="<%= t('.type_to_filter') %>"/>
    </div>

    <div class="tooltip-scrollY" style="height: 300px; width: 100%;">
      <ul class="filterable selector-list">
        <% feeds.each do |feed| %>
          <% allowed_type = (feed.content_types[@content.class.name] == "1") %>
        
          <% if allowed_type %>
          <li data-filter="<%= feed.name %>">
            
            <%= link_to add_feed_contents_path(feed_id: feed.id, feed_index: feed.id), remote: true, class: "link-hl", "data-feed-index" => feed.id, "data-feed-name" => feed.name, "data-feed-id" => feed.id do %>
              <div class="row-fluid">
                <div class="span8">
                  <p>
                    <%= ("&nbsp;" * feed.depth).html_safe %>
                    <b><%= feed.name %></b>
                    <br />
                    <% if feed.description.length > 0 %><%= truncate(feed.description, length: 75) %><% end %>
                  </p>
                </div>
                <div class="span4" style="text-align: right;">
                  <p style="color: #000; line-height: 12px; "><%= feed.shown_on_screens.count %> <i class="concertocon-controller-screens" style="line-height: normal; font-size: 18px;"></i></p>
                </div>
              </div>
            <% end %>
          </li>
          <% end %>

        <% end %>
      </ul>
    </div>
  <% end %>
</div>
<div id="event-selectedFeedList">
  
</div>