diff --git a/app/forms/decidim/decidim_awesome/admin/intergram_form.rb b/app/forms/decidim/decidim_awesome/admin/intergram_form.rb index 3eced5994..310b642c8 100644 --- a/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +++ b/app/forms/decidim/decidim_awesome/admin/intergram_form.rb @@ -13,6 +13,10 @@ class IntergramForm < Decidim::Form attribute :intro_message, String attribute :auto_response, String attribute :auto_no_response, String + + def color + super || current_organization.colors["secondary"] || "#E91E63" + end end end end diff --git a/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss b/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss new file mode 100644 index 000000000..9bc753397 --- /dev/null +++ b/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss @@ -0,0 +1,11 @@ +#intergramRoot { + bottom: 3.5rem; + right: -0.5rem; + position: fixed; + z-index: 1000; + width: 100%; + + > div { + position: absolute !important; + } +} diff --git a/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss b/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss index 30db90525..8f879e0db 100644 --- a/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +++ b/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss @@ -1,2 +1,3 @@ @import "stylesheets/decidim/decidim_awesome/shared/spinner"; +@import "stylesheets/decidim/decidim_awesome/admin/intergram_fixes"; @import "stylesheets/decidim/decidim_awesome/forms/custom_fields"; diff --git a/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb b/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb index 80691ee0c..bc9491e61 100644 --- a/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +++ b/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb @@ -18,7 +18,7 @@ <%= f.check_box :require_login, label: t("intergram_require_login", scope: "activemodel.attributes.config") %> <%= f.check_box :use_floating_button, class: "mb-4", label: t("intergram_use_floating_button", scope: "activemodel.attributes.config"), label_options: { class: "block" } %> - <%= f.color_field :color, value: f.object.color || "#E91E63", class: "mb-4 block w-full p-1", label: t("intergram_color", scope: "activemodel.attributes.config") %> + <%= f.color_field :color, class: "mb-4 block w-full p-1", label: t("intergram_color", scope: "activemodel.attributes.config") %> <%= f.text_field :title_open, class: "mb-4", label: t("intergram_title_open", scope: "activemodel.attributes.config"), placeholder: t("decidim.decidim_awesome.config.intergram.title_open") %> <%= f.text_field :title_closed, class: "mb-4", label: t("intergram_title_closed", scope: "activemodel.attributes.config"), placeholder: t("decidim.decidim_awesome.config.intergram.title_closed") %> @@ -48,7 +48,7 @@ <%= f.check_box :use_floating_button, class: "mb-4", label: t("intergram_use_floating_button", scope: "activemodel.attributes.config") %> - <%= f.color_field :color, value: f.object.color || "#E91E63", class: "mb-4 block w-full p-1", label: t("intergram_color", scope: "activemodel.attributes.config") %> + <%= f.color_field :color, class: "mb-4 block w-full p-1", label: t("intergram_color", scope: "activemodel.attributes.config") %> <%= f.text_field :title_open, class: "mb-4", label: t("intergram_title_open", scope: "activemodel.attributes.config"), placeholder: t("decidim.decidim_awesome.config.intergram.title_open") %> <%= f.text_field :title_closed, class: "mb-4", label: t("intergram_title_closed", scope: "activemodel.attributes.config"), placeholder: t("decidim.decidim_awesome.config.intergram.title_closed") %> diff --git a/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb b/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb index c89f61dbd..09b57f49f 100644 --- a/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +++ b/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb @@ -9,7 +9,7 @@ introMessage: "<%= j (settings[:intro_message].presence || t("decidim.decidim_awesome.config.intergram.intro_message")).html_safe %>", autoResponse: "<%= j (settings[:auto_response].presence || t("decidim.decidim_awesome.config.intergram.auto_response")).html_safe %>", autoNoResponse: "<%= j (settings[:auto_no_response].presence || t("decidim.decidim_awesome.config.intergram.auto_no_response")).html_safe %>", - mainColor: "<%= j (settings[:color].presence || "#E91E63").html_safe %>", + mainColor: "<%= j (settings[:color].presence || (current_organization.colors && current_organization.colors["primary"]) || "#E91E63").html_safe %>", alwaysUseFloatingButton: <%= settings[:use_floating_button] ? "true" : "false" %> // Use the mobile floating button also on large screens };