pinchflat/lib/pinchflat_web/controllers/settings/setting_controller.ex
Kieran 8a0ae89bc0
[Enhancement] Add Apprise support (#170)
* [WIP] add settings sidebar entry and placeholder page

* [WIP] added placeholder UI and logic for settings form

* Added column and UI for apprise server

* Add some tests

* Added placeholder command runner for apprise

* [WIP] Adding apprise package

* Added apprise command runner

* Hooked up apprise notification module

* Ensured apprise was running in verbose mode

* Updated wording of apprise notification

* Added apprise to README
2024-04-09 09:45:39 -07:00

26 lines
688 B
Elixir

defmodule PinchflatWeb.Settings.SettingController do
use PinchflatWeb, :controller
alias Pinchflat.Settings
def show(conn, _params) do
setting = Settings.record()
changeset = Settings.change_setting(setting)
render(conn, "show.html", changeset: changeset)
end
def update(conn, %{"setting" => setting_params}) do
setting = Settings.record()
case Settings.update_setting(setting, setting_params) do
{:ok, _} ->
conn
|> put_flash(:info, "Settings updated successfully.")
|> redirect(to: ~p"/settings")
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "show.html", changeset: changeset)
end
end
end