Commit afb1b60d67f53f9fc5384605700165a055ede4ce

Authored by Antonio Terceiro
1 parent 13ee4777

Removing 'signup wizard' feature'

Removing all that mess feels *very good*.

ActionItem1761
app/controllers/my_profile/memberships_controller.rb
... ... @@ -7,21 +7,12 @@ class MembershipsController < MyProfileController
7 7 end
8 8  
9 9 def new_community
10   - @wizard = params[:wizard].blank? ? false : params[:wizard]
11 10 @community = Community.new(params[:community])
12 11 @community.environment = environment
13 12 if request.post? && @community.valid?
14 13 @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]))
15   - if @wizard
16   - redirect_to :controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true
17   - return
18   - else
19   - redirect_to :action => 'index'
20   - return
21   - end
22   - end
23   - if @wizard
24   - render :layout => 'wizard'
  14 + redirect_to :action => 'index'
  15 + return
25 16 end
26 17 end
27 18 end
... ...
app/controllers/public/account_controller.rb
... ... @@ -4,7 +4,7 @@ class AccountController < ApplicationController
4 4  
5 5 inverse_captcha :field => 'e_mail'
6 6  
7   - require_ssl :except => [ :login_popup, :logout_popup, :wizard, :profile_details ]
  7 + require_ssl :except => [ :login_popup, :logout_popup, :profile_details ]
8 8  
9 9 before_filter :login_required, :only => [:activation_question, :accept_terms, :activate_enterprise]
10 10 before_filter :redirect_if_logged_in, :only => [:login, :signup]
... ... @@ -50,8 +50,6 @@ class AccountController < ApplicationController
50 50 # action to register an user to the application
51 51 def signup
52 52 @invitation_code = params[:invitation_code]
53   - @wizard = params[:wizard].blank? ? false : params[:wizard]
54   - @step = 1
55 53 begin
56 54 @user = User.new(params[:user])
57 55 @user.terms_of_use = environment.terms_of_use
... ... @@ -71,37 +69,16 @@ class AccountController < ApplicationController
71 69 invitation.finish
72 70 end
73 71 session[:notice] = _("Thanks for signing up!")
74   - if @wizard
75   - redirect_to :controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true
76   - return
77   - else
78   - go_to_initial_page if redirect?
79   - end
  72 + go_to_initial_page if redirect?
80 73 end
81   - if @wizard
82   - render :layout => 'wizard'
83   - end
84 74 rescue ActiveRecord::RecordInvalid
85 75 @person.valid?
86 76 @person.errors.delete(:identifier)
87 77 @person.errors.delete(:user_id)
88   - if @wizard
89   - render :action => 'signup', :layout => 'wizard'
90   - else
91   - render :action => 'signup'
92   - end
  78 + render :action => 'signup'
93 79 end
94 80 end
95 81  
96   - def wizard
97   - render :layout => false
98   - end
99   -
100   - def profile_details
101   - @profile = Profile.find_by_identifier(params[:profile])
102   - render :partial => 'profile_details', :layout => 'wizard'
103   - end
104   -
105 82 # action to perform logout from the application
106 83 def logout
107 84 if logged_in?
... ...
app/controllers/public/search_controller.rb
... ... @@ -148,8 +148,6 @@ class SearchController < PublicController
148 148 end
149 149  
150 150 def index
151   - @wizard = params[:wizard].blank? ? false : params[:wizard]
152   - @step = 2
153 151 @query = params[:query] || ''
154 152 @filtered_query = remove_stop_words(@query)
155 153 @product_category = ProductCategory.find(params[:product_category]) if params[:product_category]
... ... @@ -174,20 +172,12 @@ class SearchController < PublicController
174 172 if respond_to?(specific_action)
175 173 @asset_name = getterm(@names[@results.keys.first])
176 174 send(specific_action)
177   - if @wizard
178   - render :action => specific_action, :layout => 'wizard'
179   - else
180   - render :action => specific_action
181   - end
  175 + render :action => specific_action
