Fix web links html and index query
This commit is contained in:
parent
236f68ba84
commit
c7cf587581
|
@ -1,6 +1,6 @@
|
||||||
<% if @menu_page && @menu_page.visible_children.size > 0 %>
|
<% if @menu_page && @menu_page.visible_children.size > 0 %>
|
||||||
<div class='category_list'>
|
<div class='category_list'>
|
||||||
<h3 class='h3'><%= @menu_page.title %></h3>
|
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
|
||||||
<ul class='list'>
|
<ul class='list'>
|
||||||
<% @menu_page.visible_children.each do |child| %>
|
<% @menu_page.visible_children.each do |child| %>
|
||||||
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
|
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
|
||||||
|
|
|
@ -12,7 +12,16 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
|
||||||
|
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
|
|
||||||
@web_links = WebLink.where( :is_hidden => false ).desc(:is_top, :title).page(params[:page]).per(10)
|
if !params[:category_id].blank?
|
||||||
|
@web_links = WebLink.where( :is_hidden => false ).where(:web_link_category_id => params[:category_id]).desc( :is_top ).page( params[:page_main] ).per(10)
|
||||||
|
@current_category = WebLinkCategory.from_id(params[:category_id]) rescue nil
|
||||||
|
elsif !params[:tag_id].blank?
|
||||||
|
@tag = WebResourceTag.find(params[:tag_id]) rescue nil
|
||||||
|
@tag = WebResourceTag.where(key: params[:tag_id])[0] unless @tag
|
||||||
|
@web_links = @tag.archive_files.where( :is_hidden => false ).desc( :is_top ).page( params[:page_main] ).per(10)
|
||||||
|
else
|
||||||
|
@web_links = WebLink.where( :is_hidden => false ).desc( :is_top ).page( params[:page_main] ).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
get_categorys
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,4 +20,8 @@ class WebLinkCategory
|
||||||
title
|
title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.from_id(id)
|
||||||
|
WebLinkCategory.find(id) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
<%= paginate @web_links, :params => {:inner => false}%>
|
<!-- <h1><%#= t('web_link.list_web_resource') %></h1> -->
|
||||||
|
|
||||||
<h1><%= t('web_link.list_web_resource') %></h1>
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3><%= @current_category.title rescue nil %></h3>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t(:category) %></th>
|
<th><%= t(:category) %></th>
|
||||||
|
@ -16,15 +14,11 @@
|
||||||
<% @web_links.each do |post| %>
|
<% @web_links.each do |post| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= post.web_link_category.title rescue nil %></td>
|
<td><%= post.web_link_category.title rescue nil %></td>
|
||||||
<td>
|
<td><%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %></td>
|
||||||
<%#= link_to post.title, panel_web_resource_front_end_web_link_path(post) %>
|
|
||||||
<%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br />
|
<%= paginate @web_links, :param_name => :page_main, :params => {:inner => false}%>
|
||||||
|
|
||||||
|
|
Reference in New Issue