mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-09 18:30:19 +00:00
Add the feature to delete all the photos from a travel diary and also remove all the references of photos inside the entry
This commit is contained in:
parent
c5edb835b6
commit
62e084efb3
@@ -10,11 +10,23 @@ class DeleteAllPhotosModal(DeleteYesConfirmationModal):
|
||||
def __init__(self,diary_id:int):
|
||||
super().__init__(diary_id)
|
||||
self.head_text.update("Are you sure you want to delete all photos from this diary?")
|
||||
self.delete_button.add_class("DeleteDiaryModal-DeleteButton")
|
||||
|
||||
|
||||
|
||||
@on(Button.Pressed, "#DeleteDiaryModal-DeleteButton")
|
||||
@on(Button.Pressed, ".DeleteDiaryModal-DeleteButton")
|
||||
def on_delete_button_pressed(self, event):
|
||||
|
||||
from pilgrim.ui.screens.diary_list_screen import DiaryListScreen
|
||||
|
||||
self.result = True
|
||||
self._delete_all_photo()
|
||||
self.dismiss()
|
||||
self.app.push_screen(DiaryListScreen())
|
||||
|
||||
def _delete_all_photo(self):
|
||||
diary = self.app.service_manager.get_travel_diary_service().read_by_id(self.diary_id)
|
||||
if self.app.service_manager.get_travel_diary_service().delete_all_photos(diary):
|
||||
self.notify("All photos deleted successfully")
|
||||
else:
|
||||
self.notify("Failed to delete all photos")
|
||||
Reference in New Issue
Block a user