+
\ No newline at end of file
diff --git a/features/members_block.feature b/features/members_block.feature
new file mode 100644
index 0000000..b595d5c
--- /dev/null
+++ b/features/members_block.feature
@@ -0,0 +1,55 @@
+Feature:
+ In order to enter in a community
+ As a logged user
+ I want to enter in a community by 'join leave' button in members block
+
+ Background:
+ Given the following users
+ | login | name |
+ | joaosilva | Joao Silva |
+ | mariasilva | Maria Silva |
+ And the following communities
+ | owner | identifier | name |
+ | joaosilva | sample-community | Sample Community |
+ And the following blocks
+ | owner | type |
+ | sample-community | MembersBlock |
+ And I am logged in as "joaosilva"
+ And I go to sample-community's control panel
+ And I follow "Edit sideboxes"
+ And I follow "Edit" within ".members-block"
+ And I check "Show join leave button"
+ And I press "Save"
+
+ 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"
+ And I go to mariasilva's control panel
+ And I follow "Manage my groups"
+ Then I should see "Sample Community"
+
+ Scenario: a user can leave a community by members block's button
+ Given "Maria Silva" is a member of "Sample Community"
+ And I am logged in as "mariasilva"
+ When I go to sample-community's homepage
+ And I follow "Leave community" within ".members-block"
+ And I go to mariasilva's control panel
+ And I follow "Manage my groups"
+ Then I should not see "Sample Community"
+
+ 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"
+ Then I should see "Username / Email"
+
+ Scenario: the join-leave button do not appear if the checkbox show-join-leave-button is not checked
+ And I go to sample-community's control panel
+ And I follow "Edit sideboxes"
+ And I follow "Edit" within ".members-block"
+ 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"
+ And I should not see "Leave community" within ".members-block"
diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css
index 0108560..5234410 100644
--- a/public/designs/themes/base/style.css
+++ b/public/designs/themes/base/style.css
@@ -506,7 +506,6 @@ div#notice {
#content .people-block .block-footer-content a,
#content .profile-list-block .block-footer-content a,
#content .enterprises-block .block-footer-content a,
-#content .members-block .block-footer-content a,
#content .communities-block .block-footer-content a,
#content .friends-block .block-footer-content a {
position: absolute;
@@ -518,6 +517,32 @@ div#notice {
padding-right: 15px;
background: url(imgs/arrow-right-p.png) 100% 50% no-repeat;
}
+#content .members-block .block-footer-content a {
+ position: absolute;
+ top: 2px;
+ right: 0px;
+ font-size: 11px;
+ color: #000;
+ text-decoration: none;
+ padding-right: 15px;
+}
+#content .members-block .block-footer-content a.button {
+ position: relative;
+ padding-left: 10px;
+ background-color: #EEE;
+ border: 1px solid #CCC;
+ color: #555;
+}
+#content .members-block .block-footer-content a.button:hover {
+ color: #FFF;
+ background-color: #555;
+ border: 1px solid #2e3436;
+ text-decoration: none;
+}
+#content .members-block .block-footer-content a.button span {
+ margin: 0px;
+ padding: 0px 0px 0px 7px;
+}
#content .profile-list-block .block-title {
text-align: left;
diff --git a/public/javascripts/add-and-join.js b/public/javascripts/add-and-join.js
index db5a4b9..551ec8d 100644
--- a/public/javascripts/add-and-join.js
+++ b/public/javascripts/add-and-join.js
@@ -12,7 +12,7 @@ jQuery(function($) {
})
$(".join-community").live('click', function(){
- clicked = $(this)
+ clicked = $(".join-community");
url = clicked.attr("href");
loading_for_button(this);
$.post(url, function(data){
@@ -29,7 +29,7 @@ jQuery(function($) {
})
$(".leave-community").live('click', function(){
- clicked = $(this)
+ clicked = $(".leave-community");
url = clicked.attr("href");
loading_for_button(this);
$.post(url, function(data){
diff --git a/test/unit/members_block_test.rb b/test/unit/members_block_test.rb
index d4e877a..854720f 100644
--- a/test/unit/members_block_test.rb
+++ b/test/unit/members_block_test.rb
@@ -39,4 +39,3 @@ class MembersBlockTest < ActiveSupport::TestCase
end
end
-
--
libgit2 0.21.2