mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
add followed collections to collections#index
This commit is contained in:
parent
35c248a419
commit
3bedd64447
@ -13,6 +13,8 @@ class PageCollectionsController < ApplicationController
|
||||
@network_collections = PageCollection.where(user_id: followed_user_ids, privacy: 'public')
|
||||
|
||||
@random_collections = PageCollection.where(privacy: 'public').sample(9)
|
||||
|
||||
@followed_collections = current_user.followed_page_collections
|
||||
end
|
||||
|
||||
# GET /page_collections/1
|
||||
|
||||
@ -75,6 +75,7 @@ class User < ApplicationRecord
|
||||
@published_in_page_collections ||= PageCollection.where(id: ids)
|
||||
end
|
||||
has_many :page_collection_followings, dependent: :destroy
|
||||
has_many :followed_page_collections, through: :page_collection_followings, source: :page_collection
|
||||
has_many :page_collection_reports, dependent: :destroy
|
||||
|
||||
has_many :votes, dependent: :destroy
|
||||
|
||||
@ -46,6 +46,36 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @followed_collections.any? %>
|
||||
<div class="row">
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
<i class="material-icons <%= PageCollection.color %>-text"><%= PageCollection.icon %></i>
|
||||
Collections you follow
|
||||
</h1>
|
||||
<% @followed_collections.each do |collection| %>
|
||||
<div class="col s12 m6 l4">
|
||||
<%= link_to collection do %>
|
||||
<div class="hoverable card <%= PageCollection.color %>" style="height: 250px">
|
||||
<div class="card-image">
|
||||
<%= image_tag collection.random_public_image, style: 'max-height: 250px;' %>
|
||||
<span class="card-title bordered-text">
|
||||
<%= collection.title %>
|
||||
<br />
|
||||
<small>
|
||||
<% collection.page_types.each do |icon| %>
|
||||
<% klass = icon.constantize %>
|
||||
<i class="material-icons left tooltipped tiny <%= klass.color %>-text" data-tooltip="<%= icon.pluralize %>"><%= klass.icon %></i>
|
||||
<% end %>
|
||||
</small>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @network_collections.any? %>
|
||||
<div class="row">
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user