Skip to content
Snippets Groups Projects
Commit 0b37db28 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

add personal collections page

parent e8ac5ab1
No related branches found
No related tags found
No related merge requests found
class CollectionsController < ApplicationController
before_action :set_collection, only: [:show, :update, :destroy, :like, :change_privacy]
before_action :set_collections, only: [:list, :add_learning_object, :remove_learning_object]
before_action :authenticate_user!, only: [:update, :destroy, :like, :list, :add_learning_object, :remove_learning_object, :change_privacy]
before_action :authenticate_user!, only: [:update, :destroy, :like, :list, :me, :add_learning_object, :remove_learning_object, :change_privacy]
# GET /collections
# GET /collections.json
......@@ -100,6 +100,19 @@ class CollectionsController < ApplicationController
render layout: false
end
def me
@new_collection = Collection.new
@publishers = publishers_for current_user
@groups = [
CollectionsGroup.new(title: 'Coleções Automáticas',
collections: [current_user.bookmarks]),
CollectionsGroup.new(title: 'Coleções Adicionadas',
collections: current_user.collections)
]
end
# POST /collections/1/learning_object
def add_learning_object
@collections.each do |collection|
......@@ -171,6 +184,14 @@ class CollectionsController < ApplicationController
end
end
def publishers_for(user)
user_new = Institution.new()
user_new.id = user.rid
user_new.name = user.name
[user_new] + user.institutions
end
# Never trust parameters from the scary internet, only allow the white list through.
def collection_params
params.require(:collection).permit(:name, :description, :owner,learning_objects: [])
......
<h1>Coleções de Recursos</h1>
<h1>Coleções Institucionais</h1>
<% if @collections.count == 0 %>
<div class="row no-collections">
<p>Nenhuma coleção foi criada, seja o primeiro!</p>
<p>Nenhuma coleção foi criada!</p>
</div>
<% else %>
......
<div class="user-files">
<div class="row user-page-subtitle">
<div class="col-md-6">
<div class="media">
<div class="media-body">
<h2 class="media-heading">Minhas Coleções</h2>
</div>
</div>
</div>
<div class="col-md-6 right-column align-right">
<%= render 'collections/create', collection: @new_collection, publishers: @publishers, placement: 'left' %>
</div>
</div>
<% @groups.each do |group| %>
<%= render 'collections/group', title: group.title, collections: group.collections %>
<% end %>
</div>
<div class="row">
<div class="col-md-12">
<h4><b><a href="/collections">Institucionais</a></b></h4><br>
<h4><b><a href="/collections/me">Minhas Coleções</a></b></h4>
</div>
</div>
......@@ -20,7 +20,6 @@
<div class="logo">
<%= link_to root_path do %>
<%= image_tag image_path("logo.png"), class: "logo-image" %><br/>
<h3>CONTEÚDO EDUCACIONAL</h3>
<% end %>
</div>
......@@ -36,15 +35,12 @@
<div class="search-input">
<form action="/search" method="get">
<div class="input-group" id="search">
<input type="text" placeholder="buscar em <%= number_with_delimiter(@learning_object_count, delimiter: ".") %> objetos" class="form-control" name="query" id="main_search">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
......@@ -79,7 +75,7 @@
<div class="row">
<ul class="nav navbar-nav">
<li role="separator" class="divider"></li>
<li class="nav-button"><h3><%= link_to 'Coleções', collections_path %></h3></li>
<li class="nav-button"><h3><a class="nav-dropdown" data-content="collections" href="javascript:void(0);">Coleções&nbsp;<span class="caret"/></a></h3></li>
<li role="separator" class="divider"></li>
<li class="dropdown nav-button"><h3><a class="nav-dropdown" data-content="links" href="javascript:void(0);">Links
úteis&nbsp;<span class="caret"/></a></h3></li>
......@@ -98,6 +94,9 @@
<a class="navigation-content-close pull-right" aria-label="Close" href="javascript:void(0);">
<h3><span aria-hidden="true">&times;</span></h3></a>
</div>
<div class="navigation-content-collections">
<%= render 'shared/application/collections' %>
</div>
<div class="navigation-content-links">
<%= render 'shared/application/links' %>
</div>
......
......@@ -64,6 +64,7 @@ Rails.application.routes.draw do
end
end
get '/collections/me' => 'collections#me', as: 'collections_me'
resources :collections do
member do
# collection list
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment