mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
documents#index design work
This commit is contained in:
parent
ce2e899c0f
commit
4745faae7b
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 184 KiB |
111
app/views/content/list/_dense_cards.html.erb
Normal file
111
app/views/content/list/_dense_cards.html.erb
Normal file
@ -0,0 +1,111 @@
|
||||
<div class="js-content-cards-list">
|
||||
<% content_list.each.with_index do |content, i| %>
|
||||
<div class="col s12 m3 l2 js-content-card-container">
|
||||
<div class="hoverable card sticky-action" style="margin-bottom: 2px">
|
||||
<div class="card-image waves-effect waves-block waves-light teal">
|
||||
<%= render partial: 'content/display/favorite_control', locals: { content: content } %>
|
||||
<% content_image = asset_path("card-headers/#{content_type.name.downcase.pluralize}.jpg") %>
|
||||
<% if content.respond_to?(:image_uploads) %>
|
||||
<% images = content.image_uploads %>
|
||||
<% if images.any? %>
|
||||
<% content_image = images.sample.src(:medium) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="activator" style="height: 165px; background: url('<%= content_image %>'); background-size: cover;"></div>
|
||||
|
||||
<span class="card-title js-content-name activator">
|
||||
<div class="bordered-text">
|
||||
<%= ContentFormatterService.show(text: content.name.presence || 'Untitled', viewing_user: current_user) %>
|
||||
</div>
|
||||
|
||||
<% if content.respond_to?(:page_tags) %>
|
||||
<p class="tags-container">
|
||||
<% content.page_tags.each do |tag| %>
|
||||
<% if user_signed_in? && content.user == current_user %>
|
||||
<%=
|
||||
link_to send(
|
||||
"page_tag_#{content.class.name.downcase.pluralize}_path",
|
||||
slug: PageTagService.slug_for(tag.tag)
|
||||
) do
|
||||
%>
|
||||
<span class="new badge <%= params[:slug] == tag.slug ? content_type.color : 'grey' %> left" data-badge-caption="<%= tag.tag %>"></span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="new badge <%= params[:slug] == tag.slug ? content_type.color : 'grey' %> left" data-badge-caption="<%= tag.tag %>"></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<% if current_user.can_update?(content) %>
|
||||
<%= link_to edit_polymorphic_path(content), class: 'green-text right', target: content.is_a?(Document) ? '_new' : '_self' do %>
|
||||
Edit
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_user.can_read?(content) %>
|
||||
<%= link_to polymorphic_path(content), class: 'blue-text text-lighten-1' do %>
|
||||
View
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if local_assigns.fetch(:show_new_button, true) %>
|
||||
<% if current_user.can_create?(content_type) %>
|
||||
<div class="col s12 m6 l4">
|
||||
<%= link_to new_polymorphic_path(content_type), class: 'white-text' do %>
|
||||
<div class="hoverable card <%= content_type.color %> lighten-1" style="height: 320px;">
|
||||
<div class="card-content fixed-card-content centered-card-content">
|
||||
<p>
|
||||
<i class="material-icons large">add</i>
|
||||
</p>
|
||||
<strong class="card-title">
|
||||
New<br />
|
||||
<%= content_type.name %>
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="col s12 m6 l4">
|
||||
<div class="card <%= content_type.color %> lighten-3" style="height: 320px;">
|
||||
<div class="card-content fixed-card-content">
|
||||
<p class="center grey-text text-lighten-1" style="margin-top: 50px; margin-bottom: 20px;">
|
||||
<i class="material-icons large"><%= content_type.icon %></i>
|
||||
</p>
|
||||
<p>
|
||||
An active
|
||||
<%= link_to 'Notebook.ai Premium', subscription_path, class: 'blue-text text-darken-2' %> subscription
|
||||
is required to create additional
|
||||
<%= content_type.name.downcase %> pages, but pages you've already created will always
|
||||
be available here.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if local_assigns.fetch(:show_template_editor_form, false) %>
|
||||
<div class="col s12 m6 l4">
|
||||
<%= link_to attribute_customization_path(content_type: content_type.name.downcase), class: 'white-text' do %>
|
||||
<div class="hoverable card <%= content_type.color %> lighten-2" style="height: 320px;">
|
||||
<div class="card-content fixed-card-content centered-card-content">
|
||||
<p>
|
||||
<i class="material-icons large"><%= content_type.icon %></i>
|
||||
</p>
|
||||
<strong class="card-title">
|
||||
Customize<br />
|
||||
template
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@ -37,28 +37,33 @@
|
||||
<strong style="font-size: 1.2em"><%= document.title %></strong>
|
||||
</div>
|
||||
<div style="padding-left: 2.6em">
|
||||
|
||||
<% if current_user.can_update?(document) %>
|
||||
<%= link_to edit_polymorphic_path(document), class: 'green white-text btn-flat', target: document.is_a?(Document) ? '_new' : '_self' do %>
|
||||
<i class="material-icons left"><%= content_type.icon %></i>
|
||||
Edit
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_user.can_read?(document) %>
|
||||
<%= link_to polymorphic_path(document), class: 'blue white-text text-lighten-1 btn-flat' do %>
|
||||
<i class="material-icons left"><%= content_type.icon %></i>
|
||||
View
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to '#', class: 'btn-flat orange white-text' do %>
|
||||
<% if current_user.can_update?(document) %>
|
||||
<%= link_to edit_polymorphic_path(document), class: 'green white-text btn-flat', target: document.is_a?(Document) ? '_new' : '_self' do %>
|
||||
<i class="material-icons left"><%= content_type.icon %></i>
|
||||
Edit
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to analysis_document_path(document), class: 'btn-flat orange white-text' do %>
|
||||
<i class="material-icons left">bar_chart</i>
|
||||
Analyze
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= document.reading_estimate %>
|
||||
<%# pluralize 0, 'word' %>
|
||||
<div>
|
||||
<i class="material-icons tiny" style="position: relative; top: 3px;">text_snippet</i>
|
||||
<%= pluralize document.word_count, 'word' %>
|
||||
</div>
|
||||
<div>
|
||||
<i class="material-icons tiny" style="position: relative; top: 3px;">timer</i>
|
||||
<%= document.reading_estimate %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="tooltipped" data-tooltip="Last edited at <%= document.updated_at.strftime("%m/%d/%Y %H:%M UTC") %>">
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<h5>Recently-edited documents</h5>
|
||||
<%= render partial: 'content/list/cards', locals: { content_list: @documents.first(3), content_type: Document, show_new_button: false } %>
|
||||
<%= render partial: 'content/list/dense_cards', locals: { content_list: @recent_documents, content_type: Document, show_new_button: false } %>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user