From 3f582e88c2a7bee5946b4fd962efcd650eff57be Mon Sep 17 00:00:00 2001 From: Ridhwana Date: Mon, 10 Jan 2022 16:10:57 +0200 Subject: [PATCH] Update the images section in preparation for Creator Setup and Onboarding Launch [Will deploy on 10/01] (#15989) * feat: add a section id to the images section * feat: update the images section * chore: add some space * chore: update the descriptiion text for logos --- app/lib/constants/settings/general.rb | 6 +- .../admin/settings/forms/_images.html.erb | 62 +++++++++---------- app/views/admin/shared/_logo_upload.html.erb | 8 ++- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/app/lib/constants/settings/general.rb b/app/lib/constants/settings/general.rb index 1d8c45ebe..7f195f201 100644 --- a/app/lib/constants/settings/general.rb +++ b/app/lib/constants/settings/general.rb @@ -36,11 +36,13 @@ module Constants placeholder: "a secure token" }, logo_png: { - description: "Used as a fallback to the SVG. Recommended minimum of 512x512px", + description: "Used as a secondary logo in places like the sign in modals, onboarding, apple touch icons. " \ + "Recommended minimum of 512x512px", placeholder: IMAGE_PLACEHOLDER }, logo_svg: { - description: "Used as the SVG logo of the community", + description: "This is the logo currently used on the upper left hand corner of your Forem. " \ + "However, after the release it will be deprecated in favor of the Logo above.", placeholder: SVG_PLACEHOLDER }, main_social_image: { diff --git a/app/views/admin/settings/forms/_images.html.erb b/app/views/admin/settings/forms/_images.html.erb index b373d2179..74709ceee 100644 --- a/app/views/admin/settings/forms/_images.html.erb +++ b/app/views/admin/settings/forms/_images.html.erb @@ -1,7 +1,7 @@ <%= form_for(Settings::General.new, url: admin_settings_general_settings_path, html: { data: { action: "submit->config#updateConfigurationSettings" } }) do |f| %> -
+
<%= render partial: "admin/shared/card_header", locals: { header: "Images", @@ -11,6 +11,36 @@ } %>
+ + <%= render partial: "admin/shared/logo_upload", locals: { f: f, allowed_types: logo_allowed_types, max_file_size: logo_max_file_size, logo: Settings::General.resized_logo } %> + +
+ <%= admin_config_label :logo_svg, "SVG logo (soon to be deprecated)" %> + <%= admin_config_description Constants::Settings::General::DETAILS[:logo_svg][:description] %> + <%= f.text_area :logo_svg, + class: "crayons-textfield", + value: Settings::General.logo_svg, + rows: 6, + placeholder: Constants::Settings::General::DETAILS[:logo_svg][:placeholder] %> + <% if Settings::General.logo_svg.present? %> + + <% end %> +
+ +
+ <%= admin_config_label :logo_png, "Secondary Logo" %> + <%= admin_config_description Constants::Settings::General::DETAILS[:logo_png][:description] %> + <%= f.text_field :logo_png, + class: "crayons-textfield", + value: Settings::General.logo_png, + placeholder: Constants::Settings::General::DETAILS[:logo_png][:placeholder] %> + <% if Settings::General.logo_png.present? %> + + <% end %> +
+
<%= admin_config_label :main_social_image %> <%= admin_config_description Constants::Settings::General::DETAILS[:main_social_image][:description] %> @@ -33,36 +63,6 @@ favicon
-
- <%= admin_config_label :logo_png %> - <%= admin_config_description Constants::Settings::General::DETAILS[:logo_png][:description] %> - <%= f.text_field :logo_png, - class: "crayons-textfield", - value: Settings::General.logo_png, - placeholder: Constants::Settings::General::DETAILS[:logo_png][:placeholder] %> - <% if Settings::General.logo_png.present? %> - - <% end %> -
- - <% if FeatureFlag.enabled?(:creator_onboarding) %> - <%= render partial: "admin/shared/logo_upload", locals: { f: f, allowed_types: logo_allowed_types, max_file_size: logo_max_file_size, logo: Settings::General.resized_logo } %> - <% else %> -
- <%= admin_config_label :logo_svg %> - <%= admin_config_description Constants::Settings::General::DETAILS[:logo_svg][:description] %> - <%= f.text_area :logo_svg, - class: "crayons-textfield", - value: Settings::General.logo_svg, - rows: 6, - placeholder: Constants::Settings::General::DETAILS[:logo_svg][:placeholder] %> - <% if Settings::General.logo_svg.present? %> - - <% end %> -
- <% end %>
<%= render "update_setting_button", f: f, aria_label: "Update image settings" %>
diff --git a/app/views/admin/shared/_logo_upload.html.erb b/app/views/admin/shared/_logo_upload.html.erb index 62e4fe5a7..ef299f029 100644 --- a/app/views/admin/shared/_logo_upload.html.erb +++ b/app/views/admin/shared/_logo_upload.html.erb @@ -2,7 +2,13 @@ <%= f.label :logo, class: "crayons-field__label" do %> Logo <% end %> -

Your logo will display in the upper left hand corner of your Forem. Upload a PNG or JPEG with a maximum size of 4096x4096px.

+ + <% if FeatureFlag.enabled?(:creator_onboarding) %> +

Your logo will display in the upper left hand corner of your Forem. Upload a PNG or JPEG with a maximum size of 4096x4096px.

+ <% else %> +

You can adjust what your logo will look like here but it will not be live on the visitor facing site until after the release on 17 January. Upload a PNG or JPEG with a maximum size of 4096x4096px.

+ <% end %> +
<%= f.file_field :logo, accept: allowed_types.to_s, aria_describedby: "logo-subtitle", data: { "max-file-size-mb": max_file_size.to_s, action: "change->logo-upload#previewLogo" } %>