Skip to content

Commit f286139

Browse files
authored
New enhancement to delete a section (#385)
1 parent 23148f3 commit f286139

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
8+
### Unreleased
99

1010
### Added
11+
- Added Trash button to delete section [#347](https://github.com/clowder-framework/clowder/issues/347)
1112
- Add "when" parameter in a few GET API endpoints to enable pagination [#266](https://github.com/clowder-framework/clowder/issues/266)
1213
- Extractors can now specify an extractor_key and an owner (email address) when sending a
1314
registration or heartbeat to Clowder that will restrict use of that extractor to them.

app/views/file.scala.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ <h4>Sections</h4>
483483
<th class="galleriaPosition">Position</th>
484484
<th class="galleriaDescr">Description</th>
485485
<th class="galleriaFindSimilar">Find</th>
486+
<th class="galleriaDelete">Delete</th>
486487
</tr>
487488
</thead>
488489
<tbody>
@@ -541,6 +542,9 @@ <h4>Sections</h4>
541542
}
542543
</td>
543544
<td class="galleriaFindSimilar"><a href="@routes.Search.callSearchMultimediaIndexView(s.id)">Similar</a></td>
545+
<td class="galleriaDelete">
546+
<button class="btn btn-link" title="Delete the section" onclick="removeSection('@s.id')"><span class="glyphicon glyphicon-trash"></span></button>
547+
</td>
544548
</tr>
545549
}
546550
</tbody>
@@ -1167,6 +1171,27 @@ <h4>Tags</h4>
11671171

11681172
return false;
11691173
}
1174+
1175+
function removeSection(sectionId) {
1176+
var request = window.jsRoutes.api.Sections.delete(sectionId).ajax({
1177+
type: 'DELETE'
1178+
});
1179+
1180+
request.done(function (response, textStatus, jqXHR) {
1181+
console.log("Response " + textStatus);
1182+
location.reload();
1183+
});
1184+
1185+
request.fail(function (jqXHR, textStatus, errorThrown){
1186+
console.error("The following error occurred: " + textStatus, errorThrown);
1187+
var errMsg = "You must be logged in to remove a section from a file.";
1188+
if (!checkErrorAndRedirect(jqXHR, errMsg)) {
1189+
notify("The section was not removed from the file due to : " + errorThrown, "error");
1190+
}
1191+
});
1192+
1193+
return false;
1194+
}
11701195
//The removeTag code is almost identical to the code in tags.scala.html. Should be unified.
11711196
function removeTag() {
11721197
var tagId = $(this).attr("id");

public/stylesheets/main.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,15 @@ table#sensorsListTable>thead>tr>th.headerSortDown {
760760
}
761761

762762
#scrollTableGalleria .galleriaDescr {
763-
width: 35%;
763+
width: 30%;
764764
}
765765

766766
#scrollTableGalleria .galleriaFindSimilar {
767-
width: 20%;
767+
width: 15%;
768+
}
769+
770+
#scrollTableGalleria .galleriaDelete {
771+
width: 10%;
768772
}
769773

770774
#scrollTableGalleria thead {

0 commit comments

Comments
 (0)