mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
clean up collections#index code
This commit is contained in:
parent
3bedd64447
commit
6143bebc77
25
app/views/page_collections/_collection_grid.html.erb
Normal file
25
app/views/page_collections/_collection_grid.html.erb
Normal file
@ -0,0 +1,25 @@
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
<i class="material-icons <%= PageCollection.color %>-text"><%= PageCollection.icon %></i>
|
||||
<%= title %>
|
||||
</h1>
|
||||
<% collection_list.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 %>
|
||||
@ -6,31 +6,8 @@
|
||||
|
||||
<% if @my_collections.any? || current_user.on_premium_plan? %>
|
||||
<div class="row">
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
<i class="material-icons <%= PageCollection.color %>-text"><%= PageCollection.icon %></i>
|
||||
Your collections
|
||||
</h1>
|
||||
<% @my_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 %>
|
||||
<%= render partial: 'page_collections/collection_grid', locals: { collection_list: @my_collections, title: "Your collections" } %>
|
||||
|
||||
<% if current_user.on_premium_plan? %>
|
||||
<div class="col s12 m6 l4">
|
||||
<%= link_to new_page_collection_path do %>
|
||||
@ -48,90 +25,18 @@
|
||||
|
||||
<% 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 %>
|
||||
<%= render partial: 'page_collections/collection_grid', locals: { collection_list: @followed_collections, title: "Collections you follow" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @network_collections.any? %>
|
||||
<div class="row">
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
<i class="material-icons <%= PageCollection.color %>-text"><%= PageCollection.icon %></i>
|
||||
Collections from your network
|
||||
</h1>
|
||||
<% @network_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 %>
|
||||
<%= render partial: 'page_collections/collection_grid', locals: { collection_list: @network_collections, title: "Collections from your network" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @random_collections.any? %>
|
||||
<div class="row">
|
||||
<h1 class="center" style="font-size: 2em">
|
||||
<i class="material-icons <%= PageCollection.color %>-text"><%= PageCollection.icon %></i>
|
||||
Discover more collections
|
||||
</h1>
|
||||
<% @random_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 %>
|
||||
<%= render partial: 'page_collections/collection_grid', locals: { collection_list: @random_collections, title: "Discover more collections" } %>
|
||||
</div>
|
||||
<% end %>
|
||||
@ -1,3 +1,3 @@
|
||||
<h1 style="font-size: 2em">New Page Collection</h1>
|
||||
<h1 style="font-size: 2em">Create a Collection</h1>
|
||||
|
||||
<%= render 'form', page_collection: @page_collection %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user