Fix bug widget when no bulletins or web_links, put link in bulletins

This commit is contained in:
Christophe Vilayphiou 2012-02-20 18:19:26 +08:00
parent ad27537cf7
commit 48d94d5e15
4 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ class AnnouncementTag < Tag
def get_visible_bulletins(sort = :name) def get_visible_bulletins(sort = :name)
date_now = Time.now
self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
end end

View File

@ -1,6 +1,6 @@
<% @bulletins.each do |bulletin| %> <% @bulletins.each do |bulletin| %>
<li> <li>
<%= bulletin.title[I18n.locale] %> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin) %>
</li> </li>
<% end %> <% end %>

View File

@ -1,3 +1,3 @@
$('#bulletins_web_links_tags').html("<%= j render :partial => 'tag', :collection => @tags %>") $('#bulletins_web_links_tags').html("<%= j render :partial => 'tag', :collection => @tags %>")
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' %>") $('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' %>") $('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")

View File

@ -1 +1 @@
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' id @web_links %>") $('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>")