diff --git a/lib/compass_admin_web/live/configuration_live.ex b/lib/compass_admin_web/live/configuration_live.ex
index b89d69e..a4d4bc7 100644
--- a/lib/compass_admin_web/live/configuration_live.ex
+++ b/lib/compass_admin_web/live/configuration_live.ex
@@ -13,12 +13,16 @@ defmodule CompassAdminWeb.ConfigurationLive do
{:ok,
socket
|> assign(:logs, ["Welcome to use OSS Compass Admin Configurations.\n"])
+ |> assign(:hidden, false)
|> assign(:staged, false)
|> assign(:commit_message, "")
|> assign(:current_user, current_user)
|> assign(:changeset, to_form(%{}))}
else
- {:ok, put_flash(socket, :error, "You don't have permissions to access this page.")}
+ {:ok,
+ socket
+ |> assign(:hidden, true)
+ |> put_flash(:error, "You don't have permissions to access this page.")}
end
end
@@ -145,67 +149,69 @@ defmodule CompassAdminWeb.ConfigurationLive do
@impl true
def render(assigns) do
~H"""
- <.container max_width="full">
- <.h2><%= @title %>
-
-
-
- <.form :let={f} for={@changeset} phx-submit="stage" phx-change="validate">
- <.textarea
- id="editdata"
- form={f}
- field={:content}
- value={@content}
- phx-hook="EditorFormHook"
- class="hidden"
- />
-
- <.form_field_error form={f} field={:content} class="mt-1" />
-
-
- <%= if !@staged do %>
- <.button
- type="button"
- color="white"
- label="Reset"
- phx-click="reset"
- disabled={@content == @original_content}
- />
- <.button color="primary" label="Stage" disabled={@content == @original_content} />
- <% end %>
- <%= if @staged do %>
- <.form_field
- type="textarea"
- form={f}
- field={:commit_message}
- placeholder="Commit Message"
- />
- <.button type="button" color="white" label="Revert" phx-click="revert" />
- <.button
- type="button"
- color="primary"
- label="Commit"
- phx-click="commit"
- phx-disable-with="Committing..."
- disabled={@commit_message == ""}
- />
- <% end %>
-
-
-
- <.h4>Recent Logs
-
-
- <%= for log <- Enum.reverse(@logs) do %>
- - <%= log %>
- <% end %>
-
+ <%= if !@hidden do %>
+ <.container max_width="full">
+ <.h2><%= @title %>
+
+
+
+ <.form :let={f} for={@changeset} phx-submit="stage" phx-change="validate">
+ <.textarea
+ id="editdata"
+ form={f}
+ field={:content}
+ value={@content}
+ phx-hook="EditorFormHook"
+ class="hidden"
+ />
+
+ <.form_field_error form={f} field={:content} class="mt-1" />
+
+
+ <%= if !@staged do %>
+ <.button
+ type="button"
+ color="white"
+ label="Reset"
+ phx-click="reset"
+ disabled={@content == @original_content}
+ />
+ <.button color="primary" label="Stage" disabled={@content == @original_content} />
+ <% end %>
+ <%= if @staged do %>
+ <.form_field
+ type="textarea"
+ form={f}
+ field={:commit_message}
+ placeholder="Commit Message"
+ />
+ <.button type="button" color="white" label="Revert" phx-click="revert" />
+ <.button
+ type="button"
+ color="primary"
+ label="Commit"
+ phx-click="commit"
+ phx-disable-with="Committing..."
+ disabled={@commit_message == ""}
+ />
+ <% end %>
+
+
+
+ <.h4>Recent Logs
+
+
+ <%= for log <- Enum.reverse(@logs) do %>
+ - <%= log %>
+ <% end %>
+
+
-
-
-
-
+
+
+
+ <% end %>
"""
end