From 41cfea6ec1661300564d0e03b58532c0421a5944 Mon Sep 17 00:00:00 2001 From: Giovanne Marcelo <gms15@inf.ufpr.br> Date: Wed, 30 Mar 2016 10:27:31 -0300 Subject: [PATCH] Fixing collection counter in show --- app/assets/javascripts/application/collections.coffee | 7 +++++++ app/views/bookmarks/show.html.erb | 2 +- app/views/collections/show.html.erb | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/application/collections.coffee b/app/assets/javascripts/application/collections.coffee index 0289e4e5..cb07ce33 100644 --- a/app/assets/javascripts/application/collections.coffee +++ b/app/assets/javascripts/application/collections.coffee @@ -172,6 +172,13 @@ $(document).on 'refresh_comments', (e) -> $.get url, (data) -> $parent.html('<br>' + data) + num = $('.learning-object-vertical').length + if num == 0 + $('.object-number').html("coleção vazia") + else if num == 1 + $('.object-number').html("1 objeto") + else + $('.object-number').html( num + " objetos") $(document).trigger 'create-learning-object-columns' $(document).trigger 'add_collection_selector' diff --git a/app/views/bookmarks/show.html.erb b/app/views/bookmarks/show.html.erb index db21f6fe..e82c8621 100644 --- a/app/views/bookmarks/show.html.erb +++ b/app/views/bookmarks/show.html.erb @@ -7,7 +7,7 @@ <li><h2>Favoritos</h2></li> <li> <input type="checkbox" class="count-collections-objects" data-toggle="tooltip" data-placement="bottom" title="Selecionar todos"> - <%= bookmark_length @user %> + <span class="object-number"><%= bookmark_length @user %></span> </li> </ul> </div> diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index 6c38c911..8957332f 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -29,8 +29,8 @@ <li><h2><%= (@collection.class != Bookmark) ? @collection.name : "Favoritos" %></h2></li> <li> <input type="checkbox" class="count-collections-objects" data-toggle="tooltip" data-placement="bottom" title="Selecionar todos"> - <%= collection_length @collection %> - </a> + <span class="object-number"><%= collection_length @collection %> + </span> </li> </ul> </div> -- GitLab