182 176 return
183 177 end
184 178 end
185 179  
186   - if @wizard
187   - render :action => 'index', :layout => 'wizard'
188   - else
189   - render :action => 'index'
190   - end
  180 + render :action => 'index'
191 181 end
192 182  
193 183 alias :assets :index
... ...
app/helpers/account_helper.rb
1 1 module AccountHelper
2 2  
3   -
4   - def button_to_step(type, step, current_step, html_options = {})
5   - if current_step == step
6   - the_class = 'active'
7   - if html_options.has_key?(:class)
8   - html_options[:class] << " #{the_class}"
9   - else
10   - html_options[:class] = the_class
11   - end
12   - end
13   - if step == 1
14   - url = '#'
15   - else
16   - url = send('url_step_' + step.to_s)
17   - end
18   - button(type, step.to_s, url, html_options)
19   - end
20   -
21   - def button_to_step_without_text(type, step, html_options = {})
22   - url = 'url_step_' + step
23   - button_without_text(type, step, send(url), html_options)
24   - end
25   -
26   - def button_to_previous_step(step, html_options = {})
27   - step = step - 1
28   - if step > 1
29   - button_to_step_without_text(:left, step.to_s, html_options)
30   - end
31   - end
32   -
33   - def button_to_next_step(step, html_options = {})
34   - step = step + 1
35   - if step < 4
36   - button_to_step_without_text(:forward, step.to_s, html_options)
37   - end
38   - end
39   -
40   - def url_step_1
41   - options = {:controller => 'account', :action => 'signup', :wizard => true}
42   - Noosfero.url_options.merge(options)
43   - end
44   -
45   - def url_step_2
46   - options = {:controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true}
47   - Noosfero.url_options.merge(options)
48   - end
49   -
50   - def url_step_3
51   - options = {:controller => 'friends', :action => 'invite', :profile => user.identifier, :wizard => true}
52   - Noosfero.url_options.merge(options)
53   - end
54   -
55 3 end
... ...
app/helpers/application_helper.rb
... ... @@ -487,30 +487,6 @@ module ApplicationHelper
487 487 end
488 488 end
489 489  
490   - # displays a link to add the profile with its image (as generated by
491   - # #profile_image) or only its name below.
492   - def profile_add_link( profile, image=false, size=:portrait, tag='li')
493   - the_class = profile.members.include?(user) ? 'profile_member' : ''
494   - name = h(profile.short_name)
495   - if image
496   - display = content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
497   - content_tag( 'span', name, :class => 'org' ) +
498   - profile_cat_icons( profile )
499   - the_class << ' vcard'
500   - else
501   - display = content_tag( 'span', name, :class => 'org' )
502   - end
503   - content_tag tag,
504   - link_to_remote( display,
505   - :update => 'search-results-and-pages',
506   - :url => {:controller => 'account', :action => 'profile_details', :profile => profile.identifier},
507   - :onclick => 'document.location.href = this.href', # work-arround for ie.
508   - :class => 'profile_link url',
509   - :help => _('Click on this icon to add <b>%s</b> to your network') % profile.name,
510   - :title => profile.name ),
511   - :class => the_class
512   - end
513   -
514 490 def links_for_balloon(profile)
515 491 if environment.enabled?(:show_balloon_with_profile_links_when_clicked)
516 492 if profile.kind_of?(Person)
... ...
app/helpers/friends_helper.rb
1 1 module FriendsHelper
2 2  
3   - def link_to_import(text, options = {})
4   - options.merge!({:action => 'invite', :import => 1, :wizard => true})
5   - link_to text, options
6   - end
7   -
8 3 end
... ...
app/models/environment.rb
... ... @@ -96,7 +96,6 @@ class Environment &lt; ActiveRecord::Base
96 96 'wysiwyg_editor_for_environment_home' => _('Use WYSIWYG editor to edit environment home page'),
97 97 'media_panel' => _('Media panel in WYSIWYG editor'),
98 98 'select_preferred_domain' => _('Select preferred domains per profile'),
99   - 'display_wizard_signup' => _('Display wizard signup'),
100 99 'use_portal_community' => _('Use the portal as news source for front page'),
101 100 'user_themes' => _('Allow users to create their own themes'),
102 101 'search_in_home' => _("Display search form in home page"),
... ...
app/views/account/_profile_details.rhtml
... ... @@ -1,21 +0,0 @@
1   -<div id='profile-details'>
2   - <%= image_tag(profile_icon(@profile, :portrait)) %>
3   -
4   - <strong><%= @profile.short_name %></strong><br/>
5   - <%= _('Type: %s') % getterm(@profile.class.name) %> <br/>
6   - <%= _('Description: %s') % @profile.description %> <br/>
7   - <%= _('Members: %s') % @profile.members.size.to_s %> <br/>
8   - <%= _('Created at: %s') % show_date(@profile.created_at) %> <br/>
9   -
10   -<% form_tag(@profile.join_url) do %>
11   - <%= hidden_field_tag(:confirmation, 1) %>
12   - <%= hidden_field_tag(:wizard, true) %>
13   - <% if @profile.members.include?(user) %>
14   - <%= link_to( _('Leave'), @profile.leave_url.merge(:confirmation => 1, :wizard => true ), :method => 'post') %>
15   - <% else %>
16   - <%= submit_button(:ok, _("Join now")) %>
17   - <% end %>
18   - <%= button(:back, _('Back'), {:controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true}) %>
19   -<% end %>
20   -
21   -</div>
app/views/account/_signup_form.rhtml
1 1 <%= error_messages_for :user, :person %>
2 2  
3   -<% if !@wizard %>
4   - <% if ! defined? hidden_atention || ! hidden_atention %>
5   - <p/>
6   - <div class="atention">
7   - <%= _('Dear user, welcome to the %s network. To start your participation in this space, fill in the fields below. After this operation, your login and password will be registered, allowing you to create %s and %s in this environment.') % [environment.name, __('communities'), __('enterprises')] %>
8   - </div>
9   - <% end %>
  3 +<% if ! defined? hidden_atention || ! hidden_atention %>
  4 +<p/>
  5 +<div class="atention">
  6 +<%= _('Dear user, welcome to the %s network. To start your participation in this space, fill in the fields below. After this operation, your login and password will be registered, allowing you to create %s and %s in this environment.') % [environment.name, __('communities'), __('enterprises')] %>
  7 +</div>
