From 6b006a18e7efef814fa7a59102c85299acb0a0a4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 15:21:25 +0300 Subject: subscribe to feed: use client dialog --- js/App.js | 6 ++-- js/CommonDialogs.js | 94 ++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 89 insertions(+), 11 deletions(-) (limited to 'js') diff --git a/js/App.js b/js/App.js index 3a31438c5..5c2d7726c 100644 --- a/js/App.js +++ b/js/App.js @@ -838,7 +838,7 @@ const App = { if (this.is_prefs) { this.hotkey_actions["feed_subscribe"] = () => { - CommonDialogs.quickAddFeed(); + CommonDialogs.subscribeToFeed(); }; this.hotkey_actions["create_label"] = () => { @@ -994,7 +994,7 @@ const App = { Feeds.toggleUnread(); }; this.hotkey_actions["feed_subscribe"] = () => { - CommonDialogs.quickAddFeed(); + CommonDialogs.subscribeToFeed(); }; this.hotkey_actions["feed_debug_update"] = () => { if (!Feeds.activeIsCat() && parseInt(Feeds.getActive()) > 0) { @@ -1139,7 +1139,7 @@ const App = { Feeds.search(); break; case "qmcAddFeed": - CommonDialogs.quickAddFeed(); + CommonDialogs.subscribeToFeed(); break; case "qmcDigest": window.location.href = "backend.php?op=digest"; diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index 60c3e2a84..492467b7f 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -77,15 +77,93 @@ const CommonDialogs = { return false; }, - quickAddFeed: function() { - xhrPost("backend.php", - {op: "feeds", method: "quickAddFeed"}, - (transport) => { - + subscribeToFeed: function() { + xhrJson("backend.php", + {op: "feeds", method: "subscribeToFeed"}, + (reply) => { const dialog = new fox.SingleUseDialog({ - id: "feedAddDlg", title: __("Subscribe to Feed"), - content: transport.responseText, + content: ` +
+ + ${App.FormFields.hidden("op", "feeds")} + ${App.FormFields.hidden("method", "add")} + + + + + +
+
+
+ +
+ + ${App.getInitParam('enable_feed_cats') ? + ` +
+ + ${reply.cat_select} +
+ ` : ''} +
+ + + + + +
+ +
+ + +
+ `, show_error: function (msg) { const elem = $("fadd_error_message"); @@ -114,7 +192,7 @@ const CommonDialogs = { } catch (e) { Element.hide("feed_add_spinner"); alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console.")); - console.log('quickAddFeed, backend returned:' + transport.responseText); + console.log('subscribeToFeed, backend returned:' + transport.responseText); return; } -- cgit v1.2.3