changeset 49:158a59127bbe luisf

The tip of the day only appears to logged in users.
author luisf
date Tue, 23 Nov 2010 14:57:07 +0000
parents 8032b626953b
children 97333e644a2c cbaf7863aafb
files app/controllers/welcome_controller.rb app/views/welcome/index.rhtml
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/welcome_controller.rb	Tue Nov 23 13:41:39 2010 +0000
+++ b/app/controllers/welcome_controller.rb	Tue Nov 23 14:57:07 2010 +0000
@@ -21,6 +21,14 @@
   def index
     @news = News.latest User.current
     @projects = Project.latest User.current
+    
+    # tests if user is logged in to gfenerate the tips of the day list
+    if User.current.logged?
+      @tipsoftheday = Setting.tipoftheday_text
+    else
+      @tipsoftheday = ''
+    end
+    
   end
   
   def robots
--- a/app/views/welcome/index.rhtml	Tue Nov 23 13:41:39 2010 +0000
+++ b/app/views/welcome/index.rhtml	Tue Nov 23 14:57:07 2010 +0000
@@ -9,12 +9,13 @@
 <div class="splitcontentleft">
   <%= textilizable Setting.welcome_text %>
   
-<% if not Setting.tipoftheday_text.empty? %>
-  <div class="newsoftheday box">
-    <h3><%=l(:label_tipoftheday)%></h3>
-    <%= textilizable Setting.tipoftheday_text %>
-  </div>
-<% end %>
+  <% if not @tipsoftheday.empty? %>
+    <div class="newsoftheday box">
+	  <h3><%=l(:label_tipoftheday)%></h3>
+	  <%= textilizable @tipsoftheday %>
+    </div>
+  <% end %>
+
 
   <% if @news.any? %>
   <div class="news box">