hoodcms 6.0.0 → 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.
Files changed (39) hide show
  1. package/dist/js/admin/ContentController.d.ts +30 -0
  2. package/dist/js/admin/ContentController.js +188 -0
  3. package/dist/js/admin/ContentTypeController.d.ts +15 -0
  4. package/dist/js/admin/ContentTypeController.js +140 -0
  5. package/dist/js/admin/HomeController.d.ts +17 -0
  6. package/dist/js/admin/HomeController.js +111 -0
  7. package/dist/js/admin/LogsController.d.ts +6 -0
  8. package/dist/js/admin/LogsController.js +14 -0
  9. package/dist/js/admin/MediaController.d.ts +7 -0
  10. package/dist/js/admin/MediaController.js +29 -0
  11. package/dist/js/admin/PropertyController.d.ts +18 -0
  12. package/dist/js/admin/PropertyController.js +118 -0
  13. package/dist/js/admin/PropertyImporter.d.ts +31 -0
  14. package/dist/js/admin/PropertyImporter.js +95 -0
  15. package/dist/js/admin/ThemesController.d.ts +8 -0
  16. package/dist/js/admin/ThemesController.js +37 -0
  17. package/dist/js/admin/UsersController.d.ts +17 -0
  18. package/dist/js/admin/UsersController.js +176 -0
  19. package/dist/js/admin.js +4 -4
  20. package/dist/js/app/PropertyService.d.ts +46 -0
  21. package/{src/ts/app/PropertyController.ts → dist/js/app/PropertyService.js} +44 -76
  22. package/dist/js/app.js +16 -4
  23. package/dist/js/app.property.js +5 -5
  24. package/dist/js/core/DataList.js +25 -3
  25. package/dist/js/index.d.ts +10 -0
  26. package/dist/js/index.js +12 -0
  27. package/dist/js/login.js +1 -1
  28. package/package.json +7 -7
  29. package/src/js/admin.js +491 -469
  30. package/src/js/admin.js.map +1 -1
  31. package/src/js/app.js +11546 -5
  32. package/src/js/app.js.map +1 -1
  33. package/src/js/app.property.js +175 -129
  34. package/src/js/app.property.js.map +1 -1
  35. package/src/js/login.js +1 -1
  36. package/src/ts/app/PropertyService.ts +202 -0
  37. package/src/ts/app.property.ts +4 -5
  38. package/src/ts/core/DataList.ts +27 -4
  39. package/src/ts/index.ts +14 -0
package/src/js/admin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * hoodcms v6.0.0
2
+ * hoodcms v6.0.1
3
3
  * A fully customisable content management system built in ASP.NET Core 5 & Bootstrap 5.
4
4
  * Written by George Whysall, 2022
5
5
  * Released under the GPL-3.0 License.
@@ -424,9 +424,31 @@
424
424
  }
425
425
  this.options = __assign(__assign({}, this.options), options);
426
426
  if ($(this.element).hasClass('query')) {
427
- var pageUrl = $(this.element).data('url') + window.location.search;
428
- $(this.element).attr('data-url', pageUrl);
429
- $(this.element).data('url', pageUrl);
427
+ var r = new RegExp('^(?:[a-z]+:)?//', 'i');
428
+ var pageUrl = null;
429
+ if (r.test(this.element.dataset.url)) {
430
+ pageUrl = new URL(this.element.dataset.url);
431
+ }
432
+ else {
433
+ pageUrl = new URL(window.location.origin + this.element.dataset.url);
434
+ }
435
+ if ('URLSearchParams' in window) {
436
+ var searchParams = new URLSearchParams(window.location.search);
437
+ var urlParams = new URLSearchParams(pageUrl.search);
438
+ searchParams.forEach(function (value, key, parent) {
439
+ urlParams.set(key, value);
440
+ });
441
+ if (urlParams.get("page") == "0") {
442
+ urlParams.set("page", "1");
443
+ }
444
+ pageUrl.search = urlParams.toString();
445
+ }
446
+ else {
447
+ pageUrl.search = window.location.search;
448
+ }
449
+ var url = pageUrl.pathname + pageUrl.search;
450
+ $(this.element).attr('data-url', url);
451
+ $(this.element).data('url', url);
430
452
  }
431
453
  if (!$(this.element).hasClass('refresh-only')) {
432
454
  var listUrl = document.createElement('a');
@@ -31713,6 +31735,326 @@
31713
31735
  return output;
31714
31736
  };
31715
31737
 
