From f9b75d5c10e383b391ea7a0ecef64fabfb654ff2 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 11 Jan 2026 22:51:52 +0300 Subject: [PATCH 01/12] added JSPath & CSSPath site settings & handling --- app/views/layouts/_head.html.erb | 15 ++++++++++++--- db/seeds/site_settings.yml | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 13c20f521..591fa2b80 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -11,7 +11,12 @@ <%= page_title %> -<% icon_path = SiteSetting['IconPath'] %> +<% + css_path = SiteSetting['CSSPath'] + icon_path = SiteSetting['IconPath'] + js_path = SiteSetting['JSPath'] +%> + <%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/@codidact/co-design@latest/dist/codidact.css" %> <%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/select2@4.0.12/dist/css/select2.min.css" %> -<%= stylesheet_link_tag "/assets/community/#{@community.host.split('.')[0]}.css" %> +<% if css_path.present? %> + <%= stylesheet_link_tag css_path %> +<% end %> <%= stylesheet_link_tag 'application', media: 'all' %> <%= javascript_include_tag "https://cdn.jsdelivr.net/npm/jquery@2.2.2/dist/jquery.min.js" %> @@ -33,7 +40,9 @@ <%= javascript_include_tag "https://js.stripe.com/v3/" %> <% end %> <%= javascript_include_tag "https://cdn.jsdelivr.net/npm/dompurify@2.5.8/dist/purify.min.js" %> -<%= javascript_include_tag "/assets/community/#{@community.host.split('.')[0]}.js" %> +<% if js_path.present? %> + <%= javascript_include_tag js_path %> +<% end %> <%= javascript_include_tag 'application' %> diff --git a/db/seeds/site_settings.yml b/db/seeds/site_settings.yml index 919d6233f..08290c2d9 100644 --- a/db/seeds/site_settings.yml +++ b/db/seeds/site_settings.yml @@ -358,6 +358,20 @@ description: > Path to a file to use as the site's favicon. Must be an .ICO file. +- name: JSPath + value: ~ + value_type: string + category: SiteDetails + description: > + Path to a file containing site-specific JavaScript. + +- name: CSSPath + value: ~ + value_type: string + category: SiteDetails + description: > + Path to a file containing site-specific CSS. + - name: AllowContentTransfer value: true value_type: boolean From 54dd4f98f016b23a52c4de3b71f660fd632cb5aa Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Mon, 12 Jan 2026 01:21:09 +0300 Subject: [PATCH 02/12] added new site setting type that only works with URI paths --- app/assets/javascripts/site_settings.js | 1 + app/models/site_setting.rb | 2 +- db/seeds/site_settings.yml | 6 ++++-- lib/setting_converter.rb | 7 +++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/site_settings.js b/app/assets/javascripts/site_settings.js index 59d0f4f39..1d347db55 100644 --- a/app/assets/javascripts/site_settings.js +++ b/app/assets/javascripts/site_settings.js @@ -5,6 +5,7 @@ $(() => { const settingEditFields = { 'array': $(``), 'string': $(``), + 'uri_path': $(``), 'integer': $(''), 'float': $(''), 'boolean': $(`