From 996915a6335e8d0b0fb44d5552381c0c15abb760 Mon Sep 17 00:00:00 2001 From: Sebastian Barry Date: Fri, 17 Mar 2023 11:03:06 -0600 Subject: [PATCH 1/2] RECOMMIT Left align enketo-notes-list labels Redoing this commit from a separate branch main.diary.css - Increased the left and right padding for .notes-list by 10px - Removed the place-items: center as it was overriding the left alignment - Added a new style called notes-list-label which aligns the text to the left place_list_item.html - Removed the in-element styling for diary cards because this is now handled with the css notes_list.html - The notes-list-label class is not being used by the notes-list label field to left align it --- www/css/main.diary.css | 7 +++++-- www/templates/diary/place_list_item.html | 2 +- www/templates/survey/enketo/notes_list.html | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/www/css/main.diary.css b/www/css/main.diary.css index 18d004582..c5d5375e2 100644 --- a/www/css/main.diary.css +++ b/www/css/main.diary.css @@ -494,14 +494,13 @@ enketo-notes-list, .notes-list { } .notes-list { - padding: 0 5px 5px 5px; + padding: 0 15px 5px 15px; text-align: center; } .notes-list-entry { display: grid; grid-template-columns: 10fr 9fr 1fr; - place-items: center; overflow: hidden; font-size: 13px; height: 40px; @@ -509,4 +508,8 @@ enketo-notes-list, .notes-list { .notes-list-entry .icon { font-size: 24px; +} + +.notes-list-label { + text-align: left; } \ No newline at end of file diff --git a/www/templates/diary/place_list_item.html b/www/templates/diary/place_list_item.html index 3a089e8e1..329076902 100644 --- a/www/templates/diary/place_list_item.html +++ b/www/templates/diary/place_list_item.html @@ -4,7 +4,7 @@
-
+
diff --git a/www/templates/survey/enketo/notes_list.html b/www/templates/survey/enketo/notes_list.html index d9580488c..a6b0c2b6c 100644 --- a/www/templates/survey/enketo/notes_list.html +++ b/www/templates/survey/enketo/notes_list.html @@ -2,7 +2,7 @@
  • - {{entry.data.label}} + {{entry.data.label}} {{entry.displayTime || setDisplayTime(entry)}}
  • From 688ed7dfb97d101667c8b43229ddd7fce866700d Mon Sep 17 00:00:00 2001 From: Sebastian Barry Date: Fri, 17 Mar 2023 16:13:04 -0600 Subject: [PATCH 2/2] Add delete entry confirm popup enketo-notes-list.js - Added $ionicPopup - Added a new confirmDeleteEntry which first confirms you wish to delete, then calls the deleteEntry function delete-entry.html - Contains the template for the confirm delete popup notes_list.html - changed the trash can button to call confirmDeleteEntry() instead of going directly to deleteEntry( --- www/js/survey/enketo/enketo-notes-list.js | 22 ++++++++++++++++++- www/templates/survey/enketo/delete-entry.html | 4 ++++ www/templates/survey/enketo/notes_list.html | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 www/templates/survey/enketo/delete-entry.html diff --git a/www/js/survey/enketo/enketo-notes-list.js b/www/js/survey/enketo/enketo-notes-list.js index def92467c..ab2dc63ff 100644 --- a/www/js/survey/enketo/enketo-notes-list.js +++ b/www/js/survey/enketo/enketo-notes-list.js @@ -19,7 +19,7 @@ angular.module('emission.survey.enketo.notes-list', }; }) - .controller("NotesListCtrl", function ($scope, $state, $element, $window, EnketoSurveyLaunch) { + .controller("NotesListCtrl", function ($scope, $state, $element, $window, EnketoSurveyLaunch, $ionicPopup) { console.log("Notes List Controller called"); const getScrollElement = function() { @@ -42,6 +42,26 @@ angular.module('emission.survey.enketo.notes-list', return entry.displayTime = begin + " - " + stop; } + $scope.confirmDeleteEntry = (entry) => { + $scope.currEntry = entry; + $ionicPopup.show({title: 'Delete entry', + templateUrl: `templates/survey/enketo/delete-entry.html`, + scope: $scope, + buttons: [{ + text: 'Delete', + type: 'button-cancel', + onTap: function(e) { + return $scope.deleteEntry(entry); + } + },{ + text: 'Cancel', + type: 'button-stable', + }] + }); + + return; + } + $scope.deleteEntry = (entry) => { console.log("Deleting entry", entry); diff --git a/www/templates/survey/enketo/delete-entry.html b/www/templates/survey/enketo/delete-entry.html new file mode 100644 index 000000000..8bf4d62ff --- /dev/null +++ b/www/templates/survey/enketo/delete-entry.html @@ -0,0 +1,4 @@ +
    +

    Are you sure you wish to delete this entry?

    +

    {{currEntry.data.label}}
    {{currEntry.displayTime || setDisplayTime(entry)}}

    +
    \ No newline at end of file diff --git a/www/templates/survey/enketo/notes_list.html b/www/templates/survey/enketo/notes_list.html index a6b0c2b6c..0ad0a103b 100644 --- a/www/templates/survey/enketo/notes_list.html +++ b/www/templates/survey/enketo/notes_list.html @@ -4,7 +4,7 @@
  • {{entry.data.label}} {{entry.displayTime || setDisplayTime(entry)}} - +