feeds/app/views/admin/feeds/_announcements.html.erb

76 lines
3.4 KiB
Plaintext

<% available_locales = Site.first.in_use_locales rescue I18n.available_locales %>
<table class="table main-list footable-loaded tablet">
<thead>
<tr class="table-info">
<th scope="row"><%= t('feed.feed_name') %></th>
<th><%= "#{t('title')}(#{available_locales.collect{|v| t(v)}.join('/')})" %></th>
<th><%= "#{t('tags')}(#{available_locales.collect{|v| t(v)}.join('/')})" %></th>
<th></th>
</tr>
</thead>
<tbody>
<% data_count = 0
total_count = 0
%>
<% @all_feed_annc.each do |feed_annc| %>
<% feed_name = available_locales.collect{|v| feed_annc[:feed_name][v]}.join(' / ') %>
<% if @source.blank? || (@source.include?(feed_annc.channel_title) rescue false) || @source.include?(feed_annc.remote_site_url.to_s.gsub(/http:\/\/|https:\/\//,'').gsub(/\./,'-')) %>
<% Array(feed_annc[:all_contents_for_feed][I18n.locale.to_s]).each do |annc| %>
<% annc_title = available_locales.collect{|v| annc['title_translations'][v]}.join('/') %>
<% annc_tags = annc['tags'].collect{|tmp| available_locales.collect{|v| tmp['name_translations'][v]}.join(' / ')} %>
<% if @keywords.blank? || search_all_words(Nokogiri.HTML(annc_title).text()+' '+feed_name+' '+annc_tags.join(' '),@keywords) %>
<% if total_count >= @skip_count && data_count < @max_content_count %>
<% data_count += 1 %>
<tr data-annc-feed-id='<%= feed_annc.id.to_s %>' data-annc-uid='<%= annc['id'].to_s %>'>
<td>
<span class="channel-source-name label"><%= (feed_annc.channel_title.blank? || feed_annc.channel_title.include?("translation missing")) ? t("feed.source") : feed_annc.channel_title %></span>
<br>
<%= feed_name %>
</td>
<td>
<ul>
<li>
<a class='annc_title'><%= annc_title.html_safe %></a>
</li>
<li style="display: flex;width: 100%;flex-wrap: wrap;">
<%= check_box_tag nil,nil,feed_annc[:top_list].include?(annc['id']),'class' => 'is_top' %>
<%= check_box_tag nil,nil,feed_annc[:hot_list].include?(annc['id']),'class' => 'is_hot' %>
</li>
</ul>
</td>
<td>
<%= annc_tags.join('<br>').html_safe %>
</td>
<td>
<% display_flag = feed_annc[:hidden_annc].count==0 || feed_annc[:hidden_annc].exclude?(annc['id']) ? true : false %>
<% if display_flag %>
<button class='btn-info hidden_btn'><%= t('is_hidden') %></button>
<% else %>
<button class='btn-primary display_btn'><%= t('feed.display') %></button>
<% end %>
</td>
</tr>
<% end %>
<% total_count += 1 %>
<% end %>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
<script type="text/javascript">
$(function(){
$(document).trigger('page.ready')
$('.is_top,.is_hot').change(function(){
process_annc(this)
})
$('.hidden_btn,.display_btn').click(function(){
process_annc(this)
})
})
</script>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag(:div, paginate(Kaminari.paginate_array([]).page(1).per(1),total_pages: (total_count/@max_content_count.to_f).ceil,current_page: @page_no), class: "pagination pagination-centered")
end
%>