Fix web links html and index query
This commit is contained in:
1 parent
236f68ba84
commit
c7cf587581
4 files changed
+24
-17
No files matched your search
+12
-3
@@ -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
|
||||
vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb
Vendored
+7
-13
@@ -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
Block a user