fix new ui link and archive frontend and widget index

This commit is contained in:
Spen 2013-10-04 11:43:33 +08:00 committed by saurabhbhatia
parent 06c48524fd
commit f85354c2b6
5 changed files with 27 additions and 22 deletions

View File

@ -21,7 +21,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
def index def index
@item = Page.find(params[:page_id]) @item = Page.find(params[:page_id])
@title = @item.title @title = @item.title
@frontend_style = @item.frontend_style @frontend_style = !@item.frontend_style.blank? ? @item.frontend_style : "1"
if !@item.frontend_data_count.blank? if !@item.frontend_data_count.blank?
@page_num = @item.frontend_data_count @page_num = @item.frontend_data_count
else else
@ -43,15 +43,15 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
if @frontend_style == "1" if @frontend_style == "1"
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
# @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil # @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
# @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil # @current_category = ArchiveFileCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids,:tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids,:tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
else else
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
end end
elsif @frontend_style == "2" elsif @frontend_style == "2"
@ -61,13 +61,13 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController
@archive_file_categorys.each do |afcg| @archive_file_categorys.each do |afcg|
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]) @archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort])
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id]).desc( :is_top ).default_sort(params[:sort]) @archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort])
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]) @archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort])
else else
@archive_files = ArchiveFile.can_display.where(:category_id => afcg.id).desc( :is_top ).default_sort(params[:sort]) @archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort])
end end
archive_file_datas = Array.new archive_file_datas = Array.new

View File

@ -23,6 +23,7 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
end end
@widget_style = @part.widget_style @widget_style = @part.widget_style
@widget_style = !@part.widget_style.blank? ? @part.widget_style : "1"
@category_id = @part.category @category_id = @part.category
@ -64,13 +65,13 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
if @widget_style == "1" if @widget_style == "1"
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids,:tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids,:tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
else else
@archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => @archive_file_category_ids, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).page( params[:page_main] ).per(@page_num)
end end
elsif @widget_style == "2" elsif @widget_style == "2"
@ -80,13 +81,13 @@ class Panel::Archive::Widget::ArchiveFilesController < OrbitWidgetController
@archive_file_categorys.each do |afcg| @archive_file_categorys.each do |afcg|
if !params[:category_id].blank? && !params[:tag_id].blank? if !params[:category_id].blank? && !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num)
elsif !params[:category_id].blank? elsif !params[:category_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id.in => [afcg.id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num)
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :tagged_ids.in => params[:tag_id]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :tagged_ids.in => params[:tag_id], :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num)
else else
@archive_files = ArchiveFile.can_display.where(:category_id => afcg.id).desc( :is_top ).default_sort(params[:sort]).limit(@page_num) @archive_files = ArchiveFile.can_display.where(:category_id => afcg.id, :title.nin=>[""]).desc( :is_top ).default_sort(params[:sort]).limit(@page_num)
end end
archive_file_datas = Array.new archive_file_datas = Array.new

View File

@ -87,9 +87,11 @@
<% end %> <% end %>
<div class="pull_right"> <div class="pull_right">
<% if !params[:category_id].blank? %> <% if !@archive_files.blank? or !@archive_file_datas.blank? %>
<% if !params[:category_id].blank? %>
<%= link_to t(:more_plus), panel_archive_front_end_archive_files_path(:category_id => @part.category) %> <%= link_to t(:more_plus), panel_archive_front_end_archive_files_path(:category_id => @part.category) %>
<% else %> <% else %>
<%= link_to t(:more_plus), panel_archive_front_end_archive_files_path %> <%= link_to t(:more_plus), panel_archive_front_end_archive_files_path %>
<% end %> <% end %>
<% end %>
</div> </div>

View File

@ -12,12 +12,14 @@
<ul> <ul>
<% wlcg["web_links"].each do |post| %> <% wlcg["web_links"].each do |post| %>
<% if !post["title"].blank? %>
<li> <li>
<%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %> <%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %>
<% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %> <% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %>
<div class="o-links-description"><%= post["context"] %></div> <div class="o-links-description"><%= post["context"] %></div>
</li> </li>
<% end %> <% end %>
<% end %>
</ul> </ul>
</div> </div>

View File

@ -10,7 +10,7 @@
<ul> <ul>
<% wlcg["web_links"].each do |post| %> <% wlcg["web_links"].each do |post| %>
<% if !web_link.title.empty? %> <% if !post["title"].blank? %>
<li> <li>
<%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %> <%= link_to post["title"], post["url"], {:target => '_blank', :title => post["title"], :class=>"o-links-title"} %>
<% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %> <% if !post["is_hot"].blank? %><span class="o-links-hot"><%= t('hot')%></span><% end %>