From f811ca37e00c1ee73a94e97df1d608a169899f44 Mon Sep 17 00:00:00 2001 From: Mateus Rambo Strey <mars11@inf.ufpr.br> Date: Mon, 23 Nov 2015 09:58:03 -0200 Subject: [PATCH] add select all in collections show --- app/assets/javascripts/application/collections.coffee | 11 +++++++++++ app/views/collections/show.html.erb | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/application/collections.coffee b/app/assets/javascripts/application/collections.coffee index 2c60bd6e..186298ef 100644 --- a/app/assets/javascripts/application/collections.coffee +++ b/app/assets/javascripts/application/collections.coffee @@ -108,6 +108,17 @@ $(document).on 'click', '.collection-selector', -> $(document).trigger('check_selected_collection') return +# select all objects +$(document).on 'mark_all_collections', -> + selected_objects = [] + $('.collection-selector').each () -> + $(this).attr('checked', true) if !this.checked + selected_objects.push this.value + $(document).trigger('check_selected_collection') + +$(document).on 'click', '.count-collections-objects', -> + $(document).trigger('mark_all_collections') + # clear selected objects $(document).on 'clear_collections', -> selected_objects = [] diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index 835e7308..6c6bdeea 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -26,8 +26,10 @@ <ul class="nav navbar-nav navbar-right collection-header" style="margin-left: 30px;"> <li><h2><%= (@collection.class != Bookmarks) ? @collection.name : "Favoritos" %></h2></li> <li> - <%= image_tag image_path("icons/square.png"), class: "logo-image", size: "20x20" %> - <%= collection_length @collection %> + <a class="count-collections-objects" data-toggle="tooltip" data-placement="bottom" title="Selecionar todos"> + <%= image_tag image_path("icons/square.png"), class: "logo-image", size: "20x20" %> + <%= collection_length @collection %> + </a> </li> </ul> </div> @@ -42,10 +44,12 @@ <a href="javascript:void(0);"><span class="left-edge1"><%= image_tag image_path("icons/Download_01.png"), class: "logo-image", size: "35x35" %></span><span style="color: white"> Salvar no <br>computador</span></a> </li> + <% if user_signed_in? %> <li class="set-align collection-button" data-action="copy"> <a href="javascript:void(0);"><span class="left-edge1"><%= image_tag image_path("icons/Copiar_Seleção.png"), class: "logo-image", size: "35x35" %></span><span style="color: white"> Copiar <br>para</span></a> </li> + <% end %> <% if @own %> <li class="set-align collection-button" data-action="move"> <a href="javascript:void(0);"><span class="left-edge1"><%= image_tag image_path("icons/Mover_Seleção.png"), class: "logo-image", size: "35x35" %></span><span style="color: white"> -- GitLab