10 8 <% end %>
11 9  
12 10 <% labelled_form_for :user, @user do |f| %>
... ... @@ -14,8 +12,6 @@
14 12  
15 13 <%= hidden_field_tag :invitation_code, @invitation_code %>
16 14  
17   -<%= hidden_field_tag :wizard, @wizard %>
18   -
19 15 <%= required_fields_message %>
20 16  
21 17 <div id='signup-email'>
... ... @@ -66,10 +62,6 @@
66 62 <% end %>
67 63  
68 64 <% button_bar do %>
69   - <% if @wizard %>
70   - <%= submit_button('save', _('Sign up'), :class => 'icon-menu-login') %>
71   - <% else %>
72   - <%= submit_button('save', _('Sign up'), :cancel => {:action => 'index'}, :class => 'icon-menu-login') %>
73   - <% end %>
  65 + <%= submit_button('save', _('Sign up'), :cancel => {:action => 'index'}, :class => 'icon-menu-login') %>
74 66 <% end %>
75 67 <% end -%>
... ...
app/views/account/_wizard_steps.rhtml
... ... @@ -1,12 +0,0 @@
1   -<div id='wizard-steps'>
2   - <% button_bar do %>
3   - <%= button_to_previous_step(@step) if @step %>
4   - <%= button_to_step(:step, 1, @step, :class => (logged_in? ? 'logged' : 'not-logged')) %>
5   - <% if logged_in? %>
6   - <%= button_to_step(:step, 2, @step) %>
7   - <%= button_to_step(:step, 3, @step) %>
8   - <%= button_to_next_step(@step) if @step %>
9   - <% end %>
10   - <%= button(:ok, _('Finish'), user.url, :target => '_top') if @step == 3 %>
11   - <% end %>
12   -</div>
app/views/account/signup.rhtml
1 1 <h1><%= _('Signup') %></h1>
2 2 <%= render :partial => 'signup_form' %>
3   -
4   -<% if @wizard %>
5   - <%= render :partial => 'wizard_steps' %>
6   -<% end %>
... ...
app/views/account/wizard.rhtml
... ... @@ -1,5 +0,0 @@
1   -<%= lightbox_close_button _('Close') %>
2   -
3   -<iframe id='wizard-iframe' width='590px' height='410px' border='0' src="<%= url_for(:controller => 'account', :action => 'signup', :wizard => true) %>" >
4   - <p><%= _('Your browser does not support iframes.') %></p>
5   -</iframe>
app/views/home/index.rhtml
1   -<% if environment.enabled?('display_wizard_signup') && !logged_in? %>
2   - <%= lightbox_button(:new, _('Signup'), { :controller => 'account', :action => 'wizard' }, :class => 'wizard', :id => 'signup-wizard') %>
3   -<% end %>
4   -
5 1 <% if @has_news %>
6 2 <h1><%= _('News') %></h1>
7 3 <% cache @news_cache_key do %>
... ...
app/views/layouts/wizard.rhtml
... ... @@ -1,30 +0,0 @@
1   -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2   -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= html_language %>" lang="<%= html_language %>">
3   - <head>
4   - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   - <%= javascript_include_tag :defaults %>
6   - <%= stylesheet_link_tag '/designs/icons/default/style.css' %>
7   - <%= javascript_include_tag 'jquery-latest.js' %>
8   - <script type="text/javascript">
9   - jQuery.noConflict();
10   -
11   - </script>
12   -
13   - <%=
14   - # Load the principal css files:
15   - stylesheet_import( %w( common button search forms profiles)
16   - ) + "\n" +
17   - stylesheet_import( %w( common button search forms profiles wizard),
18   - :themed_source => true ) + "\n" +
19   - # Load the boxes's css file if each exists:
20   - import_blocks_stylesheets +
21   - stylesheet_import( "controller_"+ @controller.controller_name() ) + "\n" +
22   - stylesheet_import( "controller_"+ @controller.controller_name(), :themed_source => true )
23   - %>
24   - </head>
25   - <body class='noosfero' id='wizard'>
26   - <div id="wizard-content">
27   - <%= yield %>
28   - </div><!-- id="wizard-content" -->
29   - </body>
30   -</html>
app/views/memberships/new_community.rhtml
1   -<% if @wizard %>
2   - <%= render :partial => 'account/wizard_steps' %>
3   -<% end %>
4   -
5 1 <h1><%= __('Creating new community') %></h1>
6 2  
7 3 <% if environment.enabled?('admin_must_approve_new_communities') %>
... ... @@ -20,8 +16,6 @@
20 16  
21 17 <%= required f.text_field(:name) %>
22 18  
23   - <%= hidden_field_tag :wizard, params[:wizard] %>
24   -
25 19 <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'community', :profile => @community } %>
26 20  
27 21 <% f.fields_for :image_builder, @community.image do |i| %>
... ... @@ -46,11 +40,7 @@
46 40  
47 41 <% button_bar do %>
48 42 <%= submit_button(:save, _('Create')) %>
49   - <% if @wizard %>
50   - <%= button(:back, _('Back'), {:controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true}) %>
51   - <% else %>
52   - <%= button(:cancel, _('Cancel'), :action => 'index') %>
53   - <% end %>
  43 + <%= button(:cancel, _('Cancel'), :action => 'index') %>
