From: David ‘Bombe’ Roden Date: Wed, 7 Dec 2011 15:08:01 +0000 (+0100) Subject: Make “show custom avatars” option configurable. X-Git-Tag: 0.7.6^2~1^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=cfeeeff33dc9c4b505df8aa009ed6f203d34d1a5;p=Sone.git Make “show custom avatars” option configurable. --- diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 49b1275..1847b9c 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -22,6 +22,7 @@ import java.util.List; import net.pterodactylus.sone.core.Core.Preferences; import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.data.Sone.ShowCustomAvatars; import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.number.Numbers; @@ -73,6 +74,8 @@ public class OptionsPage extends SoneTemplatePage { currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").set(showNotificationNewPosts); boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies"); currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").set(showNotificationNewReplies); + String showCustomAvatars = request.getHttpRequest().getPartAsStringFailsafe("show-custom-avatars", 32); + currentSone.getOptions(). getEnumOption("ShowCustomAvatars").set(ShowCustomAvatars.valueOf(showCustomAvatars)); webInterface.getCore().touchConfiguration(); } Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16)); @@ -139,6 +142,7 @@ public class OptionsPage extends SoneTemplatePage { templateContext.set("show-notification-new-sones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get()); templateContext.set("show-notification-new-posts", currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").get()); templateContext.set("show-notification-new-replies", currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").get()); + templateContext.set("show-custom-avatars", currentSone.getOptions(). getEnumOption("ShowCustomAvatars").get().name()); } 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 845327e..c3c1bc1 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -44,7 +44,12 @@ Page.Options.Option.ShowNotificationNewSones.Description=Show notifications for Page.Options.Option.ShowNotificationNewPosts.Description=Show notifications for new posts. Page.Options.Option.ShowNotificationNewReplies.Description=Show notifications for new replies. Page.Options.Section.AvatarOptions.Title=Avatar Options - +Page.Options.Option.ShowAvatars.Description=You can disable custom avatars here, depending on the selected criteria. If an avatar is disabled for a Sone, the automatically generated avatar is shown instead. +Page.Options.Option.ShowAvatars.Never.Description=Never show custom avatars. +Page.Options.Option.ShowAvatars.Followed.Description=Only show avatars for Sones that you follow. +Page.Options.Option.ShowAvatars.ManuallyTrusted.Description=Only show avatars for Sones that you have manually assigned a trust value larger than 0 to. +Page.Options.Option.ShowAvatars.Trusted.Description=Only show avatars for Sones that have a trust value larger than 0. +Page.Options.Option.ShowAvatars.Always.Description=Always show custom avatars. Be warned: some avatars might contain disturbing or offensive imagery. 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/static/css/sone.css b/src/main/resources/static/css/sone.css index d065f78..7754528 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -862,3 +862,11 @@ textarea { #sone #avatar-selection li#no-avatar { display: block; } + +#sone form#options ul { + padding-left: 1em; +} + +#sone form#options li { + list-style-type: none; +} diff --git a/src/main/resources/templates/options.html b/src/main/resources/templates/options.html index 86c1388..94e01dc 100644 --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@ -66,8 +66,32 @@ <%= Page.Options.Option.ShowNotificationNewReplies.Description|l10n|html>

- <%ifnull !currentSone> - <%/if> +

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

+ +

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

+ +
    +
  • + checked="checked"<%/if>/> + <%=Page.Options.Option.ShowAvatars.Never.Description|l10n|html> +
  • +
  • + checked="checked"<%/if>/> + <%=Page.Options.Option.ShowAvatars.Followed.Description|l10n|html> +
  • +
  • + checked="checked"<%/if>/> + <%=Page.Options.Option.ShowAvatars.ManuallyTrusted.Description|l10n|html> +
  • +
  • + checked="checked"<%/if>/> + <%=Page.Options.Option.ShowAvatars.Trusted.Description|l10n|html> +
  • +
  • + checked="checked"<%/if>/> + <%=Page.Options.Option.ShowAvatars.Always.Description|l10n|html> +
  • +

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