diff --git a/app/views/blocks/profile_info_actions/_join_leave_community.html.erb b/app/views/blocks/profile_info_actions/_join_leave_community.html.erb index 787a8eb..608c889 100644 --- a/app/views/blocks/profile_info_actions/_join_leave_community.html.erb +++ b/app/views/blocks/profile_info_actions/_join_leave_community.html.erb @@ -1,27 +1,25 @@
+ +<%= javascript_tag do %> + noosfero.add_and_join.locales.leaveConfirmation = <%= (_("Please confirm to leave the community '%{name}'") % {name: profile.name}).to_json %> +<% end %> + diff --git a/features/accept_member.feature b/features/accept_member.feature index 6f08de2..e532e1b 100644 --- a/features/accept_member.feature +++ b/features/accept_member.feature @@ -14,6 +14,16 @@ Feature: accept member And the community "My Community" is closed And "Mario Souto" is admin of "My Community" + Scenario: a user should see its merbership is pending + Given I am logged in as "mario" + And the following communities + | owner | identifier | name | closed | + | marie | private-community | Private Community | true | + And I go to private-community's homepage + When I follow "Join this community" + And I go to private-community's homepage + Then I should see "Your membership is waiting for approval" + @selenium Scenario: approve a task to accept a member as admin in a closed community Given "Marie Curie" asked to join "My Community" diff --git a/features/members_block.feature b/features/members_block.feature index b595d5c..33ff390 100644 --- a/features/members_block.feature +++ b/features/members_block.feature @@ -9,8 +9,8 @@ Feature: | joaosilva | Joao Silva | | mariasilva | Maria Silva | And the following communities - | owner | identifier | name | - | joaosilva | sample-community | Sample Community | + | owner | identifier | name | + | joaosilva | sample-community | Sample Community | And the following blocks | owner | type | | sample-community | MembersBlock | @@ -24,7 +24,7 @@ Feature: Scenario: a user can join in a community by members block's button Given I am logged in as "mariasilva" And I go to sample-community's homepage - When I follow "Join" within ".members-block" + When I follow "Join this community" within ".members-block" And I go to mariasilva's control panel And I follow "Manage my groups" Then I should see "Sample Community" @@ -41,7 +41,7 @@ Feature: Scenario: a not logged in user can log in by members block's button Given I am not logged in When I go to sample-community's homepage - And I follow "Join" within ".members-block" + And I follow "Join this community" within ".members-block" Then I should see "Username / Email" Scenario: the join-leave button do not appear if the checkbox show-join-leave-button is not checked @@ -51,5 +51,5 @@ Feature: And I uncheck "Show join leave button" And I press "Save" When I go to sample-community's homepage - Then I should not see "Join" within ".members-block" + Then I should not see "Join this community" within ".members-block" And I should not see "Leave community" within ".members-block" diff --git a/public/javascripts/add-and-join.js b/public/javascripts/add-and-join.js index 3c90af2..09c32c2 100644 --- a/public/javascripts/add-and-join.js +++ b/public/javascripts/add-and-join.js @@ -1,3 +1,9 @@ +noosfero.add_and_join = { + locales: { + leaveConfirmation: '', + }, +}; + jQuery(function($) { $(".add-friend").live('click', function(){ @@ -29,6 +35,8 @@ jQuery(function($) { }) $(".leave-community").live('click', function(){ + if (!confirm(noosfero.add_and_join.locales.leaveConfirmation)) + return false; clicked = $(this); url = clicked.attr("href"); loading_for_button(this); -- libgit2 0.21.2