User contributions for Admin

Jump to: navigation, search
Search for contributionsExpandCollapse
⧼contribs-top⧽
⧼contribs-date⧽
(newest | oldest) View (newer 50 | ) (20 | 50 | 100 | 250 | 500)

29 January 2026

  • 00:1400:14, 29 January 2026 diff hist +10,512 Live view and handle infoNo edit summary current
  • 00:1100:11, 29 January 2026 diff hist +5,138 N Live view and handle infoCreated page with "= Phoenix LiveView handle_info Guide for Web Developers = == What is handle_info? == handle_info is Phoenix LiveView's way of handling messages sent to the LiveView process from outside normal user interactions (like clicks). It's your LiveView's inbox for asynchronous events. In traditional web development, everything is request-response: user clicks, server responds, done. But LiveView processes are long-running and can receive messages from other parts of your syst..."

28 November 2025

1 September 2025

31 August 2025

29 August 2025

31 July 2025

  • 14:5814:58, 31 July 2025 diff hist +1,302 N Liveview Text Search and Highlight Example AppCreated page with "<source> # lib/my_app_web/live/json_search_live.ex defmodule AppWeb.SandboxLive do use AppWeb, :live_view def mount(_params, _session, socket) do {:ok, assign(socket, text: "Hello world! This is a test. Hello again!", search: "")} end def handle_event("search_change", %{"value" => search}, socket) do {:noreply, assign(socket, search: search)} end def handle_event("text_change", %{"value" => text}, socket) do {:noreply, assign(socket, text: text..." current

16 July 2025

25 June 2025

10 May 2025

  • 07:0007:00, 10 May 2025 diff hist +720 N LiveView Web API Request ExampleCreated page with "<source> defmodule AppWeb.Sandbox do use AppWeb, :live_view def mount(_params, _session, socket) do {:ok, socket} end def handle_event("start_task", _params, socket) do Task.async(fn -> Req.get!("https://api.github.com/repos/wojtekmach/req") end) {:noreply, socket} end def handle_info({ref, result}, socket) do Process.demonitor(ref, [:flush]) IO.inspect"________________________________________________________________________________"..." current
  • 05:1505:15, 10 May 2025 diff hist +793 N Phoenix Handle Info Self ExampleCreated page with "<source> defmodule AppWeb.Sandbox do use AppWeb, :live_view require Logger def mount(_params, _session, socket) do {:ok, assign(socket, :count, 0)} end def handle_event("increment", _params, socket) do # Send a message to ourselves after 1000 milliseconds (1 second) Process.send_after(self(), :delayed_increment, 1000) {:noreply, socket} end def handle_info(:delayed_increment, socket) do new_count = socket.assigns.count + 1 Logger...." current

17 April 2025

  • 20:1720:17, 17 April 2025 diff hist +24 Sort Collection Via Event HandlerNo edit summary current
  • 19:5519:55, 17 April 2025 diff hist +1,388 N Sort Collection Via Event HandlerCreated page with "<source> defmodule AppWeb.SandboxLive do use AppWeb, :live_view alias App.TestBeds alias App.TestBeds.TestBed alias App.Repo import Ecto.Query def mount(_params, _session, socket) do testbeds = Repo.all(from(t in TestBed, order_by: t.name)) {:ok, assign(socket, testbeds: testbeds, sort_by: :name, sort_direction: :asc)} end def handle_event("toggle_sort_by_name", _params, socket) do current_direction = socket.assigns.sort_direction new_..."

16 April 2025

  • 15:2415:24, 16 April 2025 diff hist +884 N Live View Store Data in URL ParamsCreated page with "<source> defmodule AppWeb.PageLive do use AppWeb, :live_view def mount(_params, _session, socket) do {:ok, socket} end def handle_params(params, _uri, socket) do count = String.to_integer(params["count"] || "0") {:noreply, assign(socket, count: count)} end def handle_event("increment", _, socket) do new_count = socket.assigns.count + 1 # Use ~p instead of Routes {:noreply, push_patch(socket, to: ~p"/?count=#{new_count}")} end d..." current

8 April 2025

2 April 2025

23 March 2025

22 March 2025

19 March 2025

13 March 2025

12 March 2025

11 March 2025

20 February 2025

29 December 2024

27 December 2024

  • 09:2109:21, 27 December 2024 diff hist +419 N How to Think About Phoenix Dead ViewsCreated page with "Each page (resource) has a route. These routes are assigned a controller and a function from that controller. In the code below, when a user goes to the "/" route a controller named PageController is found and a function named home is invoked. Controllers are simply modules and the third argument (in this case named '''home''') is a function on the controller. <source> get "/", PageController, :home </source>" current
  • 09:1209:12, 27 December 2024 diff hist +39 Phoenix Flash MessageNo edit summary current
  • 09:1209:12, 27 December 2024 diff hist +8 Phoenix Flash MessageNo edit summary
  • 09:1109:11, 27 December 2024 diff hist +625 N Phoenix Flash MessageCreated page with "In Phoenix the flash message is invoked from the controller. <source> def create(conn, %{"doink" => doink_params}) do case Doinks.create_doink(doink_params) do {:ok, doink} -> conn |> put_flash(:info, "Doink created successfully.") |> redirect(to: ~p"/doinks/#{doink}") {:error, %Ecto.Changeset{} = changeset} -> render(conn, :new, changeset: changeset) end end </source> The message itself needs to be in the view..."

24 December 2024

23 December 2024

8 December 2024

29 November 2024

(newest | oldest) View (newer 50 | ) (20 | 50 | 100 | 250 | 500)