From e14b126ea306129538ded050f5da82a666461c95 Mon Sep 17 00:00:00 2001 From: Mauricio Giacomini Girardello <mauriciogiacomini4@gmail.com> Date: Wed, 11 Nov 2015 10:19:33 -0200 Subject: [PATCH] changing bookmarks icon --- app/controllers/users_controller.rb | 1 - app/helpers/collections_helper.rb | 22 +++++---------- app/views/bookmarks/_bookmarks.html.erb | 3 +- app/views/collections/_bookmarks.html.erb | 11 ++++++++ app/views/collections/_collection.html.erb | 3 +- app/views/collections/show.html.erb | 10 +++++-- app/views/collections/test.html.erb | 32 ---------------------- 7 files changed, 27 insertions(+), 55 deletions(-) create mode 100644 app/views/collections/_bookmarks.html.erb delete mode 100644 app/views/collections/test.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5075b7b8b..af80c2385 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -35,7 +35,6 @@ class UsersController < ApplicationController @users = user_repository.all end - private def set_empty_collection diff --git a/app/helpers/collections_helper.rb b/app/helpers/collections_helper.rb index a8b313c9b..4b5009183 100644 --- a/app/helpers/collections_helper.rb +++ b/app/helpers/collections_helper.rb @@ -3,25 +3,17 @@ module CollectionsHelper ## # x objetos educacionais def collection_length(collection) - "#{collection.learning_objects.count} objetos educacionais nessa coleção" + count = collection.learning_objects.count + + if count > 0 + "#{count} objetos" + else + 'nenhum objeto na coleção' + end end def end_of_column_collection(index) index % 3 == 0 end - def render_collection_objects(learning_objects = []) - columns = 3 - objects_per_column = (learning_objects.length / columns).ceil - - for i in columns - content_tag :div, class: 'col-md-4' do - for j in objects_per_column - learning_object = learning_objects.pop - render learning_object, orientation: "horizontal" unless learning_object.nil? - end - end - end - end - end \ No newline at end of file diff --git a/app/views/bookmarks/_bookmarks.html.erb b/app/views/bookmarks/_bookmarks.html.erb index 07fbcb9b0..3478a9610 100644 --- a/app/views/bookmarks/_bookmarks.html.erb +++ b/app/views/bookmarks/_bookmarks.html.erb @@ -1,2 +1 @@ -<% bookmarks.owner.name = "" %> -<%= render 'collections/collection', collection: bookmarks %> +<%= render 'collections/bookmarks', collection: bookmarks %> \ No newline at end of file diff --git a/app/views/collections/_bookmarks.html.erb b/app/views/collections/_bookmarks.html.erb new file mode 100644 index 000000000..ff7849355 --- /dev/null +++ b/app/views/collections/_bookmarks.html.erb @@ -0,0 +1,11 @@ +<%= link_to collection_path(id: collection.id) do %> + <div class="col-sm-4"> + <div> + <%= image_tag 'icons/star-grey.png', width: 210,height:140 %> + </div> + <div class="panel-body"> + <h4 class="media-heading">Favoritos</h4> + <span><a><%= collection_length collection %></a></span> + </div> + </div> +<% end %> diff --git a/app/views/collections/_collection.html.erb b/app/views/collections/_collection.html.erb index f8cf27f6c..96b95c1a7 100644 --- a/app/views/collections/_collection.html.erb +++ b/app/views/collections/_collection.html.erb @@ -5,8 +5,7 @@ </div> <div class="panel-body"> <h4 class="media-heading"><%= collection.name unless collection.name == "Bookmarks" %><%= "Favoritos" if collection.name == "Bookmarks" %></h4> - <!-- <span class="glyphicon glyphicon-eye-open">200 </span> - <span class="glyphicon glyphicon-star">4,5 </span> --> + <span><a><%= collection_length collection %></a></span> <span><a><%= 'Por '+ collection.owner.name unless collection.owner.name.blank? %></a></span> </div> </div> diff --git a/app/views/collections/show.html.erb b/app/views/collections/show.html.erb index e7a016113..87790b6b0 100644 --- a/app/views/collections/show.html.erb +++ b/app/views/collections/show.html.erb @@ -7,13 +7,17 @@ <%= link_to 'APAGAR', collection_path(@collection.id), method: :delete, class: 'btn btn-danger btn-remove', style:'margin-right: 30px', data: { confirm: 'Não será possÃvel recuperá-la, você tem certeza?' } %></span> <% end %> <div class="collection-privacy"> - <input type="radio" name="privacy" id="privacy_private" data-cid="<%= @collection.id %>" value="private" <%= "checked" if @collection.privacy == "private" %>><label for="privacy_private">Privada</label> | - <input type="radio" name="privacy" id="privacy_public" data-cid="<%= @collection.id %>" value="public" <%= "checked" if @collection.privacy == "public" %>><label for="privacy_public">Pública</label> + <input type="radio" name="privacy" id="privacy_private" data-cid="<%= @collection.id %>" value="private" <%= "checked" if @collection.privacy == "private" %>> <label for="privacy_private">Privada</label> | + <input type="radio" name="privacy" id="privacy_public" data-cid="<%= @collection.id %>" value="public" <%= "checked" if @collection.privacy == "public" %>> <label for="privacy_public">Pública</label> </div> </div> <% end %> <div class="navbar-header"> - <%= image_tag image_path("icons/collection.png"), class: "logo-image", size: "90x66" %> + <% if @collection.class != Bookmarks %> + <%= image_tag image_path("icons/collection.png"), class: "logo-image", size: "90x66" %> + <% else %> + <%= image_tag image_path("icons/star-grey.png"), class: "logo-image", size: "90x66" %> + <% end %> <ul class="nav navbar-nav navbar-right collection-header" style="margin-left: 30px;"> <li><h2><%= (@collection.class != Bookmarks) ? @collection.name : "Favoritos" %></h2></li> <li> diff --git a/app/views/collections/test.html.erb b/app/views/collections/test.html.erb deleted file mode 100644 index 3b55d1d1e..000000000 --- a/app/views/collections/test.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<nav class="navigation navbar-default "><br/> - - <div class="container-fluid"> - <div class="navbar-header"> - <%= image_tag image_path("icons/collection.png"), class: "logo-image", size: "90x66" %> - <ul class="nav navbar-nav navbar-right"><h1> <b>Coleção 1</b></h1> <br/> - <%= image_tag image_path("icons/square.png"), class: "logo-image", size: "20x20" %> 200 itens - </ul> - </div> - </div> - <br/></nav> -<nav class="navigation navbar-inverse "> - <div class="container-fluid"> - <a class="navbar-brand" href="#">x arquivo(s) selecionado(s)</a> - <ul class="nav navbar-nav navbar-right"> - <li><a href="#"><%= image_tag image_path("icons/collection1.png"), class: "logo-image", size: "35x28" %> Salvar no - computador</a></li> - <li><a href="#"><%= image_tag image_path("icons/collection1.png"), class: "logo-image", size: "35x28" %> Copiar - para</a></li> - <li><a href="#"><%= image_tag image_path("icons/collection1.png"), class: "logo-image", size: "35x28" %> Mover - para</a></li> - <li> - <a href="#"><%= image_tag image_path("icons/collection1.png"), class: "logo-image", size: "35x28" %> Remover da - coleção</a></li> - </ul> - </div> -</nav> - -<div class="row mainpage-subjects"> - <br/> - <%= render_collection_objects @collection.learning_objects %> -</div> \ No newline at end of file -- GitLab