31738
+ var ContentController = /** @class */ (function () {
31739
+ function ContentController() {
31740
+ this.manage();
31741
+ $('body').on('click', '.content-create', this.create.bind(this));
31742
+ $('body').on('click', '.content-delete', this.delete.bind(this));
31743
+ $('body').on('click', '.content-set-status', this.setStatus.bind(this));
31744
+ $('body').on('click', '.content-categories-delete', this.deleteCategory.bind(this));
31745
+ $('body').on('click', '.content-categories-create,.content-categories-edit', this.createOrEditCategory.bind(this));
31746
+ $('body').on('change', '.content-categories-check', this.toggleCategory.bind(this));
31747
+ $('body').on('click', '.content-media-delete', this.removeMedia.bind(this));
31748
+ $('body').on('keyup', '#Slug', function () {
31749
+ var slugValue = $(this).val();
31750
+ $('.slug-display').html(slugValue);
31751
+ });
31752
+ }
31753
+ ContentController.prototype.manage = function () {
31754
+ this.element = document.getElementById('content-list');
31755
+ if (this.element) {
31756
+ this.list = new DataList(this.element, {
31757
+ onComplete: function (data, sender) {
31758
+ Alerts.log('Finished loading content list.', 'info');
31759
+ }.bind(this)
31760
+ });
31761
+ }
31762
+ this.categoryElement = document.getElementById('content-categories-list');
31763
+ if (this.categoryElement) {
31764
+ this.categoryList = new DataList(this.categoryElement, {
31765
+ onComplete: function (data, sender) {
31766
+ Alerts.log('Finished loading category list.', 'info');
31767
+ }.bind(this)
31768
+ });
31769
+ }
31770
+ };
31771
+ ContentController.prototype.create = function (e) {
31772
+ e.preventDefault();
31773
+ e.stopPropagation();
31774
+ var createContentModal = new ModalController({
31775
+ onComplete: function () {
31776
+ var form = document.getElementById('content-create-form');
31777
+ new Validator(form, {
31778
+ onComplete: function (response) {
31779
+ Response.process(response, 5000);
31780
+ if (this.list) {
31781
+ this.list.reload();
31782
+ }
31783
+ if (response.success) {
31784
+ createContentModal.close();
31785
+ }
31786
+ }.bind(this)
31787
+ });
31788
+ }.bind(this)
31789
+ });
31790
+ createContentModal.show($(e.currentTarget).attr('href'), this.element);
31791
+ };
31792
+ ContentController.prototype.delete = function (e) {
31793
+ e.preventDefault();
31794
+ e.stopPropagation();
31795
+ Alerts.confirm({
31796
+ // Confirm options...
31797
+ title: "Are you sure?",
31798
+ html: "The content will be permanently removed."
31799
+ }, function (result) {
31800
+ if (result.isConfirmed) {
31801
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31802
+ Response.process(data, 5000);
31803
+ if (this.list) {
31804
+ this.list.reload();
31805
+ }
31806
+ if (e.currentTarget.dataset.redirect) {
31807
+ Alerts.message('Just taking you back to the content list.', 'Redirecting...');
31808
+ setTimeout(function () {
31809
+ window.location = e.currentTarget.dataset.redirect;
31810
+ }, 1500);
31811
+ }
31812
+ }.bind(this));
31813
+ }
31814
+ }.bind(this));
31815
+ };
31816
+ ContentController.prototype.setStatus = function (e) {
31817
+ e.preventDefault();
31818
+ e.stopPropagation();
31819
+ Alerts.confirm({
31820
+ // Confirm options...
31821
+ title: "Are you sure?",
31822
+ html: "The change will happen immediately."
31823
+ }, function (result) {
31824
+ if (result.isConfirmed) {
31825
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31826
+ Response.process(data, 5000);
31827
+ if (this.list) {
31828
+ this.list.reload();
31829
+ }
31830
+ }.bind(this));
31831
+ }
31832
+ }.bind(this));
31833
+ };
31834
+ ContentController.prototype.clone = function (e) {
31835
+ e.preventDefault();
31836
+ e.stopPropagation();
31837
+ Alerts.confirm({
31838
+ // Confirm options...
31839
+ title: "Are you sure?",
31840
+ html: "This will duplicate the content and everything inside it."
31841
+ }, function (result) {
31842
+ if (result.isConfirmed) {
31843
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31844
+ Response.process(data, 5000);
31845
+ if (this.list) {
31846
+ this.list.reload();
31847
+ }
31848
+ }.bind(this));
31849
+ }
31850
+ }.bind(this));
31851
+ };
31852
+ ContentController.prototype.createOrEditCategory = function (e) {
31853
+ e.preventDefault();
31854
+ e.stopPropagation();
31855
+ var createCategoryModal = new ModalController({
31856
+ onComplete: function () {
31857
+ var form = document.getElementById('content-categories-edit-form');
31858
+ new Validator(form, {
31859
+ onComplete: function (response) {
31860
+ Response.process(response, 5000);
31861
+ if (this.list) {
31862
+ this.list.reload();
31863
+ }
31864
+ if (response.success) {
31865
+ this.categoryList.reload();
31866
+ createCategoryModal.close();
31867
+ }
31868
+ }.bind(this)
31869
+ });
31870
+ }.bind(this)
31871
+ });
31872
+ createCategoryModal.show($(e.currentTarget).attr('href'), this.element);
31873
+ };
31874
+ ContentController.prototype.deleteCategory = function (e) {
31875
+ e.preventDefault();
31876
+ e.stopPropagation();
31877
+ Alerts.confirm({
31878
+ // Confirm options...
31879
+ }, function (result) {
31880
+ if (result.isConfirmed) {
31881
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31882
+ // category deleted...
31883
+ Response.process(data, 5000);
31884
+ this.categoryList.reload();
31885
+ }.bind(this));
31886
+ }
31887
+ }.bind(this));
31888
+ };
31889
+ ContentController.prototype.toggleCategory = function (e) {
31890
+ e.preventDefault();
31891
+ e.stopPropagation();
31892
+ $.post($(e.currentTarget).data('url'), { categoryId: $(e.currentTarget).val(), add: $(e.currentTarget).is(':checked') }, function (response) {
31893
+ Response.process(response, 5000);
31894
+ if (this.categoryList) {
31895
+ this.categoryList.reload();
31896
+ }
31897
+ }.bind(this));
31898
+ };
31899
+ ContentController.prototype.removeMedia = function (e) {
31900
+ e.preventDefault();
31901
+ e.stopPropagation();
31902
+ Alerts.confirm({
31903
+ // Confirm options...
31904
+ title: "Are you sure?",
31905
+ html: "The media will be removed from the property, but will still be in the media collection."
31906
+ }, function (result) {
31907
+ if (result.isConfirmed) {
31908
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31909
+ Response.process(data, 5000);
31910
+ // reload the property media gallery, should be attached to #property-gallery-list
31911
+ var mediaGalleryEl = document.getElementById('content-gallery-list');
31912
+ if (mediaGalleryEl.hoodDataList) {
31913
+ mediaGalleryEl.hoodDataList.reload();
31914
+ }
31915
+ }.bind(this));
31916
+ }
31917
+ }.bind(this));
31918
+ };
31919
+ return ContentController;
31920
+ }());
31921
+
31922
+ var ContentTypeController = /** @class */ (function () {
31923
+ function ContentTypeController() {
31924
+ this.manage();
31925
+ $('body').on('click', '.content-type-create', this.create.bind(this));
31926
+ $('body').on('click', '.content-type-delete', this.delete.bind(this));
31927
+ $('body').on('click', '.content-type-set-status', this.setStatus.bind(this));
31928
+ $('body').on('click', '.content-custom-field-create', this.createField.bind(this));
31929
+ $('body').on('click', '.content-custom-field-delete', this.deleteField.bind(this));
31930
+ $('body').on('keyup', '#Slug', function () {
31931
+ var slugValue = $(this).val();
31932
+ $('.slug-display').html(slugValue);
31933
+ });
31934
+ }
31935
+ ContentTypeController.prototype.manage = function () {
31936
+ this.element = document.getElementById('content-type-list');
31937
+ if (this.element) {
31938
+ this.list = new DataList(this.element, {
31939
+ onComplete: function (data, sender) {
31940
+ Alerts.log('Finished loading content type list.', 'info');
31941
+ }.bind(this)
31942
+ });
31943
+ }
31944
+ this.fieldsElement = document.getElementById('content-custom-field-list');
31945
+ if (this.fieldsElement) {
31946
+ this.fieldsList = new DataList(this.fieldsElement, {
31947
+ onComplete: function (data, sender) {
31948
+ Alerts.log('Finished loading content type list.', 'info');
31949
+ }.bind(this)
31950
+ });
31951
+ }
31952
+ };
31953
+ ContentTypeController.prototype.create = function (e) {
31954
+ e.preventDefault();
31955
+ e.stopPropagation();
31956
+ var createContentModal = new ModalController({
31957
+ onComplete: function () {
31958
+ var form = document.getElementById('content-type-create-form');
31959
+ new Validator(form, {
31960
+ onComplete: function (response) {
31961
+ Response.process(response, 5000);
31962
+ if (this.list) {
31963
+ this.list.reload();
31964
+ }
31965
+ if (response.success) {
31966
+ createContentModal.close();
31967
+ }
31968
+ }.bind(this)
31969
+ });
31970
+ }.bind(this)
31971
+ });
31972
+ createContentModal.show($(e.currentTarget).attr('href'), this.element);
31973
+ };
31974
+ ContentTypeController.prototype.delete = function (e) {
31975
+ e.preventDefault();
31976
+ e.stopPropagation();
31977
+ Alerts.confirm({
31978
+ // Confirm options...
31979
+ title: "Are you sure?",
31980
+ html: "The content type will be permanently removed. Content will remain, but will be unusable and marked as the old content type."
31981
+ }, function (result) {
31982
+ if (result.isConfirmed) {
31983
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
31984
+ Response.process(data, 5000);
31985
+ if (this.list) {
31986
+ this.list.reload();
31987
+ }
31988
+ if (e.currentTarget.dataset.redirect) {
31989
+ Alerts.message('Just taking you back to the content list.', 'Redirecting...');
31990
+ setTimeout(function () {
31991
+ window.location = e.currentTarget.dataset.redirect;
31992
+ }, 1500);
31993
+ }
31994
+ }.bind(this));
31995
+ }
31996
+ }.bind(this));
31997
+ };
31998
+ ContentTypeController.prototype.setStatus = function (e) {
31999
+ e.preventDefault();
32000
+ e.stopPropagation();
32001
+ Alerts.confirm({
32002
+ // Confirm options...
32003
+ title: "Are you sure?",
32004
+ html: "The change will happen immediately."
32005
+ }, function (result) {
32006
+ if (result.isConfirmed) {
32007
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
32008
+ Response.process(data, 5000);
32009
+ if (this.list) {
32010
+ this.list.reload();
32011
+ }
32012
+ }.bind(this));
32013
+ }
32014
+ }.bind(this));
32015
+ };
32016
+ ContentTypeController.prototype.createField = function (e) {
32017
+ e.preventDefault();
32018
+ e.stopPropagation();
32019
+ var createContentModal = new ModalController({
32020
+ onComplete: function () {
32021
+ var form = document.getElementById('content-custom-field-create-form');
32022
+ new Validator(form, {
32023
+ onComplete: function (response) {
32024
+ Response.process(response, 5000);
32025
+ if (this.fieldsList) {
32026
+ this.fieldsList.reload();
32027
+ }
32028
+ if (response.success) {
32029
+ createContentModal.close();
32030
+ }
32031
+ }.bind(this)
32032
+ });
32033
+ }.bind(this)
32034
+ });
32035
+ createContentModal.show($(e.currentTarget).attr('href'), this.element);
32036
+ };
32037
+ ContentTypeController.prototype.deleteField = function (e) {
32038
+ e.preventDefault();
32039
+ e.stopPropagation();
32040
+ Alerts.confirm({
32041
+ // Confirm options...
32042
+ title: "Are you sure?",
32043
+ html: "The field will be permanently removed. However fields will still be attached to content."
32044
+ }, function (result) {
32045
+ if (result.isConfirmed) {
32046
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
32047
+ Response.process(data, 5000);
32048
+ if (this.fieldsList) {
32049
+ this.fieldsList.reload();
32050
+ }
32051
+ }.bind(this));
32052
+ }
32053
+ }.bind(this));
32054
+ };
32055
+ return ContentTypeController;
32056
+ }());
32057
+
31716
32058
  /*!
31717
32059
  * Chart.js v3.7.0
31718
32060
  * https://www.chartjs.org
@@ -43363,6 +43705,20 @@
43363
43705
  return HomeController;
43364
43706
  }());
43365
43707
 
43708
+ var LogsController = /** @class */ (function () {
43709
+ function LogsController() {
43710
+ this.element = document.getElementById('log-list');
43711
+ if (this.element) {
43712
+ this.list = new DataList(this.element, {
43713
+ onComplete: function (data, sender) {
43714
+ Alerts.log('Finished loading logs list.', 'info');
43715
+ }.bind(this)
43716
+ });
43717
+ }
43718
+ }
43719
+ return LogsController;
43720
+ }());
43721
+
43366
43722
  var MediaController = /** @class */ (function () {
43367
43723
  function MediaController() {
43368
43724
  this.manage();
@@ -43392,190 +43748,6 @@
43392
43748
  return MediaController;
43393
43749
  }());
43394
43750
 
43395
- var ContentController = /** @class */ (function () {
43396
- function ContentController() {
43397
- this.manage();
43398
- $('body').on('click', '.content-create', this.create.bind(this));
43399
- $('body').on('click', '.content-delete', this.delete.bind(this));
43400
- $('body').on('click', '.content-set-status', this.setStatus.bind(this));
43401
- $('body').on('click', '.content-categories-delete', this.deleteCategory.bind(this));
43402
- $('body').on('click', '.content-categories-create,.content-categories-edit', this.createOrEditCategory.bind(this));
43403
- $('body').on('change', '.content-categories-check', this.toggleCategory.bind(this));
43404
- $('body').on('click', '.content-media-delete', this.removeMedia.bind(this));
43405
- $('body').on('keyup', '#Slug', function () {
43406
- var slugValue = $(this).val();
43407
- $('.slug-display').html(slugValue);
43408
- });
43409
- }
43410
- ContentController.prototype.manage = function () {
43411
- this.element = document.getElementById('content-list');
43412
- if (this.element) {
43413
- this.list = new DataList(this.element, {
43414
- onComplete: function (data, sender) {
43415
- Alerts.log('Finished loading content list.', 'info');
43416
- }.bind(this)
43417
- });
43418
- }
43419
- this.categoryElement = document.getElementById('content-categories-list');
43420
- if (this.categoryElement) {
43421
- this.categoryList = new DataList(this.categoryElement, {
43422
- onComplete: function (data, sender) {
43423
- Alerts.log('Finished loading category list.', 'info');
43424
- }.bind(this)
43425
- });
43426
- }
43427
- };
43428
- ContentController.prototype.create = function (e) {
43429
- e.preventDefault();
43430
- e.stopPropagation();
43431
- var createContentModal = new ModalController({
43432
- onComplete: function () {
43433
- var form = document.getElementById('content-create-form');
43434
- new Validator(form, {
43435
- onComplete: function (response) {
43436
- Response.process(response, 5000);
43437
- if (this.list) {
43438
- this.list.reload();
43439
- }
43440
- if (response.success) {
43441
- createContentModal.close();
43442
- }
43443
- }.bind(this)
43444
- });
43445
- }.bind(this)
43446
- });
43447
- createContentModal.show($(e.currentTarget).attr('href'), this.element);
43448
- };
43449
- ContentController.prototype.delete = function (e) {
43450
- e.preventDefault();
43451
- e.stopPropagation();
43452
- Alerts.confirm({
43453
- // Confirm options...
43454
- title: "Are you sure?",
43455
- html: "The content will be permanently removed."
43456
- }, function (result) {
43457
- if (result.isConfirmed) {
43458
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43459
- Response.process(data, 5000);
43460
- if (this.list) {
43461
- this.list.reload();
43462
- }
43463
- if (e.currentTarget.dataset.redirect) {
43464
- Alerts.message('Just taking you back to the content list.', 'Redirecting...');
43465
- setTimeout(function () {
43466
- window.location = e.currentTarget.dataset.redirect;
43467
- }, 1500);
43468
- }
43469
- }.bind(this));
43470
- }
43471
- }.bind(this));
43472
- };
43473
- ContentController.prototype.setStatus = function (e) {
43474
- e.preventDefault();
43475
- e.stopPropagation();
43476
- Alerts.confirm({
43477
- // Confirm options...
43478
- title: "Are you sure?",
43479
- html: "The change will happen immediately."
43480
- }, function (result) {
43481
- if (result.isConfirmed) {
43482
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43483
- Response.process(data, 5000);
43484
- if (this.list) {
43485
- this.list.reload();
43486
- }
43487
- }.bind(this));
43488
- }
43489
- }.bind(this));
43490
- };
43491
- ContentController.prototype.clone = function (e) {
43492
- e.preventDefault();
43493
- e.stopPropagation();
43494
- Alerts.confirm({
43495
- // Confirm options...
43496
- title: "Are you sure?",
43497
- html: "This will duplicate the content and everything inside it."
43498
- }, function (result) {
43499
- if (result.isConfirmed) {
43500
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43501
- Response.process(data, 5000);
43502
- if (this.list) {
43503
- this.list.reload();
43504
- }
43505
- }.bind(this));
43506
- }
43507
- }.bind(this));
43508
- };
43509
- ContentController.prototype.createOrEditCategory = function (e) {
43510
- e.preventDefault();
43511
- e.stopPropagation();
43512
- var createCategoryModal = new ModalController({
43513
- onComplete: function () {
43514
- var form = document.getElementById('content-categories-edit-form');
43515
- new Validator(form, {
43516
- onComplete: function (response) {
43517
- Response.process(response, 5000);
43518
- if (this.list) {
43519
- this.list.reload();
43520
- }
43521
- if (response.success) {
43522
- this.categoryList.reload();
43523
- createCategoryModal.close();
43524
- }
43525
- }.bind(this)
43526
- });
43527
- }.bind(this)
43528
- });
43529
- createCategoryModal.show($(e.currentTarget).attr('href'), this.element);
43530
- };
43531
- ContentController.prototype.deleteCategory = function (e) {
43532
- e.preventDefault();
43533
- e.stopPropagation();
43534
- Alerts.confirm({
43535
- // Confirm options...
43536
- }, function (result) {
43537
- if (result.isConfirmed) {
43538
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43539
- // category deleted...
43540
- Response.process(data, 5000);
43541
- this.categoryList.reload();
43542
- }.bind(this));
43543
- }
43544
- }.bind(this));
43545
- };
43546
- ContentController.prototype.toggleCategory = function (e) {
43547
- e.preventDefault();
43548
- e.stopPropagation();
43549
- $.post($(e.currentTarget).data('url'), { categoryId: $(e.currentTarget).val(), add: $(e.currentTarget).is(':checked') }, function (response) {
43550
- Response.process(response, 5000);
43551
- if (this.categoryList) {
43552
- this.categoryList.reload();
43553
- }
43554
- }.bind(this));
43555
- };
43556
- ContentController.prototype.removeMedia = function (e) {
43557
- e.preventDefault();
43558
- e.stopPropagation();
43559
- Alerts.confirm({
43560
- // Confirm options...
43561
- title: "Are you sure?",
43562
- html: "The media will be removed from the property, but will still be in the media collection."
43563
- }, function (result) {
43564
- if (result.isConfirmed) {
43565
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43566
- Response.process(data, 5000);
43567
- // reload the property media gallery, should be attached to #property-gallery-list
43568
- var mediaGalleryEl = document.getElementById('content-gallery-list');
43569
- if (mediaGalleryEl.hoodDataList) {
43570
- mediaGalleryEl.hoodDataList.reload();
43571
- }
43572
- }.bind(this));
43573
- }
43574
- }.bind(this));
43575
- };
43576
- return ContentController;
43577
- }());
43578
-
43579
43751
  var PropertyController = /** @class */ (function () {
43580
43752
  function PropertyController() {
43581
43753
  this.manage();
@@ -43690,6 +43862,137 @@
43690
43862
  return PropertyController;
43691
43863
  }());
43692
43864
 
43865
+ var PropertyImporter = /** @class */ (function () {
43866
+ function PropertyImporter() {
43867
+ if ($('#import-property-start').length > 0) {
43868
+ this.update();
43869
+ $('#import-property-start').click(function () {
43870
+ $.ajax({
43871
+ url: $('#import-property-start').data('url'),
43872
+ type: "POST",
43873
+ error: Inline.handleError,
43874
+ success: function () {
43875
+ this.update();
43876
+ }.bind(this)
43877
+ });
43878
+ }.bind(this));
43879
+ $('#import-property-cancel').click(function () {
43880
+ $.ajax({
43881
+ url: $('#import-property-cancel').data('url'),
43882
+ type: "POST",
43883
+ error: Inline.handleError,
43884
+ success: function () {
43885
+ this.update();
43886
+ }.bind(this)
43887
+ });
43888
+ }.bind(this));
43889
+ }
43890
+ }
43891
+ PropertyImporter.prototype.update = function () {
43892
+ $.ajax({
43893
+ url: $('#import-property-status').data('url'),
43894
+ type: "POST",
43895
+ error: Inline.handleError,
43896
+ success: function (result) {
43897
+ if (result.importer.running) {
43898
+ this.showInfo();
43899
+ clearInterval(this.updateInterval);
43900
+ this.updateInterval = window.setTimeout(this.update, 250);
43901
+ }
43902
+ else {
43903
+ clearInterval(this.updateInterval);
43904
+ this.hideInfo();
43905
+ }
43906
+ $('.tp').html(result.importer.total.toString());
43907
+ $('#pu').html(result.importer.updated.toString());
43908
+ $('#pa').html(result.importer.added.toString());
43909
+ $('#pp').html(result.importer.processed.toString());
43910
+ $('#pd').html(result.importer.deleted.toString());
43911
+ $('#ToAdd').html(result.importer.toAdd.toString());
43912
+ $('#ToUpdate').html(result.importer.toUpdate.toString());
43913
+ $('#ToDelete').html(result.importer.toDelete.toString());
43914
+ $('#pt').html(result.importer.statusMessage.toString());
43915
+ var ftpPercentComplete = Math.round(result.ftp.complete * 100) / 100;
43916
+ $('#fp').html(ftpPercentComplete.toString());
43917
+ $('#ft').html(result.ftp.statusMessage);
43918
+ var percentComplete = Math.round(result.importer.complete * 100) / 100;
43919
+ $('.pc').html(percentComplete.toString());
43920
+ $('#progressbar').css({
43921
+ width: result.importer.complete + "%"
43922
+ });
43923
+ if (result.importer.errors.length) {
43924
+ var errorHtml = "";
43925
+ for (var i = result.importer.errors.length - 1; i >= 0; i--) {
43926
+ errorHtml += '<div class="text-danger">' + result.importer.errors[i] + '</div>';
43927
+ }
43928
+ $('#import-property-errors').html(errorHtml);
43929
+ }
43930
+ else {
43931
+ $('#import-property-errors').html("<div>No errors reported.</div>");
43932
+ }
43933
+ if (result.importer.warnings.length) {
43934
+ var warningHtml = "";
43935
+ for (var j = result.importer.warnings.length - 1; j >= 0; j--) {
43936
+ warningHtml += '<div class="text-warning">' + result.importer.warnings[j] + '</div>';
43937
+ }
43938
+ $('#import-property-warnings').html(warningHtml);
43939
+ }
43940
+ else {
43941
+ $('#import-property-warnings').html("<div>No warnings reported.</div>");
43942
+ }
43943
+ }.bind(this)
43944
+ });
43945
+ };
43946
+ PropertyImporter.prototype.hideInfo = function () {
43947
+ $('#import-property-start').removeAttr('disabled');
43948
+ $('#import-property-cancel').attr('disabled', 'disabled');
43949
+ $('#import-property-progress').removeClass('d-block');
43950
+ $('#import-property-progress').addClass('d-none');
43951
+ };
43952
+ PropertyImporter.prototype.showInfo = function () {
43953
+ $('#import-property-cancel').removeAttr('disabled');
43954
+ $('#import-property-start').attr('disabled', 'disabled');
43955
+ $('#import-property-progress').addClass('d-block');
43956
+ $('#import-property-progress').removeClass('d-none');
43957
+ };
43958
+ return PropertyImporter;
43959
+ }());
43960
+
43961
+ var ThemesController = /** @class */ (function () {
43962
+ function ThemesController() {
43963
+ $('body').on('click', '.activate-theme', this.activate.bind(this));
43964
+ this.element = document.getElementById('themes-list');
43965
+ if (this.element) {
43966
+ this.list = new DataList(this.element, {
43967
+ onComplete: function (data, sender) {
43968
+ Alerts.log('Finished loading users list.', 'info');
43969
+ }.bind(this)
43970
+ });
43971
+ }
43972
+ }
43973
+ ThemesController.prototype.activate = function (e) {
43974
+ e.preventDefault();
43975
+ e.stopPropagation();
43976
+ Alerts.confirm({
43977
+ // Confirm options...
43978
+ title: "Are you sure?",
43979
+ html: "The site will change themes, and the selected theme will be live right away."
43980
+ }, function (result) {
43981
+ if (result.isConfirmed) {
43982
+ Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43983
+ Response.process(data, 5000);
43984
+ setTimeout(function () {
43985
+ if (this.list) {
43986
+ this.list.reload();
43987
+ }
43988
+ }.bind(this), 2000);
43989
+ }.bind(this));
43990
+ }
43991
+ }.bind(this));
43992
+ };
43993
+ return ThemesController;
43994
+ }());
43995
+
43693
43996
  var UsersController = /** @class */ (function () {
43694
43997
  function UsersController() {
43695
43998
  this.initLists();
@@ -43860,287 +44163,6 @@
43860
44163
  return UsersController;
43861
44164
  }());
43862
44165
 
43863
- var ThemesController = /** @class */ (function () {
43864
- function ThemesController() {
43865
- $('body').on('click', '.activate-theme', this.activate.bind(this));
43866
- this.element = document.getElementById('themes-list');
43867
- if (this.element) {
43868
- this.list = new DataList(this.element, {
43869
- onComplete: function (data, sender) {
43870
- Alerts.log('Finished loading users list.', 'info');
43871
- }.bind(this)
43872
- });
43873
- }
43874
- }
43875
- ThemesController.prototype.activate = function (e) {
43876
- e.preventDefault();
43877
- e.stopPropagation();
43878
- Alerts.confirm({
43879
- // Confirm options...
43880
- title: "Are you sure?",
43881
- html: "The site will change themes, and the selected theme will be live right away."
43882
- }, function (result) {
43883
- if (result.isConfirmed) {
43884
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43885
- Response.process(data, 5000);
43886
- setTimeout(function () {
43887
- if (this.list) {
43888
- this.list.reload();
43889
- }
43890
- }.bind(this), 2000);
43891
- }.bind(this));
43892
- }
43893
- }.bind(this));
43894
- };
43895
- return ThemesController;
43896
- }());
43897
-
43898
- var ContentTypeController = /** @class */ (function () {
43899
- function ContentTypeController() {
43900
- this.manage();
43901
- $('body').on('click', '.content-type-create', this.create.bind(this));
43902
- $('body').on('click', '.content-type-delete', this.delete.bind(this));
43903
- $('body').on('click', '.content-type-set-status', this.setStatus.bind(this));
43904
- $('body').on('click', '.content-custom-field-create', this.createField.bind(this));
43905
- $('body').on('click', '.content-custom-field-delete', this.deleteField.bind(this));
43906
- $('body').on('keyup', '#Slug', function () {
43907
- var slugValue = $(this).val();
43908
- $('.slug-display').html(slugValue);
43909
- });
43910
- }
43911
- ContentTypeController.prototype.manage = function () {
43912
- this.element = document.getElementById('content-type-list');
43913
- if (this.element) {
43914
- this.list = new DataList(this.element, {
43915
- onComplete: function (data, sender) {
43916
- Alerts.log('Finished loading content type list.', 'info');
43917
- }.bind(this)
43918
- });
43919
- }
43920
- this.fieldsElement = document.getElementById('content-custom-field-list');
43921
- if (this.fieldsElement) {
43922
- this.fieldsList = new DataList(this.fieldsElement, {
43923
- onComplete: function (data, sender) {
43924
- Alerts.log('Finished loading content type list.', 'info');
43925
- }.bind(this)
43926
- });
43927
- }
43928
- };
43929
- ContentTypeController.prototype.create = function (e) {
43930
- e.preventDefault();
43931
- e.stopPropagation();
43932
- var createContentModal = new ModalController({
43933
- onComplete: function () {
43934
- var form = document.getElementById('content-type-create-form');
43935
- new Validator(form, {
43936
- onComplete: function (response) {
43937
- Response.process(response, 5000);
43938
- if (this.list) {
43939
- this.list.reload();
43940
- }
43941
- if (response.success) {
43942
- createContentModal.close();
43943
- }
43944
- }.bind(this)
43945
- });
43946
- }.bind(this)
43947
- });
43948
- createContentModal.show($(e.currentTarget).attr('href'), this.element);
43949
- };
43950
- ContentTypeController.prototype.delete = function (e) {
43951
- e.preventDefault();
43952
- e.stopPropagation();
43953
- Alerts.confirm({
43954
- // Confirm options...
43955
- title: "Are you sure?",
43956
- html: "The content type will be permanently removed. Content will remain, but will be unusable and marked as the old content type."
43957
- }, function (result) {
43958
- if (result.isConfirmed) {
43959
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43960
- Response.process(data, 5000);
43961
- if (this.list) {
43962
- this.list.reload();
43963
- }
43964
- if (e.currentTarget.dataset.redirect) {
43965
- Alerts.message('Just taking you back to the content list.', 'Redirecting...');
43966
- setTimeout(function () {
43967
- window.location = e.currentTarget.dataset.redirect;
43968
- }, 1500);
43969
- }
43970
- }.bind(this));
43971
- }
43972
- }.bind(this));
43973
- };
43974
- ContentTypeController.prototype.setStatus = function (e) {
43975
- e.preventDefault();
43976
- e.stopPropagation();
43977
- Alerts.confirm({
43978
- // Confirm options...
43979
- title: "Are you sure?",
43980
- html: "The change will happen immediately."
43981
- }, function (result) {
43982
- if (result.isConfirmed) {
43983
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
43984
- Response.process(data, 5000);
43985
- if (this.list) {
43986
- this.list.reload();
43987
- }
43988
- }.bind(this));
43989
- }
43990
- }.bind(this));
43991
- };
43992
- ContentTypeController.prototype.createField = function (e) {
43993
- e.preventDefault();
43994
- e.stopPropagation();
43995
- var createContentModal = new ModalController({
43996
- onComplete: function () {
43997
- var form = document.getElementById('content-custom-field-create-form');
43998
- new Validator(form, {
43999
- onComplete: function (response) {
44000
- Response.process(response, 5000);
44001
- if (this.fieldsList) {
44002
- this.fieldsList.reload();
44003
- }
44004
- if (response.success) {
44005
- createContentModal.close();
44006
- }
44007
- }.bind(this)
44008
- });
44009
- }.bind(this)
44010
- });
44011
- createContentModal.show($(e.currentTarget).attr('href'), this.element);
44012
- };
44013
- ContentTypeController.prototype.deleteField = function (e) {
44014
- e.preventDefault();
44015
- e.stopPropagation();
44016
- Alerts.confirm({
44017
- // Confirm options...
44018
- title: "Are you sure?",
44019
- html: "The field will be permanently removed. However fields will still be attached to content."
44020
- }, function (result) {
44021
- if (result.isConfirmed) {
44022
- Inline.post(e.currentTarget.href, e.currentTarget, function (data) {
44023
- Response.process(data, 5000);
44024
- if (this.fieldsList) {
44025
- this.fieldsList.reload();
44026
- }
44027
- }.bind(this));
44028
- }
44029
- }.bind(this));
44030
- };
44031
- return ContentTypeController;
44032
- }());
44033
-
44034
- var LogsController = /** @class */ (function () {
44035
- function LogsController() {
44036
- this.element = document.getElementById('log-list');
44037
- if (this.element) {
44038
- this.list = new DataList(this.element, {
44039
- onComplete: function (data, sender) {
44040
- Alerts.log('Finished loading logs list.', 'info');
44041
- }.bind(this)
44042
- });
44043
- }
44044
- }
44045
- return LogsController;
44046
- }());
44047
-
44048
- var PropertyImporter = /** @class */ (function () {
44049
- function PropertyImporter() {
44050
- if ($('#import-property-start').length > 0) {
44051
- this.update();
44052
- $('#import-property-start').click(function () {
44053
- $.ajax({
44054
- url: $('#import-property-start').data('url'),
44055
- type: "POST",
44056
- error: Inline.handleError,
44057
- success: function () {
44058
- this.update();
44059
- }.bind(this)
44060
- });
44061
- }.bind(this));
44062
- $('#import-property-cancel').click(function () {
44063
- $.ajax({
44064
- url: $('#import-property-cancel').data('url'),
44065
- type: "POST",
44066
- error: Inline.handleError,
44067
- success: function () {
44068
- this.update();
44069
- }.bind(this)
44070
- });
44071
- }.bind(this));
44072
- }
44073
- }
44074
- PropertyImporter.prototype.update = function () {
44075
- $.ajax({
44076
- url: $('#import-property-status').data('url'),
44077
- type: "POST",
44078
- error: Inline.handleError,
44079
- success: function (result) {
44080
- if (result.importer.running) {
44081
- this.showInfo();
44082
- clearInterval(this.updateInterval);
44083
- this.updateInterval = window.setTimeout(this.update, 250);
44084
- }
44085
- else {
44086
- clearInterval(this.updateInterval);
44087
- this.hideInfo();
44088
- }
44089
- $('.tp').html(result.importer.total.toString());
44090
- $('#pu').html(result.importer.updated.toString());
44091
- $('#pa').html(result.importer.added.toString());
44092
- $('#pp').html(result.importer.processed.toString());
44093
- $('#pd').html(result.importer.deleted.toString());
44094
- $('#ToAdd').html(result.importer.toAdd.toString());
44095
- $('#ToUpdate').html(result.importer.toUpdate.toString());
44096
- $('#ToDelete').html(result.importer.toDelete.toString());
44097
- $('#pt').html(result.importer.statusMessage.toString());
44098
- var ftpPercentComplete = Math.round(result.ftp.complete * 100) / 100;
44099
- $('#fp').html(ftpPercentComplete.toString());
44100
- $('#ft').html(result.ftp.statusMessage);
44101
- var percentComplete = Math.round(result.importer.complete * 100) / 100;
44102
- $('.pc').html(percentComplete.toString());
44103
- $('#progressbar').css({
44104
- width: result.importer.complete + "%"
44105
- });
44106
- if (result.importer.errors.length) {
44107
- var errorHtml = "";
44108
- for (var i = result.importer.errors.length - 1; i >= 0; i--) {
44109
- errorHtml += '<div class="text-danger">' + result.importer.errors[i] + '</div>';
44110
- }
44111
- $('#import-property-errors').html(errorHtml);
44112
- }
44113
- else {
44114
- $('#import-property-errors').html("<div>No errors reported.</div>");
44115
- }
44116
- if (result.importer.warnings.length) {
44117
- var warningHtml = "";
44118
- for (var j = result.importer.warnings.length - 1; j >= 0; j--) {
44119
- warningHtml += '<div class="text-warning">' + result.importer.warnings[j] + '</div>';
44120
- }
44121
- $('#import-property-warnings').html(warningHtml);
44122
- }
44123
- else {
44124
- $('#import-property-warnings').html("<div>No warnings reported.</div>");
44125
- }
44126
- }.bind(this)
44127
- });
44128
- };
44129
- PropertyImporter.prototype.hideInfo = function () {
44130
- $('#import-property-start').removeAttr('disabled');
44131
- $('#import-property-cancel').attr('disabled', 'disabled');
44132
- $('#import-property-progress').removeClass('d-block');
44133
- $('#import-property-progress').addClass('d-none');
44134
- };
44135
- PropertyImporter.prototype.showInfo = function () {
44136
- $('#import-property-cancel').removeAttr('disabled');
44137
- $('#import-property-start').attr('disabled', 'disabled');
44138
- $('#import-property-progress').addClass('d-block');
44139
- $('#import-property-progress').removeClass('d-none');
44140
- };
44141
- return PropertyImporter;
44142
- }());
44143
-
44144
44166
  var Admin = /** @class */ (function (_super) {
44145
44167
  __extends(Admin, _super);
44146
44168
  function Admin() {