Skip to content

Commit

Permalink
Merge pull request #933 from sebastianbarry/survey_refactor_expansion…
Browse files Browse the repository at this point in the history
…_ui-changes

Survey refactor expansion UI changes
  • Loading branch information
shankari authored Mar 18, 2023
2 parents 683da75 + 418370c commit e4b907a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
11 changes: 8 additions & 3 deletions www/css/main.diary.css
Original file line number Diff line number Diff line change
Expand Up @@ -494,19 +494,24 @@ 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;
align-items: center;
overflow: hidden;
font-size: 13px;
height: 40px;
}

.notes-list-entry .icon {
font-size: 24px;
}
}

/* the note's label will be left-aligned */
.notes-list-entry b {
text-align: left;
}
22 changes: 21 additions & 1 deletion www/js/survey/enketo/enketo-notes-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -41,6 +41,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);

Expand Down
4 changes: 4 additions & 0 deletions www/templates/survey/enketo/delete-entry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div style="color:#6e6e6e;">
<p style="font-weight: 700;color:#6e6e6e;margin: 0px;">Are you sure you wish to delete this entry?</p>
<p>{{currEntry.data.label}}<br />{{currEntry.displayTime || setDisplayTime(entry)}}</p>
</div>
2 changes: 1 addition & 1 deletion www/templates/survey/enketo/notes_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<li class="notes-list-entry" ng-repeat="entry in additionEntries | orderBy: 'data.start_ts'">
<b class="two-lines" ng-click="editEntry(entry)">{{entry.data.label}}</b>
<i ng-click="editEntry(entry)">{{entry.displayTime || setDisplayTime(entry)}}</i>
<i class="icon ion-trash-a" ng-click="deleteEntry(entry)"></i>
<i class="icon ion-trash-a" ng-click="confirmDeleteEntry(entry)"></i>
</li>
</ul>
</ion-item>
Expand Down

0 comments on commit e4b907a

Please sign in to comment.