54 44 <% end %>
55 45  
56 46 <% end %>
... ...
app/views/search/_display_results.rhtml
1 1 <div id="search-results" class="<%= 'only-one-result-box' if @results.size == 1 %>">
2 2  
3   -<% if @wizard %>
4   - <div id='visualization-mode'>
5   - <%= button_without_text('product', _('View as icons'), params.merge(:visualization_mode => 'icons')) %>
6   - <%= button_without_text('todo', _('View as list'), params.merge(:visualization_mode => 'list')) %>
7   - </div>
8   -<% end %>
9   -
10 3 <%
11 4 pos2 = :odd # allow to format in a two columns layout
12 5 pos3 = 3 # allow to format in a thre columns layout
... ...
app/views/search/_profile.rhtml
1   -<%# FIXME add more information %>
2   -<% if (params[:visualization_mode] == 'list') && params[:wizard] %>
3   - <%= profile_add_link profile %>
4   -<% elsif params[:wizard].blank? %>
5   - <%= profile_image_link profile, :portrait %>
6   -<% else %>
7   - <%= profile_add_link profile, true, :portrait %>
8   -<% end %>
  1 +<%= profile_image_link profile, :portrait %>
... ...
app/views/search/_search_form.rhtml
... ... @@ -7,8 +7,6 @@
7 7  
8 8 <%= hidden_field_tag :display, params[:display] %>
9 9  
10   - <%= hidden_field_tag :wizard, @wizard %>
11   -
12 10 <%= hidden_field_tag :asset, params[:asset] %>
13 11  
14 12 <div class="search-field">
... ... @@ -22,7 +20,6 @@
22 20 <% end %>
23 21 </div>
24 22  
25   - <% if !@wizard %>
26 23 <div id='advanced-search-options' style="display: <%= simple_search ? 'none' : 'block' %>">
27 24 <div class="search-options search-within">
28 25 <h4><%= _('Search within:') %></h4>
... ... @@ -57,7 +54,6 @@
57 54 page['advanced-search-options'].toggle
58 55 end %>
59 56 <% end %>
60   - <% end %>
61 57  
62 58 <% if lightbox?; button_bar do %>
63 59 <%= lightbox_close_button _('Close') %>
... ...
app/views/search/communities.rhtml
1   -<% if @wizard && user %>
2   - <h2><%= _('Hello %s, now you can choose yours groups') % user.identifier %></h2>
3   - <%= render :partial => 'account/wizard_steps' %>
4   -<% else %>
5   -
6 1 <%= search_page_title( __('Communities'), { :query => @query,
7 2 :category => @category ? @category.name : nil,
8 3 :total_results => @total_results,
9 4 :region => @region ? @region.name : nil,
10 5 :distance => @radius } ) %>
11   -<% end %>
12 6  
13 7 <%= search_page_link_to_all( { :asset => params[:asset],
14 8 :category => @category }) %>
15 9 <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %>
16 10  
17   -<% if @wizard %>
18   - <div class='atention'><%= __('Choose the communities you want to join and/or create your own.') %></div>
19   -<% end %>
20   -
21 11 <% if logged_in? %>
22 12 <% button_bar do %>
23 13 <%# FIXME shouldn't the user create the community in the current environment instead of going to its home environment? %>
24   - <%= button(:add, __('New community'), user.url.merge(:controller => 'memberships', :action => 'new_community', :wizard => @wizard)) %>
  14 + <%= button(:add, __('New community'), user.url.merge(:controller => 'memberships', :action => 'new_community')) %>
