Skip to content
Snippets Groups Projects
Commit ab720b90 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Merge branch 'master' into add-thumbnail-to-archives

parents a9d35429 2e542a8b
No related branches found
No related tags found
No related merge requests found
app/assets/images/icons/checked.png

666 B

app/assets/images/icons/unchecked.png

688 B

$ ->
$('.default_btn').toggleClass 'active_btn'
$('.add_to_collection').popover
html: true,
container: 'body',
......@@ -18,4 +19,5 @@ $ ->
# The `data` parameter is the decoded JSON object
$(document).on 'ajax:success', 'a.vote', (status, data, xhr)->
$(".votes-count[data-id='#{data.id}']").text data.count
return
\ No newline at end of file
return
......@@ -262,23 +262,6 @@ header {
}
}
//form complaint
.submit_button {
color: #FFFFFF;
background: #2178F5;
border-radius : 5px 5px 20px 20px ;
moz-border-radius : 5px 5px 20px 20px ;
}
.close_button {
color: #FFFFFF;
background: #2178F5;
border-radius : 5px 5px 20px 20px ;
moz-border-radius : 5px 5px 20px 20px ;
}
.popover {
display: none;
z-index: 999;
......@@ -286,11 +269,6 @@ header {
width: auto;
}
.popover-title{
background: #2178F5;
color: #FFFFFF;
}
//// FOOTER
footer {
width: 100%;
......
$background-grey: #e7e7e8;
$unchecked_icon: 'icons/unchecked.png';
$checked_icon: 'icons/checked.png';
.learning-object-horizontal, .learning-object-vertical {
margin-bottom: 20px;
......@@ -31,14 +33,14 @@ $background-grey: #e7e7e8;
.learning-object-horizontal {
.learning-object-thumbnail {
float:left;
float: left;
}
.learning-object-body {
width: calc(100% - 250px);
padding: 0px;
padding-left: 5px;
float:left;
float: left;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
......@@ -93,8 +95,8 @@ $background-grey: #e7e7e8;
audio {
width: inherit;
position: relative;
top: 50%;
transform: translateY(-50%);
top: 50%;
transform: translateY(-50%);
}
img {
width: inherit;
......@@ -158,3 +160,49 @@ $background-grey: #e7e7e8;
}
}
}
#collections_list_popover {
display: none;
z-index: 999;
ul {
list-style: none;
padding: 0;
margin: 0;
li {
a.default_btn {
span {
background: url($unchecked_icon);
width: 20px;
height: 20px;
margin: 0 5px 0 0;
}
}
a.default_btn:hover {
span {
background: url($checked_icon);
width: 20px;
height: 20px;
margin: 0 5px 0 0;
}
}
a.active_btn {
span {
background: url($checked_icon);
width: 20px;
height: 20px;
margin: 0 5px 0 0;
}
}
a.active_btn:hover {
span {
background: url($unchecked_icon);
width: 20px;
height: 20px;
margin: 0 5px 0 0;
}
}
}
}
}
\ No newline at end of file
class CollectionsController < ApplicationController
before_action :set_collection, only: [:show, :update, :destroy, :like]
before_action :set_collection, only: [:show, :update, :destroy, :like, :add_learning_object]
before_action :authenticate_user!, except: [:index, :show]
# GET /collections
......@@ -56,6 +56,17 @@ class CollectionsController < ApplicationController
end
end
# POST /collections/1/learning_object/43
def add_learning_object
learning_object = learning_object_repository.find params[:learning_object_id]
@collection.add learning_object
collection_repository.save @collection
if request.xhr?
render json: {collections: @collection.learning_objects.as_json}
end
end
private
def set_collection
......
......@@ -15,8 +15,7 @@ module OrientDb
end
def get_number_of_collections
result = get_number_of("Collection")
result
get_number_of odb_class
end
def create_bookmarks_collection(user)
......
<div id="collections_list_popover" style="display: none; z-index: 999;">
<div id="collections_list_popover">
<% if collections.empty? %>
<%= link_to 'Criar coleção', me_users_path %>
<% else %>
<ul>
<% collections.each do |collection| %>
<li><%= collection.name %></li>
<li>
<%= link_to collection.name, add_collection_learning_object_collection(id: collection.id, learning_object_id: learning_object.id), class: 'default_btn', method: :post, remote: true %>
</li>
<% end %>
</ul>
<% end %>
......
......@@ -45,8 +45,11 @@ Rails.application.routes.draw do
resources :institutions
resources :collections do
member do
post '/learning_object/:learning_object_id', as: :add_collection_learning_object, action: :add_learning_object
end
end
resources :subjects, only: [:index, :show]
resources :complaints, only: [:create, :destroy]
......
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