From 2d9281819317b4f9fe4d1ebf7b0e1a4f535a9449 Mon Sep 17 00:00:00 2001 From: eurohlam Date: Sun, 8 Mar 2020 00:52:13 +1300 Subject: [PATCH 1/2] profile page improvement --- .../src/main/webapp/jsp/profile.jsp | 52 +++++++++------ .../src/main/webapp/jsp/subscriberDetails.jsp | 20 +++--- rss-2-kindle-web/src/main/webapp/test.html | 64 +++++++++++++++++-- 3 files changed, 104 insertions(+), 32 deletions(-) diff --git a/rss-2-kindle-web/src/main/webapp/jsp/profile.jsp b/rss-2-kindle-web/src/main/webapp/jsp/profile.jsp index 35b37c7..5ee400e 100644 --- a/rss-2-kindle-web/src/main/webapp/jsp/profile.jsp +++ b/rss-2-kindle-web/src/main/webapp/jsp/profile.jsp @@ -88,7 +88,7 @@ }); - $('#dashboard_user_status').append('
User status: ' + data.status + '
'); + $('#dashboard_user_status').append('User status: ' + data.status); $('#dashboard_user_info').append( 'Contact email: ' + data.email + '
' + 'Created: ' + data.dateCreated + '
' + @@ -96,13 +96,13 @@ 'Last logged in: ' + data.previousLogin + '
' ); - $('#dashboard_subscribers_status').append('
Number of subscribers: ' + data.subscribers.length + '
'); + $('#dashboard_subscribers_status').append('Number of subscribers: ' + data.subscribers.length); $('#dashboard_subscribers_info').append( 'Active subscribers:' + (data.subscribers.length - suspendedSubscribersnumber) + '
' + 'Suspended subscribers: ' + suspendedSubscribersnumber + '


' ); - $('#dashboard_subscriptions_status').append('
Number of subscriptions: ' + rssNumber + '
'); + $('#dashboard_subscriptions_status').append('Number of subscriptions: ' + rssNumber); $('#dashboard_subscriptions_info').append( 'Active subscriptions:' + (rssNumber - deadRssNumber - offlineRssNumber) + '
' + 'Dead subscriptions: ' + deadRssNumber + '
' + @@ -132,28 +132,40 @@
-
-
-

User info

-
+
+
+
+

User info

+
+
-
-
-

Subscribers

-
+
+
+
+

Subscribers

+
+
-
-
-

Subscriptions

-
+
+
+
+

Subscriptions

+
+
-
-
-

Subscribers

+
+
+
+

Subscribers

+
+
-
-

Subscriptions

+
+
+

Subscriptions

+
+
diff --git a/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp b/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp index 60ba854..c53aed0 100644 --- a/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp +++ b/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp @@ -92,8 +92,8 @@ operation = 'add'; message = 'Subscriptions added successfully'; $('#addModal').modal('show'); - $('#add_subscriptions_form').submit(function (e) { - e.preventDefault(); + $('#add_subscriptions_form').submit(function (ev) { + ev.preventDefault(); //validate rss list var rsslistField = $('#rss_list'); rsslistField.popover('dispose'); @@ -128,8 +128,8 @@ operation = 'deactivate'; message = 'Subscriptions deactivated successfully'; $('#deactivateModal').modal('show'); - $('#deactivate_subscriptions_form').submit(function (e) { - e.preventDefault(); + $('#deactivate_subscriptions_form').submit(function (ev) { + ev.preventDefault(); updateSubscriptions(operation, message); $('#deactivateModal').modal('hide'); }); @@ -137,8 +137,8 @@ operation = 'activate'; message = 'Subscriptions activated successfully'; $('#activateModal').modal('show'); - $('#activate_subscriptions_form').submit(function (e) { - e.preventDefault(); + $('#activate_subscriptions_form').submit(function (ev) { + ev.preventDefault(); updateSubscriptions(operation, message); $('#activateModal').modal('hide'); }); @@ -146,8 +146,8 @@ operation = 'remove'; message = 'Subscriptions removed successfully'; $('#removeModal').modal('show'); - $('#remove_subscriptions_form').submit(function (e) { - e.preventDefault(); + $('#remove_subscriptions_form').submit(function (ev) { + ev.preventDefault(); updateSubscriptions(operation, message); $('#removeModal').modal('hide'); }); @@ -230,22 +230,26 @@
- + +
copyright py-4 text-center text-white"> +
+ Copyright © Roundkick Studio 2019 +
+
+ + +
+ + + +
diff --git a/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp b/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp index c53aed0..b0d8695 100644 --- a/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp +++ b/rss-2-kindle-web/src/main/webapp/jsp/subscriberDetails.jsp @@ -86,75 +86,75 @@ $('#subscribers_form').submit(function (e) { e.preventDefault(); var srcButtonId = $(document.activeElement).attr('id'); - var operation; - var message; if (srcButtonId == 'add_btn') { - operation = 'add'; - message = 'Subscriptions added successfully'; $('#addModal').modal('show'); - $('#add_subscriptions_form').submit(function (ev) { - ev.preventDefault(); - //validate rss list - var rsslistField = $('#rss_list'); - rsslistField.popover('dispose'); - if ($('#rss_list option').length === 0) { - rsslistField.popover( - { - content: 'At least one RSS is required', - trigger: 'manual', - placement: 'auto' - }); - rsslistField.popover('show'); - - return false; - } - - var newRssList = userData.rsslist; - $('#rss_list option').each(function (i) { - newRssList.push({'rss': $(this).val(), 'status': 'active'}); - }); - userData.rsslist = newRssList; - $().runAjax(rootURL + '/update', - 'PUT', - JSON.stringify(userData), - 'New subscriptions have been added successfully', - 'Adding new subscriptions failed', - reloadRssTable - ); - $('#addModal').modal('hide'); - rsslistField.empty(); - }); } else if (srcButtonId == 'deactivate_btn') { - operation = 'deactivate'; - message = 'Subscriptions deactivated successfully'; $('#deactivateModal').modal('show'); - $('#deactivate_subscriptions_form').submit(function (ev) { - ev.preventDefault(); - updateSubscriptions(operation, message); - $('#deactivateModal').modal('hide'); - }); } else if (srcButtonId == 'activate_btn') { - operation = 'activate'; - message = 'Subscriptions activated successfully'; $('#activateModal').modal('show'); - $('#activate_subscriptions_form').submit(function (ev) { - ev.preventDefault(); - updateSubscriptions(operation, message); - $('#activateModal').modal('hide'); - }); } else if (srcButtonId == 'remove_btn') { - operation = 'remove'; - message = 'Subscriptions removed successfully'; $('#removeModal').modal('show'); - $('#remove_subscriptions_form').submit(function (ev) { - ev.preventDefault(); - updateSubscriptions(operation, message); - $('#removeModal').modal('hide'); - }); } }); //subscribers_form.submit + $('#add_subscriptions_form').submit(function (ev) { + ev.preventDefault(); + //validate rss list + var rsslistField = $('#rss_list'); + rsslistField.popover('dispose'); + if ($('#rss_list option').length === 0) { + rsslistField.popover( + { + content: 'At least one RSS is required', + trigger: 'manual', + placement: 'auto' + }); + rsslistField.popover('show'); + + return false; + } + + var newRssList = userData.rsslist; + $('#rss_list option').each(function (i) { + newRssList.push({'rss': $(this).val(), 'status': 'active'}); + }); + userData.rsslist = newRssList; + $().runAjax(rootURL + '/update', + 'PUT', + JSON.stringify(userData), + 'New subscriptions have been added successfully', + 'Adding new subscriptions failed', + reloadRssTable + ); + $('#addModal').modal('hide'); + rsslistField.empty(); + }); + + $('#activate_subscriptions_form').submit(function (ev) { + ev.preventDefault(); + var operation = 'activate'; + var message = 'Subscriptions activated successfully'; + updateSubscriptions(operation, message); + $('#activateModal').modal('hide'); + }); + + $('#deactivate_subscriptions_form').submit(function (ev) { + ev.preventDefault(); + var operation = 'deactivate'; + var message = 'Subscriptions deactivated successfully'; + updateSubscriptions(operation, message); + $('#deactivateModal').modal('hide'); + }); + + $('#remove_subscriptions_form').submit(function (ev) { + ev.preventDefault(); + var operation = 'remove'; + var message = 'Subscriptions removed successfully'; + updateSubscriptions(operation, message); + $('#removeModal').modal('hide'); + }); + function updateSubscriptions(operation, message) { var updatedRssList = userData.rsslist; $("input:checked[id!='select_all_checkbox']").each(function (index) { @@ -256,7 +256,7 @@
-
+
diff --git a/rss-2-kindle-web/src/main/webapp/test.html b/rss-2-kindle-web/src/main/webapp/test.html index ba5de69..1fdbd03 100644 --- a/rss-2-kindle-web/src/main/webapp/test.html +++ b/rss-2-kindle-web/src/main/webapp/test.html @@ -408,60 +408,6 @@

kindle@kindle.com

-
-
-
Profile overview for:
-

testuser

-
-
-
-
-
-
User status: active
-

User info

-
- Contact email: test@test.com
- Created: 2020-03-07T05:56:48.334
- Modified: 2020-03-07T06:00:10.826
- Last logged in: 2020-03-07T05:58:16.206 -
-
-
-
-
-
Number of subscribers: 8
-

Subscribers

-
- Active subscribers:8
- Suspended subscribers: 0 -
-
-
-
-
-
Number of subscriptions: 34
-

Subscriptions

-
- Active subscriptions:19
- Dead subscriptions: 0
- Offline subscriptions: 15 -
-
-
-
-
-
-
-

Subscribers

-
-
-
-
-

Subscriptions

-
-
-
-