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 %>
|
||||
<div class='category_list'>
|
||||
<h3 class='h3'><%= @menu_page.title %></h3>
|
||||
<!-- <h3 class='h3'><%#= @menu_page.title %></h3> -->
|
||||
<ul class='list'>
|
||||
<% @menu_page.visible_children.each do |child| %>
|
||||
<li class="<%= @page_id.eql?(child.id) ? 'active' : nil %>">
|
||||
|
|
|
@ -10,11 +10,20 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
|
|||
|
||||
def index
|
||||
|
||||
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
|
||||
|
||||
def show
|
||||
|
|
|
@ -20,4 +20,8 @@ class WebLinkCategory
|
|||
title
|
||||
end
|
||||
|
||||
def self.from_id(id)
|
||||
WebLinkCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
|
@ -2,29 +2,23 @@
|
|||
|
||||
<%= 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>
|
||||
<tr>
|
||||
<th><%= t(:category) %></th>
|
||||
<th><%= t(:name) %></th>
|
||||
<th><%= t(:category) %></th>
|
||||
<th><%= t(:name) %></th>
|
||||
</tr>
|
||||
|
||||
<% @web_links.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.web_link_category.title rescue nil %></td>
|
||||
<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>
|
||||
<td><%= post.web_link_category.title rescue nil %></td>
|
||||
<td><%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= paginate @web_links, :param_name => :page_main, :params => {:inner => false}%>
|
||||
|
|
Reference in New Issue