Fix bug when no bulletins or web_links
This commit is contained in:
parent
c304819d6b
commit
1146506063
|
@ -4,8 +4,8 @@
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<%= stylesheet_link_tag "widget" %>
|
<%#= stylesheet_link_tag "module_widget" %>
|
||||||
<%= javascript_include_tag "widget" %>
|
<%= javascript_include_tag "module_widget" %>
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -33,18 +33,18 @@ class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
|
||||||
def bulletins_and_web_links
|
def bulletins_and_web_links
|
||||||
@tags = AnnouncementTag.all
|
@tags = AnnouncementTag.all
|
||||||
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
|
||||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil
|
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
||||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil
|
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_bulletins
|
def reload_bulletins
|
||||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||||
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(1) rescue nil
|
@bulletins = @selected_tag.get_visible_bulletins.page(params[:page]).per(5) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_web_links
|
def reload_web_links
|
||||||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(1) rescue nil
|
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul id='bulletins_web_links_bulletins'>
|
<ul id='bulletins_web_links_bulletins'>
|
||||||
<%= render 'bulletins' %>
|
<%= render 'bulletins' if @bulletins %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul id='bulletins_web_links_web_links'>
|
<ul id='bulletins_web_links_web_links'>
|
||||||
<%= render 'web_links' %>
|
<%= render 'web_links' if @web_links %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -1 +1 @@
|
||||||
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' %>")
|
$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>")
|
|
@ -1 +1 @@
|
||||||
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' %>")
|
$('#bulletins_web_links_web_links').html("<%= j render 'web_links' id @web_links %>")
|
Loading…
Reference in New Issue