noosfero | 2 new commits pushed to repository

Leandro Nunes gitlab at gitlab.com
Thu Jan 22 11:41:15 BRST 2015


Leandro Nunes pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/05e56cd31341a2c42a4d1fda2cd1a4f2c94c5f1a">05e56cd3</a> by Victor Costa
Append logged-in class in body when user is logged in

- - - - -
<a href="https://gitlab.com/noosfero/noosfero/commit/0ac87b7854de94d9e680077bbed049e883882bbb">0ac87b78</a> by Leandro Nunes
Merge branch 'body_loggedin' into 'master'

Append logged-in class in body when user is logged in

See merge request !387

- - - - -


Changes:

=====================================
app/helpers/layout_helper.rb
=====================================
--- a/app/helpers/layout_helper.rb
+++ b/app/helpers/layout_helper.rb
@@ -2,6 +2,7 @@ module LayoutHelper
 
   def body_classes
     # Identify the current controller and action for the CSS:
+    (logged_in? ? " logged-in" : "") +
     " controller-#{controller.controller_name}" +
     " action-#{controller.controller_name}-#{controller.action_name}" +
     " template-#{@layout_template || if profile.blank? then 'default' else profile.layout_template end}" +

=====================================
test/unit/layout_helper_test.rb
=====================================
--- /dev/null
+++ b/test/unit/layout_helper_test.rb
@@ -0,0 +1,17 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class LayoutHelperTest < ActionView::TestCase
+
+  should 'append logged-in class in body when user is logged-in' do
+    expects(:logged_in?).returns(true)
+    expects(:profile).returns(nil).at_least_once
+    assert_includes body_classes.split, 'logged-in'
+  end
+
+  should 'not append logged-in class when user is not logged-in' do
+    expects(:logged_in?).returns(false)
+    expects(:profile).returns(nil).at_least_once
+    assert_not_includes body_classes.split, 'logged-in'
+  end
+
+end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150122/2728d10f/attachment.html>


More information about the Noosfero-dev mailing list