Fix links and remove unneeded codes
This commit is contained in:
parent
f13c21c1b4
commit
5faa7e73c0
|
@ -33,14 +33,6 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
@category_id = @part.category
|
||||
|
||||
date_now = Time.now
|
||||
if !@category_id.blank?
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id => @category_id).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
@current_category = BulletinCategory.from_id(@category_id) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
else
|
||||
@bulletins = Bulletin.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
|
||||
end
|
||||
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@posts = Bulletin.available_for_lang(I18n.locale).can_display.where(:category_id.in => params[:category_id], :tagged_ids.in => params[:tag_id]).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num)
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<% @bulletins.each do |post| %>
|
||||
<% @posts.each do |post| %>
|
||||
<tr class="<%= cycle('odd', '')%>">
|
||||
<% @widget_fields.each do |wf| %>
|
||||
<td>
|
||||
<span class="<%= wf[1] %>">
|
||||
<% if wf[1] == 'title' %>
|
||||
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("category_id")) %>
|
||||
<% elsif wf[1] == 'date' %>
|
||||
<%= display_date(post.send(wf[0])) %>
|
||||
<% elsif wf[1] == 'category' %>
|
||||
|
@ -52,13 +52,6 @@
|
|||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% @posts.each do |post| %>
|
||||
<tr>
|
||||
<td><%= display_date(post.postdate) %></td>
|
||||
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post, :category_id => post.category_id) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<div class="more"><%= link_to t('announcement.more'), panel_announcement_front_end_bulletins_path() %></div>
|
||||
|
@ -68,14 +61,14 @@
|
|||
|
||||
<div class="default_widget_list">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<% @posts.each do |post| %>
|
||||
<li class="<%= cycle('odd', '')%>">
|
||||
<div class="img app-pic" style="width:50px; height:50px;"><%= image_tag(post.image.url) %></div>
|
||||
|
||||
<% @widget_fields.each do |wf| %>
|
||||
<span class="<%= wf[1] %>">
|
||||
<% if wf[1] == 'title' %>
|
||||
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("#{post.class.to_s.underscore}_category_id")) %>
|
||||
<%= link_to post.send("#{wf[0]}"), panel_announcement_front_end_bulletin_path(post, :category_id => post.send("category_id")) %>
|
||||
<% elsif wf[1] == 'date' %>
|
||||
<%= display_date(post.send(wf[0])) %>
|
||||
<% elsif wf[1] == 'category' %>
|
||||
|
|
Loading…
Reference in New Issue