hoodcms 5.0.14 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/login.css +1 -1
- package/dist/js/admin/ContentController.d.ts +30 -0
- package/dist/js/admin/ContentController.js +188 -0
- package/dist/js/admin/ContentTypeController.d.ts +15 -0
- package/dist/js/admin/ContentTypeController.js +140 -0
- package/dist/js/admin/HomeController.d.ts +17 -0
- package/dist/js/admin/HomeController.js +111 -0
- package/dist/js/admin/LogsController.d.ts +6 -0
- package/dist/js/admin/LogsController.js +14 -0
- package/dist/js/admin/MediaController.d.ts +7 -0
- package/dist/js/admin/MediaController.js +29 -0
- package/dist/js/admin/PropertyController.d.ts +18 -0
- package/dist/js/admin/PropertyController.js +118 -0
- package/dist/js/admin/PropertyImporter.d.ts +31 -0
- package/dist/js/admin/PropertyImporter.js +95 -0
- package/dist/js/admin/ThemesController.d.ts +8 -0
- package/dist/js/admin/ThemesController.js +37 -0
- package/dist/js/admin/UsersController.d.ts +17 -0
- package/dist/js/admin/UsersController.js +176 -0
- package/dist/js/admin.js +23 -5
- package/dist/js/app/PropertyService.d.ts +46 -0
- package/{src/ts/app/PropertyController.ts → dist/js/app/PropertyService.js} +44 -76
- package/dist/js/app.js +23 -5
- package/dist/js/app.property.js +24 -0
- package/dist/js/core/DataList.js +25 -3
- package/dist/js/core/HoodApi.d.ts +17 -7
- package/dist/js/core/HoodApi.js +71 -10
- package/dist/js/core/Validator.js +1 -1
- package/dist/js/index.d.ts +10 -1
- package/dist/js/index.js +12 -1
- package/dist/js/login.js +1 -1
- package/images/hood-small.png +0 -0
- package/images/hood.png +0 -0
- package/package.json +108 -108
- package/src/css/admin.css +0 -3
- package/src/css/admin.css.map +1 -1
- package/src/css/app.css +0 -3
- package/src/css/app.css.map +1 -1
- package/src/css/login.css +165 -0
- package/src/css/login.css.map +1 -1
- package/src/html/auth0/login.html +100 -0
- package/src/html/auth0/passwordless-email.html +184 -0
- package/src/js/admin.js +43455 -1820
- package/src/js/admin.js.map +1 -1
- package/src/js/app.js +41910 -906
- package/src/js/app.js.map +1 -1
- package/src/js/app.property.js +1169 -0
- package/src/js/app.property.js.map +1 -0
- package/src/js/login.js +1 -1
- package/src/scss/core/_images.scss +48 -48
- package/src/scss/login.scss +1 -0
- package/src/ts/admin.ts +3 -0
- package/src/ts/app/PropertyService.ts +202 -0
- package/src/ts/app.property.ts +20 -0
- package/src/ts/app.ts +3 -81
- package/src/ts/core/DataList.ts +27 -4
- package/src/ts/core/HoodApi.ts +96 -14
- package/src/ts/core/Validator.ts +1 -1
- package/src/ts/index.ts +14 -1
- package/temp.txt +1 -0
- package/dist/js/core/BaseSite.d.ts +0 -6
- package/dist/js/core/BaseSite.js +0 -14
- package/src/ts/core/BaseSite.ts +0 -21
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Alerts } from "../core/Alerts";
|
|
2
|
+
import { DataList } from "../core/DataList";
|
|
3
|
+
import { Inline } from "../core/Inline";
|
|
4
|
+
import { ModalController } from "../core/Modal";
|
|
5
|
+
import { Response } from "../core/Response";
|
|
6
|
+
import { Validator } from "../core/Validator";
|
|
7
|
+
export class PropertyController {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.manage();
|
|
10
|
+
$('body').on('click', '.property-create', this.create.bind(this));
|
|
11
|
+
$('body').on('click', '.property-delete', this.delete.bind(this));
|
|
12
|
+
$('body').on('click', '.property-set-status', this.setStatus.bind(this));
|
|
13
|
+
$('body').on('click', '.property-media-delete', this.removeMedia.bind(this));
|
|
14
|
+
$('body').on('click', '.property-floorplan-delete', this.removeMedia.bind(this));
|
|
15
|
+
$('body').on('keyup', '#Slug', function () {
|
|
16
|
+
let slugValue = $(this).val();
|
|
17
|
+
$('.slug-display').html(slugValue);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
manage() {
|
|
21
|
+
this.element = document.getElementById('property-list');
|
|
22
|
+
if (this.element) {
|
|
23
|
+
this.list = new DataList(this.element, {
|
|
24
|
+
onComplete: function (data, sender = null) {
|
|
25
|
+
Alerts.log('Finished loading property list.', 'info');
|
|
26
|
+
}.bind(this)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
create(e) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
let createPropertyModal = new ModalController({
|
|
34
|
+
onComplete: function () {
|
|
35
|
+
let form = document.getElementById('property-create-form');
|
|
36
|
+
new Validator(form, {
|
|
37
|
+
onComplete: function (response) {
|
|
38
|
+
Response.process(response, 5000);
|
|
39
|
+
if (this.list) {
|
|
40
|
+
this.list.reload();
|
|
41
|
+
}
|
|
42
|
+
if (response.success) {
|
|
43
|
+
createPropertyModal.close();
|
|
44
|
+
}
|
|
45
|
+
}.bind(this)
|
|
46
|
+
});
|
|
47
|
+
}.bind(this)
|
|
48
|
+
});
|
|
49
|
+
createPropertyModal.show($(e.currentTarget).attr('href'), this.element);
|
|
50
|
+
}
|
|
51
|
+
delete(e) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
Alerts.confirm({
|
|
55
|
+
// Confirm options...
|
|
56
|
+
title: "Are you sure?",
|
|
57
|
+
html: "The property will be permanently removed."
|
|
58
|
+
}, function (result) {
|
|
59
|
+
if (result.isConfirmed) {
|
|
60
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
61
|
+
Response.process(data, 5000);
|
|
62
|
+
if (this.list) {
|
|
63
|
+
this.list.reload();
|
|
64
|
+
}
|
|
65
|
+
if (e.currentTarget.dataset.redirect) {
|
|
66
|
+
Alerts.message('Just taking you back to the property list.', 'Redirecting...');
|
|
67
|
+
setTimeout(function () {
|
|
68
|
+
window.location = e.currentTarget.dataset.redirect;
|
|
69
|
+
}, 1500);
|
|
70
|
+
}
|
|
71
|
+
}.bind(this));
|
|
72
|
+
}
|
|
73
|
+
}.bind(this));
|
|
74
|
+
}
|
|
75
|
+
setStatus(e) {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
Alerts.confirm({
|
|
79
|
+
// Confirm options...
|
|
80
|
+
title: "Are you sure?",
|
|
81
|
+
html: "The change will happen immediately."
|
|
82
|
+
}, function (result) {
|
|
83
|
+
if (result.isConfirmed) {
|
|
84
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
85
|
+
Response.process(data, 5000);
|
|
86
|
+
if (this.list) {
|
|
87
|
+
this.list.reload();
|
|
88
|
+
}
|
|
89
|
+
}.bind(this));
|
|
90
|
+
}
|
|
91
|
+
}.bind(this));
|
|
92
|
+
}
|
|
93
|
+
removeMedia(e) {
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
Alerts.confirm({
|
|
97
|
+
// Confirm options...
|
|
98
|
+
title: "Are you sure?",
|
|
99
|
+
html: "The media will be removed from the property, but will still be in the media collection."
|
|
100
|
+
}, function (result) {
|
|
101
|
+
if (result.isConfirmed) {
|
|
102
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
103
|
+
Response.process(data, 5000);
|
|
104
|
+
// reload the property media gallery, should be attached to #property-gallery-list
|
|
105
|
+
let mediaGalleryEl = document.getElementById('property-gallery-list');
|
|
106
|
+
if (mediaGalleryEl.hoodDataList) {
|
|
107
|
+
mediaGalleryEl.hoodDataList.reload();
|
|
108
|
+
}
|
|
109
|
+
// reload the property media gallery, should be attached to #property-gallery-list
|
|
110
|
+
let mfpGalleryEl = document.getElementById('property-floorplan-list');
|
|
111
|
+
if (mfpGalleryEl && mfpGalleryEl.hoodDataList) {
|
|
112
|
+
mfpGalleryEl.hoodDataList.reload();
|
|
113
|
+
}
|
|
114
|
+
}.bind(this));
|
|
115
|
+
}
|
|
116
|
+
}.bind(this));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare interface PropertyImporterResult {
|
|
2
|
+
ftp: FTPImporterStatistics;
|
|
3
|
+
importer: PropertyImporterStatistics;
|
|
4
|
+
}
|
|
5
|
+
export declare interface FTPImporterStatistics {
|
|
6
|
+
bytesTransferred: number;
|
|
7
|
+
complete: number;
|
|
8
|
+
statusMessage: string;
|
|
9
|
+
}
|
|
10
|
+
export declare interface PropertyImporterStatistics {
|
|
11
|
+
running: boolean;
|
|
12
|
+
processed: number;
|
|
13
|
+
statusMessage: string;
|
|
14
|
+
toAdd: number;
|
|
15
|
+
toDelete: number;
|
|
16
|
+
toUpdate: number;
|
|
17
|
+
total: number;
|
|
18
|
+
added: number;
|
|
19
|
+
deleted: number;
|
|
20
|
+
updated: number;
|
|
21
|
+
complete: number;
|
|
22
|
+
errors: string[];
|
|
23
|
+
warnings: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare class PropertyImporter {
|
|
26
|
+
updateInterval: number;
|
|
27
|
+
constructor();
|
|
28
|
+
update(): void;
|
|
29
|
+
hideInfo(): void;
|
|
30
|
+
showInfo(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Inline } from "../core/Inline";
|
|
2
|
+
export class PropertyImporter {
|
|
3
|
+
constructor() {
|
|
4
|
+
if ($('#import-property-start').length > 0) {
|
|
5
|
+
this.update();
|
|
6
|
+
$('#import-property-start').click(function () {
|
|
7
|
+
$.ajax({
|
|
8
|
+
url: $('#import-property-start').data('url'),
|
|
9
|
+
type: "POST",
|
|
10
|
+
error: Inline.handleError,
|
|
11
|
+
success: function () {
|
|
12
|
+
this.update();
|
|
13
|
+
}.bind(this)
|
|
14
|
+
});
|
|
15
|
+
}.bind(this));
|
|
16
|
+
$('#import-property-cancel').click(function () {
|
|
17
|
+
$.ajax({
|
|
18
|
+
url: $('#import-property-cancel').data('url'),
|
|
19
|
+
type: "POST",
|
|
20
|
+
error: Inline.handleError,
|
|
21
|
+
success: function () {
|
|
22
|
+
this.update();
|
|
23
|
+
}.bind(this)
|
|
24
|
+
});
|
|
25
|
+
}.bind(this));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
update() {
|
|
29
|
+
$.ajax({
|
|
30
|
+
url: $('#import-property-status').data('url'),
|
|
31
|
+
type: "POST",
|
|
32
|
+
error: Inline.handleError,
|
|
33
|
+
success: function (result) {
|
|
34
|
+
if (result.importer.running) {
|
|
35
|
+
this.showInfo();
|
|
36
|
+
clearInterval(this.updateInterval);
|
|
37
|
+
this.updateInterval = window.setTimeout(this.update, 250);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
clearInterval(this.updateInterval);
|
|
41
|
+
this.hideInfo();
|
|
42
|
+
}
|
|
43
|
+
$('.tp').html(result.importer.total.toString());
|
|
44
|
+
$('#pu').html(result.importer.updated.toString());
|
|
45
|
+
$('#pa').html(result.importer.added.toString());
|
|
46
|
+
$('#pp').html(result.importer.processed.toString());
|
|
47
|
+
$('#pd').html(result.importer.deleted.toString());
|
|
48
|
+
$('#ToAdd').html(result.importer.toAdd.toString());
|
|
49
|
+
$('#ToUpdate').html(result.importer.toUpdate.toString());
|
|
50
|
+
$('#ToDelete').html(result.importer.toDelete.toString());
|
|
51
|
+
$('#pt').html(result.importer.statusMessage.toString());
|
|
52
|
+
let ftpPercentComplete = Math.round(result.ftp.complete * 100) / 100;
|
|
53
|
+
$('#fp').html(ftpPercentComplete.toString());
|
|
54
|
+
$('#ft').html(result.ftp.statusMessage);
|
|
55
|
+
let percentComplete = Math.round(result.importer.complete * 100) / 100;
|
|
56
|
+
$('.pc').html(percentComplete.toString());
|
|
57
|
+
$('#progressbar').css({
|
|
58
|
+
width: result.importer.complete + "%"
|
|
59
|
+
});
|
|
60
|
+
if (result.importer.errors.length) {
|
|
61
|
+
let errorHtml = "";
|
|
62
|
+
for (let i = result.importer.errors.length - 1; i >= 0; i--) {
|
|
63
|
+
errorHtml += '<div class="text-danger">' + result.importer.errors[i] + '</div>';
|
|
64
|
+
}
|
|
65
|
+
$('#import-property-errors').html(errorHtml);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
$('#import-property-errors').html("<div>No errors reported.</div>");
|
|
69
|
+
}
|
|
70
|
+
if (result.importer.warnings.length) {
|
|
71
|
+
let warningHtml = "";
|
|
72
|
+
for (let j = result.importer.warnings.length - 1; j >= 0; j--) {
|
|
73
|
+
warningHtml += '<div class="text-warning">' + result.importer.warnings[j] + '</div>';
|
|
74
|
+
}
|
|
75
|
+
$('#import-property-warnings').html(warningHtml);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
$('#import-property-warnings').html("<div>No warnings reported.</div>");
|
|
79
|
+
}
|
|
80
|
+
}.bind(this)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
hideInfo() {
|
|
84
|
+
$('#import-property-start').removeAttr('disabled');
|
|
85
|
+
$('#import-property-cancel').attr('disabled', 'disabled');
|
|
86
|
+
$('#import-property-progress').removeClass('d-block');
|
|
87
|
+
$('#import-property-progress').addClass('d-none');
|
|
88
|
+
}
|
|
89
|
+
showInfo() {
|
|
90
|
+
$('#import-property-cancel').removeAttr('disabled');
|
|
91
|
+
$('#import-property-start').attr('disabled', 'disabled');
|
|
92
|
+
$('#import-property-progress').addClass('d-block');
|
|
93
|
+
$('#import-property-progress').removeClass('d-none');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Alerts } from "../core/Alerts";
|
|
2
|
+
import { DataList } from "../core/DataList";
|
|
3
|
+
import { Inline } from "../core/Inline";
|
|
4
|
+
import { Response } from "../core/Response";
|
|
5
|
+
export class ThemesController {
|
|
6
|
+
constructor() {
|
|
7
|
+
$('body').on('click', '.activate-theme', this.activate.bind(this));
|
|
8
|
+
this.element = document.getElementById('themes-list');
|
|
9
|
+
if (this.element) {
|
|
10
|
+
this.list = new DataList(this.element, {
|
|
11
|
+
onComplete: function (data, sender = null) {
|
|
12
|
+
Alerts.log('Finished loading users list.', 'info');
|
|
13
|
+
}.bind(this)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
activate(e) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
Alerts.confirm({
|
|
21
|
+
// Confirm options...
|
|
22
|
+
title: "Are you sure?",
|
|
23
|
+
html: "The site will change themes, and the selected theme will be live right away."
|
|
24
|
+
}, function (result) {
|
|
25
|
+
if (result.isConfirmed) {
|
|
26
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
27
|
+
Response.process(data, 5000);
|
|
28
|
+
setTimeout(function () {
|
|
29
|
+
if (this.list) {
|
|
30
|
+
this.list.reload();
|
|
31
|
+
}
|
|
32
|
+
}.bind(this), 2000);
|
|
33
|
+
}.bind(this));
|
|
34
|
+
}
|
|
35
|
+
}.bind(this));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="jquery" />
|
|
2
|
+
import { DataList } from "../core/DataList";
|
|
3
|
+
export declare class UsersController {
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
list: DataList;
|
|
6
|
+
constructor();
|
|
7
|
+
initLists(this: UsersController): void;
|
|
8
|
+
create(this: UsersController, e: JQuery.ClickEvent): void;
|
|
9
|
+
delete(this: UsersController, e: JQuery.ClickEvent): void;
|
|
10
|
+
generatePassword(): void;
|
|
11
|
+
toggleUserRole(): void;
|
|
12
|
+
resetPassword(this: UsersController, e: JQuery.ClickEvent): void;
|
|
13
|
+
notesEl: HTMLElement;
|
|
14
|
+
notesList: DataList;
|
|
15
|
+
addNote(this: UsersController, e: JQuery.ClickEvent): void;
|
|
16
|
+
deleteNote(this: UsersController, e: JQuery.ClickEvent): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import swal from 'sweetalert2';
|
|
2
|
+
import { Alerts } from "../core/Alerts";
|
|
3
|
+
import { Inline } from "../core/Inline";
|
|
4
|
+
import { DataList } from "../core/DataList";
|
|
5
|
+
import { RandomStringGenerator } from "../core/RandomStringGenerator";
|
|
6
|
+
import { Response } from "../core/Response";
|
|
7
|
+
import { ModalController } from "../core/Modal";
|
|
8
|
+
import { Validator } from "../core/Validator";
|
|
9
|
+
export class UsersController {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.initLists();
|
|
12
|
+
$('body').on('click', '.user-create', this.create.bind(this));
|
|
13
|
+
$('body').on('click', '.user-delete', this.delete.bind(this));
|
|
14
|
+
$('body').on('change', '#user-create-form #GeneratePassword', this.generatePassword);
|
|
15
|
+
$('body').on('change', '.user-role-check', this.toggleUserRole);
|
|
16
|
+
$('body').on('click', '.user-reset-password', this.resetPassword);
|
|
17
|
+
$('body').on('click', '.user-notes-add', this.addNote.bind(this));
|
|
18
|
+
$('body').on('click', '.user-notes-delete', this.deleteNote.bind(this));
|
|
19
|
+
}
|
|
20
|
+
initLists() {
|
|
21
|
+
this.element = document.getElementById('user-list');
|
|
22
|
+
if (this.element) {
|
|
23
|
+
this.list = new DataList(this.element, {
|
|
24
|
+
onComplete: function (data, sender = null) {
|
|
25
|
+
Alerts.log('Finished loading users list.', 'info');
|
|
26
|
+
}.bind(this)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
this.notesEl = document.getElementById('user-notes');
|
|
30
|
+
if (this.notesEl) {
|
|
31
|
+
this.notesList = new DataList(this.notesEl, {
|
|
32
|
+
onComplete: function (data, sender = null) {
|
|
33
|
+
Alerts.log('Finished loading user notes list.', 'info');
|
|
34
|
+
}.bind(this)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
create(e) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
let createUserModal = new ModalController({
|
|
42
|
+
onComplete: function () {
|
|
43
|
+
let form = document.getElementById('user-create-form');
|
|
44
|
+
new Validator(form, {
|
|
45
|
+
onComplete: function (response) {
|
|
46
|
+
Response.process(response, 5000);
|
|
47
|
+
if (this.list) {
|
|
48
|
+
this.list.reload();
|
|
49
|
+
}
|
|
50
|
+
if (response.success) {
|
|
51
|
+
createUserModal.close();
|
|
52
|
+
}
|
|
53
|
+
}.bind(this)
|
|
54
|
+
});
|
|
55
|
+
}.bind(this)
|
|
56
|
+
});
|
|
57
|
+
createUserModal.show($(e.currentTarget).attr('href'), this.element);
|
|
58
|
+
}
|
|
59
|
+
delete(e) {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
Alerts.confirm({
|
|
63
|
+
// Confirm options...
|
|
64
|
+
title: "Are you sure?",
|
|
65
|
+
html: "The user will be permanently removed."
|
|
66
|
+
}, function (result) {
|
|
67
|
+
if (result.isConfirmed) {
|
|
68
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
69
|
+
Response.process(data, 5000);
|
|
70
|
+
if (this.list) {
|
|
71
|
+
this.list.reload();
|
|
72
|
+
}
|
|
73
|
+
if (e.currentTarget.dataset.redirect) {
|
|
74
|
+
Alerts.message('Just taking you back to the content list.', 'Redirecting...');
|
|
75
|
+
setTimeout(function () {
|
|
76
|
+
window.location = e.currentTarget.dataset.redirect;
|
|
77
|
+
}, 1500);
|
|
78
|
+
}
|
|
79
|
+
}.bind(this));
|
|
80
|
+
}
|
|
81
|
+
}.bind(this));
|
|
82
|
+
}
|
|
83
|
+
generatePassword() {
|
|
84
|
+
if ($(this).is(':checked')) {
|
|
85
|
+
let generator = new RandomStringGenerator({ numSpecial: 1 });
|
|
86
|
+
$('#user-create-form #Password').val(generator.generate(8));
|
|
87
|
+
$('#user-create-form #Password').attr('type', 'text');
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
$('#user-create-form #Password').val('');
|
|
91
|
+
$('#user-create-form #Password').attr('type', 'password');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
toggleUserRole() {
|
|
95
|
+
if ($(this).is(':checked')) {
|
|
96
|
+
$.post($(this).data('url'), { role: $(this).val(), add: true }, function (data) {
|
|
97
|
+
Response.process(data);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
$.post($(this).data('url'), { role: $(this).val(), add: false }, function (data) {
|
|
102
|
+
Response.process(data);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
resetPassword(e) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
Alerts.prompt({
|
|
110
|
+
// Confirm options...
|
|
111
|
+
title: "Reset Password",
|
|
112
|
+
html: "Please enter a new password for the user...",
|
|
113
|
+
preConfirm: (inputValue) => {
|
|
114
|
+
if (inputValue === false)
|
|
115
|
+
return false;
|
|
116
|
+
if (inputValue === "") {
|
|
117
|
+
swal.showValidationMessage("You didn't supply a new password, we can't reset the password without it!");
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, function (result) {
|
|
122
|
+
if (result.isDismissed) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
$.post(e.currentTarget.href, { password: result.value }, function (data) {
|
|
126
|
+
Response.process(data, 5000);
|
|
127
|
+
});
|
|
128
|
+
}.bind(this));
|
|
129
|
+
}
|
|
130
|
+
addNote(e) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
Alerts.prompt({
|
|
134
|
+
// Confirm options...
|
|
135
|
+
title: "Add a note",
|
|
136
|
+
html: "Enter and store a note about this user.",
|
|
137
|
+
input: 'textarea',
|
|
138
|
+
preConfirm: (inputValue) => {
|
|
139
|
+
if (inputValue === false)
|
|
140
|
+
return false;
|
|
141
|
+
if (inputValue === "") {
|
|
142
|
+
swal.showValidationMessage("You didn't enter a note!");
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}, function (result) {
|
|
147
|
+
if (result.isDismissed) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
$.post(e.currentTarget.href, { note: result.value }, function (data) {
|
|
151
|
+
Response.process(data, 5000);
|
|
152
|
+
if (this.notesList) {
|
|
153
|
+
this.notesList.reload();
|
|
154
|
+
}
|
|
155
|
+
}.bind(this));
|
|
156
|
+
}.bind(this));
|
|
157
|
+
}
|
|
158
|
+
deleteNote(e) {
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
e.stopPropagation();
|
|
161
|
+
Alerts.confirm({
|
|
162
|
+
// Confirm options...
|
|
163
|
+
title: "Are you sure?",
|
|
164
|
+
html: "The note will be permanently removed."
|
|
165
|
+
}, function (result) {
|
|
166
|
+
if (result.isConfirmed) {
|
|
167
|
+
Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
|
|
168
|
+
Response.process(data, 5000);
|
|
169
|
+
if (this.notesList) {
|
|
170
|
+
this.notesList.reload();
|
|
171
|
+
}
|
|
172
|
+
}.bind(this));
|
|
173
|
+
}
|
|
174
|
+
}.bind(this));
|
|
175
|
+
}
|
|
176
|
+
}
|