Allow project undeletion, fixes T51244
Projects can be undeleted within a month of deletion.
This commit is contained in:
@@ -182,11 +182,13 @@ $( document ).ready(function() {
|
||||
$('#item_delete').click(function(e){
|
||||
e.preventDefault();
|
||||
if (ProjectUtils.isProject()) {
|
||||
$.post(urlProjectDelete, {project_id: ProjectUtils.projectId()},
|
||||
function (data) {
|
||||
// Feedback logic
|
||||
}).done(function () {
|
||||
window.location.replace('/p/');
|
||||
$.post(urlProjectDelete, {project_id: ProjectUtils.projectId()})
|
||||
.done(function () {
|
||||
// Redirect to the /p/ URL that shows deleted projects.
|
||||
window.location.replace('/p/?deleted=1');
|
||||
})
|
||||
.fail(function(err) {
|
||||
toastr.error(xhrErrorResponseMessage(err), 'Project deletion failed');
|
||||
});
|
||||
} else {
|
||||
$.post(urlNodeDelete, {node_id: ProjectUtils.nodeId()},
|
||||
|
@@ -245,7 +245,13 @@
|
||||
box-shadow: 1px 1px 0 rgba(black, .1)
|
||||
display: flex
|
||||
margin: 10px 15px
|
||||
padding: 10px 0
|
||||
padding: 10px 10px
|
||||
|
||||
&.deleted
|
||||
background-color: $color-background-light
|
||||
|
||||
.title
|
||||
color: $color-text-dark-hint !important
|
||||
|
||||
&:hover
|
||||
cursor: pointer
|
||||
@@ -259,9 +265,9 @@
|
||||
.projects__list-details a.title
|
||||
color: $color-primary
|
||||
|
||||
a.projects__list-thumbnail
|
||||
.projects__list-thumbnail
|
||||
position: relative
|
||||
margin: 0 15px
|
||||
margin-right: 15px
|
||||
width: 50px
|
||||
height: 50px
|
||||
border-radius: 3px
|
||||
@@ -280,7 +286,7 @@
|
||||
display: flex
|
||||
flex-direction: column
|
||||
|
||||
a.title
|
||||
.title
|
||||
font-size: 1.2em
|
||||
padding-bottom: 2px
|
||||
color: $color-text-dark-primary
|
||||
|
@@ -18,6 +18,25 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
|
||||
| {{current_user.full_name}}
|
||||
| {% endblock %}
|
||||
|
||||
| {% block css %}
|
||||
| {{ super() }}
|
||||
style.
|
||||
.deleted-projects-toggle {
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
font-size: 20px;
|
||||
padding: 3px;
|
||||
text-shadow: 0 0 2px white;
|
||||
}
|
||||
.deleted-projects-toggle .show-deleted {
|
||||
color: #aaa;
|
||||
}
|
||||
.deleted-projects-toggle .hide-deleted {
|
||||
color: #bbb;
|
||||
}
|
||||
| {% endblock %}
|
||||
|
||||
| {% block body %}
|
||||
.dashboard-container
|
||||
section.dashboard-main
|
||||
@@ -54,7 +73,36 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
|
||||
| {% endif %}
|
||||
|
||||
nav.nav-tabs__tab.active#own_projects
|
||||
.deleted-projects-toggle
|
||||
| {% if show_deleted_projects %}
|
||||
a.hide-deleted(href="{{ request.base_url }}", title='Hide deleted projects')
|
||||
i.pi-trash
|
||||
| {% else %}
|
||||
a.show-deleted(href="{{ request.base_url }}?deleted=1", title='Show deleted projects')
|
||||
i.pi-trash
|
||||
| {% endif %}
|
||||
|
||||
ul.projects__list
|
||||
| {% for project in projects_deleted %}
|
||||
li.projects__list-item.deleted
|
||||
span.projects__list-thumbnail
|
||||
| {% if project.picture_square %}
|
||||
img(src="{{ project.picture_square.thumbnail('s', api=api) }}")
|
||||
| {% else %}
|
||||
i.pi-blender-cloud
|
||||
| {% endif %}
|
||||
.projects__list-details
|
||||
span.title {{ project.name }}
|
||||
ul.meta
|
||||
li.status.deleted Deleted
|
||||
li.edit
|
||||
a(href="javascript:undelete_project('{{ project._id }}')") Restore project
|
||||
| {% else %}
|
||||
| {% if show_deleted_projects %}
|
||||
li.projects__list-item.deleted You have no recenly deleted projects. Deleted projects can be restored within a month after deletion.
|
||||
| {% endif %}
|
||||
| {% endfor %}
|
||||
|
||||
| {% for project in projects_user %}
|
||||
li.projects__list-item(
|
||||
data-url="{{ url_for('projects.view', project_url=project.url) }}")
|
||||
@@ -105,7 +153,7 @@ meta(name="twitter:image", content="{{ url_for('static', filename='assets/img/ba
|
||||
| {% endif %}
|
||||
| {% endfor %}
|
||||
|
||||
section.nav-tabs__tab#shared
|
||||
section.nav-tabs__tab#shared(style='display: none')
|
||||
ul.projects__list
|
||||
| {% if projects_shared %}
|
||||
| {% for project in projects_shared %}
|
||||
@@ -278,4 +326,15 @@ script.
|
||||
|
||||
hopToTop(); // Display jump to top button
|
||||
});
|
||||
|
||||
function undelete_project(project_id) {
|
||||
console.log('undeleting project', project_id);
|
||||
$.post('{{ url_for('projects.undelete') }}', {project_id: project_id})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
location.href = jqXHR.getResponseHeader('Location');
|
||||
})
|
||||
.fail(function(err) {
|
||||
toastr.error(xhrErrorResponseMessage(err), 'Undeletion failed');
|
||||
})
|
||||
}
|
||||
| {% endblock %}
|
||||
|
@@ -222,7 +222,7 @@ link(href="{{ url_for('static_pillar', filename='assets/css/project-main.css', v
|
||||
li.button-delete
|
||||
a#item_delete(
|
||||
href="javascript:void(0);",
|
||||
title="Delete (Warning: no undo)",
|
||||
title="Can be undone within a month",
|
||||
data-toggle="tooltip",
|
||||
data-placement="left")
|
||||
i.pi-trash
|
||||
|
Reference in New Issue
Block a user