From 8d3b55fa2ef0906b3b40570b82b77063f88f598c Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 2 Sep 2010 17:44:31 -0300 Subject: [PATCH] Remove the "Join community popup" feature --- app/controllers/public/profile_controller.rb | 18 ++---------------- app/helpers/application_helper.rb | 14 -------------- app/models/environment.rb | 1 - app/views/blocks/profile_info_actions/community.rhtml | 6 ++++++ app/views/shared/join_community_popup.rhtml | 13 ------------- app/views/shared/noosfero_layout_features.rhtml | 4 ---- features/join_community.feature | 68 ++++++-------------------------------------------------------------- test/functional/profile_controller_test.rb | 33 --------------------------------- test/unit/application_helper_test.rb | 139 ------------------------------------------------------------------------------------------------------------------------------------------- 9 files changed, 14 insertions(+), 282 deletions(-) delete mode 100644 app/views/shared/join_community_popup.rhtml diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 740eb49..5914680 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -1,9 +1,9 @@ class ProfileController < PublicController needs_profile - before_filter :check_access_to_profile, :except => [:join, :refuse_join, :refuse_for_now, :index] + before_filter :check_access_to_profile, :except => [:join, :index] before_filter :store_before_join, :only => [:join] - before_filter :login_required, :only => [:join, :refuse_join, :leave, :unblock] + before_filter :login_required, :only => [:join, :leave, :unblock] helper TagsHelper @@ -112,20 +112,6 @@ class ProfileController < PublicController end end - def refuse_join - p = current_user.person - p.refused_communities << profile - p.save - redirect_to profile.url - end - - def refuse_for_now - session[:no_asking] ||= [] - session[:no_asking].shift if session[:no_asking].size >= 10 - session[:no_asking] << profile.id - render :text => '', :layout => false - end - def unblock if current_user.person.is_admin?(profile.environment) profile.unblock diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ab927dc..d7437f8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -939,20 +939,6 @@ module ApplicationHelper end end - def ask_to_join? - return if !environment.enabled?(:join_community_popup) - return if params[:action] == 'join' - return unless profile && profile.kind_of?(Community) - if (session[:no_asking] && session[:no_asking].include?(profile.id)) - return false - end - if logged_in? - user.ask_to_join?(profile) - else - true - end - end - def icon_theme_stylesheet_path theme_path = "/designs/icons/#{environment.icon_theme}/style.css" if File.exists?(File.join(RAILS_ROOT, 'public', theme_path)) diff --git a/app/models/environment.rb b/app/models/environment.rb index 1ae4c7d..0d49f3e 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -93,7 +93,6 @@ class Environment < ActiveRecord::Base 'disable_contact_person' => _('Disable contact for people'), 'disable_contact_community' => _('Disable contact for groups/communities'), 'enterprise_registration' => __('Enterprise registration'), - 'join_community_popup' => _('Ask users to join a group/community with a popup'), 'enterprise_activation' => __('Enable activation of enterprises'), 'wysiwyg_editor_for_environment_home' => _('Use WYSIWYG editor to edit environment home page'), diff --git a/app/views/blocks/profile_info_actions/community.rhtml b/app/views/blocks/profile_info_actions/community.rhtml index ae2e44e..9782f6b 100644 --- a/app/views/blocks/profile_info_actions/community.rhtml +++ b/app/views/blocks/profile_info_actions/community.rhtml @@ -19,5 +19,11 @@ <% end %> + <% else %> + +
  • + <%= link_to content_tag('span', _('Join')), profile.join_url, :class => 'button with-text icon-add', :title => _('Join this community') %> +
  • + <% end %> diff --git a/app/views/shared/join_community_popup.rhtml b/app/views/shared/join_community_popup.rhtml deleted file mode 100644 index bce60ae..0000000 --- a/app/views/shared/join_community_popup.rhtml +++ /dev/null @@ -1,13 +0,0 @@ -
    -

    <%= __('Do you want to join this community?') %>

    - - <% form_tag(profile.join_url) do %> - <%= hidden_field(:confirmation, 1) if logged_in? %> - <% button_bar do %> - <%= submit_button(:ok,"Yes") %> - <%= button_to_remote(:cancel, _('Not now'), :url => profile.join_url.merge({:controller => 'profile', :action => 'refuse_for_now', :profile => profile.identifier}), :loaded => '$("join-community-popup").hide()') %> - <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) if logged_in? %> - <% end %> - <% end %> -
    -<%= draggable_element('join-community-popup') %> diff --git a/app/views/shared/noosfero_layout_features.rhtml b/app/views/shared/noosfero_layout_features.rhtml index 151177f..2cb7ccd 100644 --- a/app/views/shared/noosfero_layout_features.rhtml +++ b/app/views/shared/noosfero_layout_features.rhtml @@ -2,10 +2,6 @@ <%= render :file => 'shared/theme_test_panel' %> <% end %> - <% if ask_to_join? %> - <%= render :file => 'shared/join_community_popup' %> - <% end %> -