25 15 <% end %>
26 16 <% end %>
27 17  
... ...
public/stylesheets/application.css
... ... @@ -484,19 +484,7 @@ div.pending-tasks {
484 484 margin-bottom: 0px;
485 485 }
486 486  
487   -/**** Signup wizard ****/
488   -
489   -#wizard-iframe {
490   - border: none;
491   -}
492   -
493   -#wizard-content {
494   - font-size: 13px;
495   -}
496   -
497   -#wizard-content h1 {
498   - font-size: 22px;
499   -}
  487 +/**** portal news ****/
500 488  
501 489 #portal-news {
502 490 font-size: 11px;
... ...
test/functional/account_controller_test.rb
... ... @@ -296,21 +296,6 @@ class AccountControllerTest &lt; Test::Unit::TestCase
296 296 end
297 297 end
298 298  
299   - should 'signup from wizard' do
300   - assert_difference User, :count do
301   - post :signup, :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }, :wizard => true
302   - end
303   - assert_redirected_to :controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true
304   - end
305   -
306   - should 'not have layout when fail signup from wizard' do
307   - user = create_user('mylogin').person
308   - post :signup, :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }, :wizard => true
309   - assert_response :success
310   - assert_template 'signup'
311   - assert_equal 'layouts/wizard', @response.layout
312   - end
313   -
314 299 ################################
315 300 # #
316 301 # Enterprise activation tests #
... ...
test/functional/memberships_controller_test.rb
... ... @@ -50,16 +50,6 @@ class MembershipsControllerTest &lt; Test::Unit::TestCase
50 50 end
51 51 end
52 52  
53   - should 'be able to create a new community on wizard' do
54   - assert_difference Community, :count do
55   - post :new_community, :profile => profile.identifier, :community => { :name => 'My shiny new community', :description => 'This is a community devoted to anything interesting we find in the internet '}, :wizard => true
56   - assert_response :redirect
57   - assert_redirected_to :controller => 'search', :action => 'assets', :asset => 'communities', :wizard => true
58   -
59   - assert Community.find_by_identifier('my-shiny-new-community').members.include?(profile), "Creator user should be added as member of the community just created"
60   - end
61   - end
62   -
63 53 should 'link to new community creation in index' do
64 54 get :index, :profile => profile.identifier
65 55 assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/memberships/new_community" }
... ...
test/functional/search_controller_test.rb
... ... @@ -242,13 +242,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase
242 242 assert_equivalent [c3, c1], assigns(:results)[:communities]
243 243 end
244 244  
245   - should 'find communities in signup wizard' do
246   - c1 = create_profile_with_optional_category(Community, 'a beautiful community')
247   - get :index, :query => 'beautiful', :find_in => [ 'communities' ], :wizard => true
248   - assert_includes assigns(:results)[:communities], c1
249   - assert_equal 'layouts/wizard', @response.layout
250   - end
251   -
252 245 should 'find products' do
253 246 ent = create_profile_with_optional_category(Enterprise, 'teste')
254 247 prod = ent.products.create!(:name => 'a beautiful product', :product_category => @product_category)
... ... @@ -980,21 +973,6 @@ class SearchControllerTest &lt; Test::Unit::TestCase
980 973 end
981 974 end
982 975  
983   - should 'display steps when searching on wizard' do
984   - c1 = create_profile_with_optional_category(Community, 'a beautiful community')
985   - login_as('ze')
986   - get :index, :query => 'beautiful', :find_in => [ 'communities' ], :wizard => true
987   - assert_equal 'layouts/wizard', @response.layout
988   - assert_tag :tag => 'div', :attributes => {:id => 'wizard-steps'}
989   - end
990   -
991   - should 'not display steps when searching not on wizard' do
992   - c1 = create_profile_with_optional_category(Community, 'a beautiful community')
993   - get :index, :query => 'beautiful', :find_in => [ 'communities' ]
994   - assert_match 'layouts/application', @response.layout
995   - assert_no_tag :tag => 'div', :attributes => {:id => 'wizard-steps'}
996   - end
997   -
998 976 should 'find products when enterprises has own hostname' do
999 977 ent = create_profile_with_optional_category(Enterprise, 'teste')
1000 978 ent.domains << Domain.new(:name => 'testent.com'); ent.save!
... ...