From dafc0cd1bbc68df214429d81f2c05db6248617e2 Mon Sep 17 00:00:00 2001
From: Mauricio Giacomini Girardello <mauriciogiacomini4@gmail.com>
Date: Tue, 29 Sep 2015 14:38:46 -0300
Subject: [PATCH] adding collection features for users page

---
 .../javascripts/application/users.coffee      |  4 ++
 app/assets/javascripts/edges.coffee           |  3 --
 app/assets/javascripts/registrations.coffee   |  3 --
 app/assets/javascripts/university.coffee      |  3 --
 app/assets/javascripts/users.coffee           |  3 --
 .../application/learning_objects.scss         |  2 +-
 app/assets/stylesheets/application/users.scss |  9 ++++-
 app/controllers/users_controller.rb           |  1 +
 app/views/collections/_create.html.erb        |  4 +-
 app/views/collections/_form.html.erb          |  6 +--
 .../_learning_object_vertical.erb             |  2 +-
 app/views/users/show.html.erb                 | 40 +++++++++++++------
 12 files changed, 47 insertions(+), 33 deletions(-)
 create mode 100644 app/assets/javascripts/application/users.coffee
 delete mode 100644 app/assets/javascripts/edges.coffee
 delete mode 100644 app/assets/javascripts/registrations.coffee
 delete mode 100644 app/assets/javascripts/university.coffee
 delete mode 100644 app/assets/javascripts/users.coffee

diff --git a/app/assets/javascripts/application/users.coffee b/app/assets/javascripts/application/users.coffee
new file mode 100644
index 00000000..521a0c47
--- /dev/null
+++ b/app/assets/javascripts/application/users.coffee
@@ -0,0 +1,4 @@
+$('a.showmore').on 'click', ->
+  $('span', this).toggle()
+  $('.user-biography').slideToggle()
+  return
\ No newline at end of file
diff --git a/app/assets/javascripts/edges.coffee b/app/assets/javascripts/edges.coffee
deleted file mode 100644
index 24f83d18..00000000
--- a/app/assets/javascripts/edges.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/registrations.coffee b/app/assets/javascripts/registrations.coffee
deleted file mode 100644
index 24f83d18..00000000
--- a/app/assets/javascripts/registrations.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/university.coffee b/app/assets/javascripts/university.coffee
deleted file mode 100644
index 24f83d18..00000000
--- a/app/assets/javascripts/university.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee
deleted file mode 100644
index 24f83d18..00000000
--- a/app/assets/javascripts/users.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/application/learning_objects.scss b/app/assets/stylesheets/application/learning_objects.scss
index 3d9aebff..69bf2e7a 100644
--- a/app/assets/stylesheets/application/learning_objects.scss
+++ b/app/assets/stylesheets/application/learning_objects.scss
@@ -29,7 +29,7 @@
 
   .learning-object-thumbnail {
     max-width: 250px;
-    height: 150px;
+    height: 150px !important;
     position: relative;
   }
 
