Skip to content

Commit 9fd09a8

Browse files
committed
Add delete user UI
This provides the UI for the delete user feature introduced in 4229084 Placing of the user delete button is not perfect, but can be moved to an own user tab later on. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent e31d204 commit 9fd09a8

3 files changed

Lines changed: 44 additions & 16 deletions

File tree

locales/en.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,8 @@
107107
"Night Theme": "Night Theme",
108108
"Follow us on %s and %s.": "Follow us on %s, and %s.",
109109
"Privacy": "Privacy",
110-
"Terms of Use": "Terms of Use"
111-
}
110+
"Terms of Use": "Terms of Use",
111+
"Do you really want to delete your user account?": "Do you really want to delete your user account?",
112+
"This will delete your account, all notes that are owned by you and remove all references to your account from other notes.": "This will delete your account, all notes that are owned by you and remove all references to your account from other notes.",
113+
"Delete user": "Delete user"
114+
}

public/js/cover.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const options = {
3939
'<a href="#">' +
4040
'<div class="item">' +
4141
'<div class="ui-history-pin fa fa-thumb-tack fa-fw"></div>' +
42-
'<div class="ui-history-close fa fa-close fa-fw" data-toggle="modal" data-target=".delete-modal"></div>' +
42+
'<div class="ui-history-close fa fa-close fa-fw" data-toggle="modal" data-target=".delete-history-modal"></div>' +
4343
'<div class="content">' +
4444
'<h4 class="text"></h4>' +
4545
'<p>' +
@@ -208,8 +208,8 @@ function historyCloseClick (e) {
208208
e.preventDefault()
209209
const id = $(this).closest('a').siblings('span').html()
210210
const value = historyList.get('id', id)[0]._values
211-
$('.ui-delete-modal-msg').text('Do you really want to delete below history?')
212-
$('.ui-delete-modal-item').html(`<i class="fa fa-file-text"></i> ${value.text}<br><i class="fa fa-clock-o"></i> ${value.time}`)
211+
$('.ui-delete-history-modal-msg').text('Do you really want to delete below history?')
212+
$('.ui-delete-history-modal-item').html(`<i class="fa fa-file-text"></i> ${value.text}<br><i class="fa fa-clock-o"></i> ${value.time}`)
213213
clearHistory = false
214214
deleteId = id
215215
}
@@ -277,7 +277,7 @@ function deleteHistory () {
277277
checkHistoryList()
278278
}
279279
}
280-
$('.delete-modal').modal('hide')
280+
$('.delete-history-modal').modal('hide')
281281
deleteId = null
282282
clearHistory = false
283283
})
@@ -297,12 +297,12 @@ function deleteHistory () {
297297
deleteId = null
298298
})
299299
}
300-
$('.delete-modal').modal('hide')
300+
$('.delete-history-modal').modal('hide')
301301
clearHistory = false
302302
})
303303
}
304304

305-
$('.ui-delete-modal-confirm').click(() => {
305+
$('.ui-delete-history-modal-confirm').click(() => {
306306
deleteHistory()
307307
})
308308

@@ -342,8 +342,8 @@ $('.ui-open-history').bind('change', e => {
342342
})
343343

344344
$('.ui-clear-history').click(() => {
345-
$('.ui-delete-modal-msg').text('Do you really want to clear all history?')
346-
$('.ui-delete-modal-item').html('There is no turning back.')
345+
$('.ui-delete-history-modal-msg').text('Do you really want to clear all history?')
346+
$('.ui-delete-history-modal-item').html('There is no turning back.')
347347
clearHistory = true
348348
deleteId = null
349349
})
@@ -371,6 +371,10 @@ $('.ui-refresh-history').click(() => {
371371
})
372372
})
373373

374+
$('.ui-delete-user-modal-cancel').click(() => {
375+
$('.ui-delete-user').parent().removeClass('active')
376+
})
377+
374378
$('.ui-logout').click(() => {
375379
clearLoginState()
376380
location.href = `${serverurl}/logout`

public/views/index/body.ejs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</button>
2828
<ul class="dropdown-menu" aria-labelledby="profileLabel">
2929
<li><a href="<%- url %>/features"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('Features') %></a></li>
30+
<li><a class="ui-delete-user" data-toggle="modal" data-target=".delete-user-modal"><i class="fa fa-trash fa-fw"></i> <%= __('Delete user') %></a></li>
3031
<li><a href="<%- url %>/logout"><i class="fa fa-sign-out fa-fw"></i> <%= __('Sign Out') %></a></li>
3132
</ul>
3233
</span>
@@ -108,7 +109,7 @@
108109
<span class="btn btn-default btn-file ui-open-history" title="<%= __('Import history') %>">
109110
<i class="fa fa-folder-open-o"></i><input type="file" />
110111
</span>
111-
<a href="#" class="btn btn-default ui-clear-history" title="<%= __('Clear history') %>" data-toggle="modal" data-target=".delete-modal"><i class="fa fa-trash-o"></i></a>
112+
<a href="#" class="btn btn-default ui-clear-history" title="<%= __('Clear history') %>" data-toggle="modal" data-target=".delete-history-modal"><i class="fa fa-trash-o"></i></a>
112113
</span>
113114
<a href="#" class="btn btn-default ui-refresh-history" title="<%= __('Refresh history') %>"><i class="fa fa-refresh"></i></a>
114115
</form>
@@ -157,8 +158,8 @@
157158
</div>
158159
</div>
159160
</div>
160-
<!-- delete modal -->
161-
<div class="modal fade delete-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
161+
<!-- delete history modal -->
162+
<div class="modal fade delete-history-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
162163
<div class="modal-dialog modal-sm">
163164
<div class="modal-content">
164165
<div class="modal-header">
@@ -167,12 +168,32 @@
167168
<h4 class="modal-title" id="myModalLabel"><%= __('Are you sure?') %></h4>
168169
</div>
169170
<div class="modal-body" style="color:black;">
170-
<h5 class="ui-delete-modal-msg"></h5>
171-
<strong class="ui-delete-modal-item"></strong>
171+
<h5 class="ui-delete-history-modal-msg"></h5>
172+
<strong class="ui-delete-history-modal-item"></strong>
172173
</div>
173174
<div class="modal-footer">
174175
<button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button>
175-
<button type="button" class="btn btn-danger ui-delete-modal-confirm"><%= __('Yes, do it!') %></button>
176+
<button type="button" class="btn btn-danger ui-delete-history-modal-confirm"><%= __('Yes, do it!') %></button>
177+
</div>
178+
</div>
179+
</div>
180+
</div>
181+
<!-- delete user modal -->
182+
<div class="modal fade delete-user-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
183+
<div class="modal-dialog modal-sm">
184+
<div class="modal-content">
185+
<div class="modal-header">
186+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
187+
</button>
188+
<h4 class="modal-title" id="myModalLabel"><%= __('Are you sure?') %></h4>
189+
</div>
190+
<div class="modal-body" style="color:black;">
191+
<h5 class="ui-delete-user-modal-msg"><%= __('Do you really want to delete your user account?') %></h5>
192+
<strong class="ui-delete-user-modal-item"><%= __('This will delete your account, all notes that are owned by you and remove all references to your account from other notes.') %></strong>
193+
</div>
194+
<div class="modal-footer">
195+
<button type="button" class="btn btn-default ui-delete-user-modal-cancel" data-dismiss="modal"><%= __('Cancel') %></button>
196+
<a type="button" class="btn btn-danger" href="<%- url %>/me/delete"><%= __('Yes, do it!') %></a>
176197
</div>
177198
</div>
178199
</div>

0 commit comments

Comments
 (0)