mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
show recent docs
This commit is contained in:
parent
4db12b2263
commit
e9383af20c
@ -16,7 +16,8 @@ class DocumentsController < ApplicationController
|
||||
|
||||
def index
|
||||
@page_title = "My documents"
|
||||
@documents = @current_user_content['Document']
|
||||
@documents = @current_user_content.fetch('Document', [])
|
||||
@recent_documents = current_user.linkable_documents.order('updated_at DESC')
|
||||
end
|
||||
|
||||
def show
|
||||
@ -234,18 +235,18 @@ class DocumentsController < ApplicationController
|
||||
@navbar_actions = []
|
||||
return unless user_signed_in?
|
||||
|
||||
if @current_user_content && @current_user_content['Document'].present?
|
||||
@navbar_actions << {
|
||||
label: "Your #{@current_user_content['Document'].count} Document#{'s' unless @navbar_actions == 1}",
|
||||
href: documents_path
|
||||
}
|
||||
end
|
||||
# if @current_user_content && @current_user_content['Document'].present?
|
||||
# @navbar_actions << {
|
||||
# label: "Your #{@current_user_content['Document'].count} Document#{'s' unless @navbar_actions == 1}",
|
||||
# href: documents_path
|
||||
# }
|
||||
# end
|
||||
|
||||
@navbar_actions << {
|
||||
label: "New Document",
|
||||
href: new_document_path,
|
||||
target: '_blank'
|
||||
}
|
||||
# @navbar_actions << {
|
||||
# label: "New Document",
|
||||
# href: new_document_path,
|
||||
# target: '_blank'
|
||||
# }
|
||||
end
|
||||
|
||||
def set_footer_visibility
|
||||
|
||||
@ -97,39 +97,41 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% 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>
|
||||
<% 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>
|
||||
<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) %>
|
||||
|
||||
@ -11,9 +11,21 @@
|
||||
<% end %>
|
||||
|
||||
<% if @documents.any? %>
|
||||
<%= render partial: 'content/components/list_filter_bar', locals: { content_type: Document } %>
|
||||
<%= render partial: 'notice_dismissal/messages/02' %>
|
||||
<%= render partial: 'content/list/cards', locals: { content_list: @documents, content_type: Document } %>
|
||||
<%= content_for :full_width_page_content do %>
|
||||
<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 } %>
|
||||
</div>
|
||||
<!-- recent documents -->
|
||||
<div class="row">
|
||||
<%= render partial: 'content/components/list_filter_bar', locals: { content_type: Document } %>
|
||||
<h5>All documents</h5>
|
||||
<%= render partial: 'notice_dismissal/messages/02' %>
|
||||
<%= render partial: 'content/list/cards', locals: { content_list: @documents, content_type: Document } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @documents.empty? %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user