diff --git a/app/assets/stylesheets/application/users.scss b/app/assets/stylesheets/application/users.scss
index 03d17a61..7e1d8cca 100644
--- a/app/assets/stylesheets/application/users.scss
+++ b/app/assets/stylesheets/application/users.scss
@@ -11,7 +11,8 @@ $background-grey: #e7e7e8;
 .user-header {
   background-color: $background-grey;
   width: 100%;
-  height: 145px;
+  min-height: 145px;
+  height: auto;
   margin-top: 30px;
   margin-bottom: 50px;
   padding: 15px;
@@ -25,6 +26,7 @@ $background-grey: #e7e7e8;
     font-style: italic;
   }
   .header-content {
+    margin-top: 20px;
   }
 
   .right-column {
@@ -42,3 +44,8 @@ $background-grey: #e7e7e8;
 .user-files {
 
 }
+
+.user-biography {
+  padding-left: 85px !important;
+  display: none;
+}
\ No newline at end of file
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index cda7f8ed..8faf96e9 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -2,6 +2,7 @@ class UsersController < ApplicationController
 
   def show
     @objects = learning_object_repository.all
+    @new_collection = Collection.new
   end
 
 end
diff --git a/app/views/collections/_create.html.erb b/app/views/collections/_create.html.erb
index cf67f6c1..f4e4af8b 100644
--- a/app/views/collections/_create.html.erb
+++ b/app/views/collections/_create.html.erb
@@ -1,7 +1,7 @@
-<a href="#" id="create_collection_popover">Criar coleção</a>
+<button id="create_collection_popover" type="button" class="btn btn-primary">Criar coleção</button>
 
 <div id="create_collection_popover_content" style="display: none">
-  <%= render 'collections/form' %>
+  <%= render 'collections/form', collection: collection %>
 </div>
 
 <div id="create_collection_popover_title" style="display: none">
diff --git a/app/views/collections/_form.html.erb b/app/views/collections/_form.html.erb
index 7330b025..eb14855e 100644
--- a/app/views/collections/_form.html.erb
+++ b/app/views/collections/_form.html.erb
@@ -1,7 +1,7 @@
-<%= form_for @collection do |f| %>
+<%= form_for collection do |f| %>
 
-    <%= f.label :title %>
-    <%= f.text_field :title, required: true, style: 'width: 250px;' %>
+    <%= f.label :name %>
+    <%= f.text_field :name, required: true, style: 'width: 250px;' %>
 
     <%= f.label :privacy %>
     <select name="collection[privacy]">
diff --git a/app/views/learning_objects/_learning_object_vertical.erb b/app/views/learning_objects/_learning_object_vertical.erb
index 7e688779..2ebbc5ee 100644
--- a/app/views/learning_objects/_learning_object_vertical.erb
+++ b/app/views/learning_objects/_learning_object_vertical.erb
@@ -15,4 +15,4 @@
       <span>Por <a>Usuário&nbsp;</a></span>
     </div>
   </div>
-</div>
+</div>
\ No newline at end of file
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 006c5610..e5b7fa87 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -10,13 +10,31 @@
         <div class="media-body">
           <h2 class="media-heading">Usuário</h2>
           <h3 class="header-sub">nome da instituição</h3>
-          <h3 class="header-content">x items</h3>
+          <div class="header-content">
+            <a href="#" class="showmore">
+              <span>ver mais</span>
+              <span style="display: none;">fechar</span>
+            </a>
+          </div>
         </div>
       </div>
     </div>
     <div class="col-md-6 right-column">
-      <button type="button" class="btn btn-default">Seguir</button>
+      <button type="button" class="btn btn-default">Editar perfil</button>
+    </div>
+
+    <div class="col-md-12 user-biography">
+      <h3>Biografia</h3>
+
+      <p>asdasdsadasdas</p>
+
+      <a href="#" class="showmore">
+        <span style="display: none;">fechar</span>
+        <span>fechar</span>
+      </a>
     </div>
+
+    <div style="clear: both;"></div>
   </div>
 
   <div class="user-files">
@@ -24,12 +42,13 @@
       <div class="col-md-6">
         <div class="media">
           <div class="media-body">
-            <h2 class="media-heading">Arquivos do usuário</h2>
+            <h2 class="media-heading">Objetos do usuário</h2>
             <h4>x items</h4>
           </div>
         </div>
       </div>
-      <div class="col-md-6 right-column">
+      <div class="col-md-6 right-column align-right">
+        <button type="button" class="btn btn-primary">Adicionar novo objeto</button>
       </div>
     </div>
 
@@ -53,12 +72,12 @@
       <div class="col-md-6">
         <div class="media">
           <div class="media-body">
-            <h2 class="media-heading">Coleções</h2>
-            <h4>x items</h4>
+            <h2 class="media-heading">Minhas Coleções</h2>
           </div>
         </div>
       </div>
-      <div class="col-md-6 right-column">
+      <div class="col-md-6 right-column align-right">
+        <%= render 'collections/create', collection: @new_collection %>
       </div>
     </div>
 
@@ -71,9 +90,4 @@
       <%= render @objects[2], orientation: "vertical" %>
     </div>
   </div>
-</div>
-
-
-<div class="row">
-  <%#= render 'collections/create' %>
-</div>
+</div>
\ No newline at end of file
-- 
GitLab