mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
recycle bin improvements
This commit is contained in:
parent
4ce5976874
commit
14c14df4dd
@ -334,11 +334,13 @@ class ContentController < ApplicationController
|
||||
|
||||
# List all recently-deleted content
|
||||
def deleted
|
||||
@maximum_recovery_time = current_user.on_premium_plan? ? 7.days : 48.hours
|
||||
|
||||
@content_pages = {}
|
||||
@activated_content_types.each do |content_type|
|
||||
@content_pages[content_type] = content_type.constantize.with_deleted.where('deleted_at > ?', 24.hours.ago).where(user_id: current_user.id)
|
||||
@content_pages[content_type] = content_type.constantize.with_deleted.where('deleted_at > ?', @maximum_recovery_time.ago).where(user_id: current_user.id)
|
||||
end
|
||||
@content_pages["Document"] = current_user.documents.with_deleted.where('deleted_at > ?', 24.hours.ago)
|
||||
@content_pages["Document"] = current_user.documents.with_deleted.where('deleted_at > ?', @maximum_recovery_time.ago)
|
||||
|
||||
# Override controller
|
||||
@sidenav_expansion = 'my account'
|
||||
|
||||
@ -1,17 +1,40 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col s12">
|
||||
<div class="card red lighten-5">
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<p class="grey-text text-darken-3">
|
||||
Pages can be "un-deleted" for up to 24 hours after deletion.
|
||||
After this time, they are permanently deleted and cannot be recovered.
|
||||
Use this page if you've accidentally deleted a page and need to recover it.
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col s12 m7 l8">
|
||||
<div class="card-title">Your notebook's recycle bin</div>
|
||||
<p>
|
||||
Hello there!
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
Whenever you delete a page from your notebook, it ends up here for a little while.
|
||||
While a page is here, you can recover it at any time to add it back to your notebook.
|
||||
If not recovered, the page will be automatically and permanently deleted.
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
In other words, use this page if you've accidentally deleted a page and need to recover it.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col hide-on-sm-only m5 l4">
|
||||
<%= image_tag 'tristan/small.png',
|
||||
class: 'tooltipped tristan',
|
||||
data: {
|
||||
position: 'left',
|
||||
enterDelay: '500',
|
||||
tooltip: "Hey, I'm Tristan! I'm happy to help you around Notebook.ai."
|
||||
} %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<% showed_any_content = false %>
|
||||
|
||||
@ -78,13 +101,13 @@
|
||||
<% end %>
|
||||
</span>
|
||||
<p class='grey-text'>
|
||||
<span class="timestamp tooltipped" data-position="bottom" data-delay="500" data-tooltip="<%= content.deleted_at.strftime("%m/%d/%Y %H:%M") %>" style="font-size: 80%">
|
||||
<span class="timestamp tooltipped" data-position="bottom" data-delay="500" data-tooltip="Deleted at <%= content.deleted_at.strftime("%m/%d/%Y %H:%M %Z") %>" style="font-size: 80%">
|
||||
<i class="material-icons">delete</i>
|
||||
deleted <%= time_ago_in_words content.deleted_at %> ago
|
||||
</span>
|
||||
<span class="timestamp tooltipped" data-position="bottom" data-delay="500" data-tooltip="<%= content.deleted_at.strftime("%m/%d/%Y %H:%M") %>" style="font-size: 80%">
|
||||
<span class="timestamp tooltipped" data-position="bottom" data-delay="500" data-tooltip="Deleted at <%= content.deleted_at.strftime("%m/%d/%Y %H:%M %Z") %>" style="font-size: 80%">
|
||||
<i class="material-icons">alarm</i>
|
||||
recoverable for the next <%= distance_of_time_in_words(DateTime.current, content.deleted_at + 24.hours) %>
|
||||
recoverable for the next <%= distance_of_time_in_words(DateTime.current, content.deleted_at + @maximum_recovery_time) %>
|
||||
</span>
|
||||
</p>
|
||||
<span class="secondary-content">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user