Commit 7b755d37954647590315e3cca1dc6fedafc8507f
1 parent
72e32423
Exists in
master
and in
29 other branches
ActionItem9: displaying different information for logged in users and for anonymous users
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@97 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
18 additions
and
56 deletions
Show diff stats
app/controllers/account_controller.rb
... | ... | @@ -6,7 +6,9 @@ class AccountController < ApplicationController |
6 | 6 | |
7 | 7 | # say something nice, you goof! something sweet. |
8 | 8 | def index |
9 | - redirect_to(:action => 'signup') unless logged_in? || User.count > 0 | |
9 | + unless logged_in? | |
10 | + render :action => 'index_anonymous' | |
11 | + end | |
10 | 12 | end |
11 | 13 | |
12 | 14 | def login | ... | ... |
app/views/account/index.rhtml
1 | -<h1>In the Caboose.</h1> | |
2 | 1 | |
3 | -<% content_for 'poem' do -%> | |
4 | -"Train delayed? and what's to say?" | |
5 | -"Blocked by last night's snow they say." | |
6 | -Seven hours or so to wait; | |
7 | -Well, that's pleasant! but there's the freight. | |
8 | -Depot loafing no one fancies, | |
9 | -We'll try the caboose and take our chances. | |
10 | - | |
11 | -Cool this morning in Watertown, | |
12 | -Somewhat frosty___mercury down; | |
13 | -Enter caboose___roaring fire, | |
14 | -With never an air-hole; heat so dire | |
15 | -That we shrivel and pant; we are roasted through- | |
16 | -Outside, thermometer thirty-two. | |
17 | - | |
18 | -We start with a jerk and suddenly stop. | |
19 | -"What's broke?" says one; another "What's up?", | |
20 | -"Oh, nothing," they answer, "That's our way: | |
21 | -You must stand the jerking, sorry to say." | |
22 | -We "stand it" with oft this painful thought: | |
23 | -Are our heads on yet, or are they not? | |
24 | - | |
25 | -Comrades in misery___let me see; | |
26 | -Girl like a statue opposite me; | |
27 | -Back and forth the others jostle___ | |
28 | -She never winks, nor moves a muscle; | |
29 | -See her, as she sits there now; | |
30 | -She's "well balanced," anyhow. | |
31 | - | |
32 | -Woman in trouble, tearful eyes, | |
33 | -Sits by the window, softly cries, | |
34 | -Pity___for griefs we may not know, | |
35 | -For breasts that ache, for tears that flow, | |
36 | -Though we know not why. Her eyelids red | |
37 | -Tell a sorrowful tale___some hope is dead. | |
38 | - | |
39 | -Man who follows the Golden Rule, | |
40 | -And lends his papers___a pocket full, | |
41 | -Has a blank book___once in a minute | |
42 | -Has an idea, and writes it in it. | |
43 | -Guess him? Yes, of course I can, | |
44 | -He's a___well___a newspaper man. | |
45 | - | |
46 | -Blue-eyed fairy, wrapped in fur; | |
47 | -Sweet young mother tending her. | |
48 | -Fairy thinks it's "awful far," | |
49 | -Wants to get off this "naughty car." | |
50 | -So do we, young golden-hair; | |
51 | -All this crowd are with you there! | |
52 | -<% end -%> | |
53 | - | |
54 | -<%= simple_format @content_for_poem %> | |
55 | - | |
56 | -<p><a href="http://skyways.lib.ks.us/poetry/walls/caboose.html">-- Ellen P. Allerton.</a></p> | |
57 | 2 | \ No newline at end of file |
3 | +<%= link_to _('Change password'), :action => 'change_password' %> | |
4 | +<%= link_to _('Edit Personal details'), :action => 'edit_details' %> | ... | ... |
test/functional/account_controller_test.rb
... | ... | @@ -113,6 +113,17 @@ class AccountControllerTest < Test::Unit::TestCase |
113 | 113 | assert !@controller.send(:logged_in?) |
114 | 114 | end |
115 | 115 | |
116 | + def test_should_display_anonymous_user_options | |
117 | + get :index | |
118 | + assert_template 'index_unregistered' | |
119 | + end | |
120 | + | |
121 | + def test_should_display_logged_in_user_options | |
122 | + login_as 'quentin' | |
123 | + get :index | |
124 | + assert_template 'index' | |
125 | + end | |
126 | + | |
116 | 127 | protected |
117 | 128 | def create_user(options = {}) |
118 | 129 | post :signup, :user => { :login => 'quire', :email => 'quire@example.com', | ... | ... |