From c46e41b7c377a96d77ec95948b7a4d8333daa275 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 11 Jul 2011 06:13:48 +0200 Subject: [PATCH] Make option to enable Sone insert notifications editable. This resolves #212. --- src/main/java/net/pterodactylus/sone/web/OptionsPage.java | 3 +++ src/main/resources/i18n/sone.en.properties | 1 + src/main/resources/templates/options.html | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 15bf93d..fda6afd 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -64,6 +64,8 @@ public class OptionsPage extends SoneTemplatePage { if (currentSone != null) { boolean autoFollow = request.getHttpRequest().isPartSet("auto-follow"); currentSone.getOptions().getBooleanOption("AutoFollow").set(autoFollow); + boolean enableSoneInsertNotifications = request.getHttpRequest().isPartSet("enable-sone-insert-notifications"); + currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").set(enableSoneInsertNotifications); webInterface.getCore().touchConfiguration(); } Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16)); @@ -120,6 +122,7 @@ public class OptionsPage extends SoneTemplatePage { } if (currentSone != null) { templateContext.set("auto-follow", currentSone.getOptions().getBooleanOption("AutoFollow").get()); + templateContext.set("enable-sone-insert-notifications", currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()); } templateContext.set("insertion-delay", preferences.getInsertionDelay()); templateContext.set("posts-per-page", preferences.getPostsPerPage()); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index 43bff42..5817166 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -37,6 +37,7 @@ Page.Options.Section.SoneSpecificOptions.Title=Sone-specific Options Page.Options.Section.SoneSpecificOptions.NotLoggedIn=These options are only available if you are {link}logged in{/link}. Page.Options.Section.SoneSpecificOptions.LoggedIn=These options are only available while you are logged in and they are only valid for the Sone you are logged in as. Page.Options.Option.AutoFollow.Description=If a new Sone is discovered, follow it automatically. Note that this will only follow Sones that are discovered after you activate this option! +Page.Options.Option.EnableSoneInsertNotifications.Description=If enabled, this will display notifications every time your Sone is being inserted or finishes inserting. Page.Options.Section.RuntimeOptions.Title=Runtime Behaviour Page.Options.Option.InsertionDelay.Description=The number of seconds the Sone inserter waits after a modification of a Sone before it is being inserted. Page.Options.Option.PostsPerPage.Description=The number of posts to display on a page before pagination controls are being shown. diff --git a/src/main/resources/templates/options.html b/src/main/resources/templates/options.html index cd1ff2f..39d579f 100644 --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@ -43,6 +43,11 @@ <%= Page.Options.Option.AutoFollow.Description|l10n|html>

+

+ disabled="disabled"<%/if><%if enable-sone-insert-notifications> checked="checked"<%/if> /> + <%= Page.Options.Option.EnableSoneInsertNotifications.Description|l10n|html> +

+

<%= Page.Options.Section.RuntimeOptions.Title|l10n|html>

<%= Page.Options.Option.InsertionDelay.Description|l10n|html>

-- 2.7.4