diff --git a/lib/plausible_web/controllers/site_controller.ex b/lib/plausible_web/controllers/site_controller.ex index 31cdabd57..709602606 100644 --- a/lib/plausible_web/controllers/site_controller.ex +++ b/lib/plausible_web/controllers/site_controller.ex @@ -92,6 +92,7 @@ defmodule PlausibleWeb.SiteController do def settings_general(conn, %{"website" => website}) do site = Sites.get_for_user!(conn.assigns[:current_user].id, website) + |> Repo.preload(:custom_domain) conn |> assign(:skip_plausible_tracking, true) @@ -168,15 +169,6 @@ defmodule PlausibleWeb.SiteController do |> render("settings_custom_domain.html", site: site, layout: {PlausibleWeb.LayoutView, "site_settings.html"}) end - def settings_snippet(conn, %{"website" => website}) do - site = Sites.get_for_user!(conn.assigns[:current_user].id, website) - |> Repo.preload(:custom_domain) - - conn - |> assign(:skip_plausible_tracking, true) - |> render("settings_snippet.html", site: site, layout: {PlausibleWeb.LayoutView, "site_settings.html"}) - end - def settings_danger_zone(conn, %{"website" => website}) do site = Sites.get_for_user!(conn.assigns[:current_user].id, website) diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.ex index c7f069545..ffe9f431e 100644 --- a/lib/plausible_web/router.ex +++ b/lib/plausible_web/router.ex @@ -151,7 +151,6 @@ defmodule PlausibleWeb.Router do get "/:website/settings/search-console", SiteController, :settings_search_console get "/:website/settings/email-reports", SiteController, :settings_email_reports get "/:website/settings/custom-domain", SiteController, :settings_custom_domain - get "/:website/settings/js-snippet", SiteController, :settings_snippet get "/:website/settings/danger-zone", SiteController, :settings_danger_zone get "/:website/goals/new", SiteController, :new_goal post "/:website/goals", SiteController, :create_goal diff --git a/lib/plausible_web/templates/layout/site_settings.html.eex b/lib/plausible_web/templates/layout/site_settings.html.eex index e4c7430d2..67d66898e 100644 --- a/lib/plausible_web/templates/layout/site_settings.html.eex +++ b/lib/plausible_web/templates/layout/site_settings.html.eex @@ -30,7 +30,6 @@ <%= render("_settings_tab.html", this_tab: "search-console", text: "Search Console", site: @site, conn: @conn) %> <%= render("_settings_tab.html", this_tab: "email-reports", text: "Email reports", site: @site, conn: @conn) %> <%= render("_settings_tab.html", this_tab: "custom-domain", text: "Custom domain", site: @site, conn: @conn) %> - <%= render("_settings_tab.html", this_tab: "js-snippet", text: "JS snippet", site: @site, conn: @conn) %> <%= render("_settings_tab.html", this_tab: "danger-zone", text: "Danger zone", site: @site, conn: @conn) %> diff --git a/lib/plausible_web/templates/site/settings_general.html.eex b/lib/plausible_web/templates/site/settings_general.html.eex index e0fe9c2f4..32282163d 100644 --- a/lib/plausible_web/templates/site/settings_general.html.eex +++ b/lib/plausible_web/templates/site/settings_general.html.eex @@ -10,8 +10,7 @@
-
- <%= label f, :domain, class: "block text-sm font-medium leading-5 text-gray-700" %> +
<%= label f, :domain, class: "block text-sm font-medium leading-5 text-gray-700" %> <%= text_input f, :domain, class: "mt-1 block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:max-w-xs sm:text-sm border-gray-300 rounded-md", disabled: "disabled" %>
@@ -28,3 +27,23 @@
<% end %> + +<%= form_for @conn, "/", [class: "shadow bg-white sm:rounded-md sm:overflow-hidden py-6 px-4 sm:p-6"], fn f -> %> +
+

Javascript snippet

+

Include this snippet in the <head> of your website.

+ + <%= link(to: "https://docs.plausible.io/plausible-script", target: "_blank") do %> + + <% end %> +
+ +
+
+ <%= textarea f, :domain, id: "snippet_code", class: "transition overflow-hidden bg-gray-100 appearance-none border border-transparent rounded w-full p-2 pr-6 text-gray-700 leading-normal appearance-none focus:outline-none focus:bg-white focus:border-gray-300 text-xs mt-2 resize-none", value: snippet(@site), rows: 2 %> + + + +
+
+<% end %> diff --git a/lib/plausible_web/templates/site/settings_snippet.html.eex b/lib/plausible_web/templates/site/settings_snippet.html.eex deleted file mode 100644 index a69d8e7c1..000000000 --- a/lib/plausible_web/templates/site/settings_snippet.html.eex +++ /dev/null @@ -1,19 +0,0 @@ -<%= form_for @conn, "/", [class: "shadow bg-white sm:rounded-md sm:overflow-hidden py-6 px-4 sm:p-6"], fn f -> %> -
-

Javascript snippet

-

Include this snippet in the <head> of your website.

- - <%= link(to: "https://docs.plausible.io/plausible-script", target: "_blank") do %> - - <% end %> -
- -
-
- <%= textarea f, :domain, id: "snippet_code", class: "transition overflow-hidden bg-gray-100 appearance-none border border-transparent rounded w-full p-2 pr-6 text-gray-700 leading-normal appearance-none focus:outline-none focus:bg-white focus:border-gray-300 text-xs mt-2 resize-none", value: snippet(@site), rows: 2 %> - - - -
-
-<% end %>