[Git][noosfero/noosfero][master] 3 commits: Adds toggle button to show subcategories
Rodrigo Souto
gitlab at mg.gitlab.com
Fri Jun 8 11:45:56 BRT 2018
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
23d1160d by Lucas Martins at 2018-05-17T16:27:40Z
Adds toggle button to show subcategories
- - - - -
c9cc3ae8 by Lucas Martins at 2018-06-04T15:31:07Z
Fixes admin categories acceptance tests
- - - - -
77acde2d by Rodrigo Souto at 2018-06-08T14:45:52Z
Merge branch 'issue_309_buttons_in_general_categories' into 'master'
Adds toggle button in general categories
Closes #309
See merge request noosfero/noosfero!1495
- - - - -
4 changed files:
- app/views/categories/_category.html.erb
- features/admin_categories.feature
- features/manage_categories.feature
- public/javascripts/manage-categories.js
Changes:
=====================================
app/views/categories/_category.html.erb
=====================================
--- a/app/views/categories/_category.html.erb
+++ b/app/views/categories/_category.html.erb
@@ -20,10 +20,7 @@
</div>
<div class='button' id="category-loading-<%= category.id %>" style="position: relative;">
- <a href="#" id="show-button-<%= category.id %>" class="show-button" onclick="return false;" data-category="<%= category.id %>"><%= _('Show subcategories') %></a>
- </div>
- <div class='button' id="category-loading-<%= category.id %>" style="position: relative;">
- <a href="#" id="hide-button-<%= category.id %>" class="hide-button" onclick="return false;" data-category="<%= category.id %>"><%= _('Hide subcategories') %></a>
+ <a href="#" id="show-hide-button-<%= category.id %>" class="show-button" onclick="return false;" data-category="<%= category.id %>"><%= _('Show/Hide subcategories') %></a>
</div>
</div>
<% end %>
=====================================
features/admin_categories.feature
=====================================
--- a/features/admin_categories.feature
+++ b/features/admin_categories.feature
@@ -63,9 +63,9 @@ Feature: manage categories
And I follow "Administration"
And I follow "Categories"
Then I should see "Food"
- When I follow "Show subcategories"
+ When I follow "Show/Hide subcategories"
Then I should see "Vegetarian"
And I should see "Steak"
- And I follow "Hide subcategories"
+ And I follow "Show/Hide subcategories"
And I should not see "Steak"
Then I should not see "Vegetarian"
=====================================
features/manage_categories.feature
=====================================
--- a/features/manage_categories.feature
+++ b/features/manage_categories.feature
@@ -28,6 +28,5 @@ Feature: manage categories
And I should not see "Potatoes"
When I follow "Show"
And I wait 0.5 seconds for Services show animation to finish
- And I follow "Show"
Then I should see "Beans"
And I should see "Potatoes"
=====================================
public/javascripts/manage-categories.js
=====================================
--- a/public/javascripts/manage-categories.js
+++ b/public/javascripts/manage-categories.js
@@ -8,9 +8,6 @@
success: function(data, st, ajax){
$(sub_items).append(data);
$(".small-loading").remove();
- $("#show-button-"+category).fadeOut(400, function(){
- $("#hide-button-"+category).fadeIn();
- });
$(sub_items).slideDown();
},
error: function(ajax, st, errorThrown) {
@@ -22,10 +19,9 @@
$(".hide-button").live('click', function(){
var category = $(this).attr('data-category');
var sub_items = $('#category-sub-items-'+category);
- $(this).fadeOut(400, function(){
- $("#show-button-"+category).fadeIn();
- });
$(sub_items).slideUp();
+ $(this).toggleClass("show-button");
+ $(this).removeClass("hide-button");
});
$(".show-button").live('click', function(){
@@ -36,11 +32,10 @@
$(this).attr('data-fetched', true);
}
else{
- $(this).fadeOut(400, function(){
- $("#hide-button-"+category).fadeIn();
- });
$(sub_items).slideDown();
}
+ $(this).toggleClass("hide-button");
+ $(this).removeClass("show-button");
});
})(jQuery);
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/dbdc2a75c276c76baa159074f8cef6735b41d60d...77acde2dc87489c3ddddafca260686a4b6c4de31
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/dbdc2a75c276c76baa159074f8cef6735b41d60d...77acde2dc87489c3ddddafca260686a4b6c4de31
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180608/04854673/attachment-0001.html>
More information about the Noosfero-dev
mailing list