neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
Log in to mark this repository.
fix all the forms.
c5c5fce · gmorell · 2023-06-15 05:31
Files changed
modified
apps/room_sanctum/lib/room_sanctum_web/components/core_components.ex
+22
−19
| 72 | 72 | <button |
| 73 | 73 | phx-click={JS.exec("data-cancel", to: "##{@id}")} |
| 74 | 74 | type="button" |
| 75 | − class="-m-3 flex-none p-3 opacity-20 hover:opacity-40" | |
| 75 | + class="-m-3 flex-none p-3 px-12 pt-8 opacity-20 hover:opacity-40" | |
| 76 | 76 | aria-label={gettext("close")} |
| 77 | 77 | > |
| 78 | − <.icon name="hero-x-mark-solid" class="h-5 w-5" /> | |
| 78 | + <i class="fa-solid fa-close fa-3x" /> | |
| 79 | 79 | </button> |
| 80 | 80 | </div> |
| 81 | 81 | <div id={"#{@id}-content"}> |
| 253 | 253 | attr :name, :any |
| 254 | 254 | attr :label, :string, default: nil |
| 255 | 255 | attr :value, :any |
| 256 | + | |
| 256 | 257 | attr :lb_a, :string |
| 257 | 258 | attr :lb_i, :string |
| 258 | 259 | attr :rb_a, :string |
| 259 | 260 | attr :rb_i, :string |
| 261 | + attr :lb_tgt, :string | |
| 262 | + attr :rb_tgt, :string | |
| 260 | 263 | |
| 261 | 264 | attr :type, :string, |
| 262 | 265 | default: "text", |
| 318 | 321 | <select |
| 319 | 322 | id={@id} |
| 320 | 323 | name={@name} |
| 321 | − class="mt-2 block w-full rounded-md border border-gray-300 bg-primary text-primary-content shadow-sm focus:border-accent focus:ring-0 sm:text-sm" | |
| 324 | + class="mt-2 block w-full rounded-md border border-gray-300 bg-base-100 text-base-100-content shadow-sm focus:border-accent focus:ring-0 sm:text-sm" | |
| 322 | 325 | multiple={@multiple} |
| 323 | 326 | {@rest} |
| 324 | 327 | > |
| 338 | 341 | id={@id} |
| 339 | 342 | name={@name} |
| 340 | 343 | class={[ |
| 341 | − "mt-2 block w-full rounded-lg bg-primary text-primary-content focus:ring-0 sm:text-sm sm:leading-6", | |
| 344 | + "mt-2 block w-full rounded-lg bg-base-100 text-base-100-content focus:ring-0 sm:text-sm sm:leading-6", | |
| 342 | 345 | "min-h-[6rem] phx-no-feedback:border-zinc-300 phx-no-feedback:focus:border-zinc-400", |
| 343 | 346 | @errors == [] && "border-zinc-300 focus:border-zinc-400", |
| 344 | 347 | @errors != [] && "border-rose-400 focus:border-rose-400" |
| 350 | 353 | """ |
| 351 | 354 | end |
| 352 | 355 | |
| 353 | − def input(%{lb_a: action, lb_i: icon} = assigns) do | |
| 356 | + def input(%{lb_a: action, lb_i: icon, lb_tgt: tgt} = assigns) do | |
| 354 | 357 | ~H""" |
| 355 | 358 | <div phx-feedback-for={@name}> |
| 356 | 359 | <.label for={@id}><%= @label %></.label> |
| 357 | − <div class="input-group"> | |
| 358 | − <btn class="btn btn-accent" phx-click="{@action}" phx-target={@myself}> | |
| 359 | − <i class="fa-solid {@icon}"></i> | |
| 360 | − </btn> | |
| 360 | + <div class="input-group input-group-md"> | |
| 361 | + <btn class="btn btn-accent btn-square" phx-click={action} phx-target={tgt}> | |
| 362 | + <i class={"fa-solid #{icon}"}></i> | |
| 363 | + </btn> | |
| 361 | 364 | <input |
| 362 | 365 | type={@type} |
| 363 | 366 | name={@name} |
| 364 | 367 | id={@id} |
| 365 | 368 | value={Phoenix.HTML.Form.normalize_value(@type, @value)} |
| 366 | 369 | class={[ |
| 367 | − "mt-2 block w-full rounded-lg text-zinc-900 focus:ring-0 sm:text-sm sm:leading-6", | |
| 370 | + "block w-full rounded-lg bg-base-100 text-base-100-content focus:ring-0 sm:text-sm sm:leading-6", | |
| 368 | 371 | "phx-no-feedback:border-zinc-300 phx-no-feedback:focus:border-zinc-400", |
| 369 | 372 | @errors == [] && "border-zinc-300 focus:border-zinc-400", |
| 370 | 373 | @errors != [] && "border-rose-400 focus:border-rose-400" |
| 377 | 380 | """ |
| 378 | 381 | end |
| 379 | 382 | |
| 380 | − def input(%{rb_a: action, rb_i: icon} = assigns) do | |
| 383 | + def input(%{rb_a: action, rb_i: icon, rb_tgt: tgt} = assigns) do | |
| 381 | 384 | ~H""" |
| 382 | 385 | <div phx-feedback-for={@name}> |
| 383 | 386 | <.label for={@id}><%= @label %></.label> |
| 395 | 398 | ]} |
| 396 | 399 | {@rest} |
| 397 | 400 | /> |
| 398 | − <btn class="btn btn-accent" phx-click="{@action}" phx-target={@myself}> | |
| 399 | − <i class="fa-solid {@icon}"></i> | |
| 401 | + <btn class="btn btn-accent" phx-click={action} phx-target={tgt}> | |
| 402 | + <i class="fa-solid #{icon}"></i> | |
| 400 | 403 | </btn> |
| 401 | 404 | </div> |
| 402 | 405 | <.error :for={msg <- @errors}><%= msg %></.error> |
| 404 | 407 | """ |
| 405 | 408 | end |
| 406 | 409 | |
| 407 | − def input(%{lb_a: actionl, lb_i: iconl, rb_a: actionr, rb_i: iconr} = assigns) do | |
| 410 | + def input(%{lb_a: actionl, lb_i: iconl, rb_a: actionr, rb_i: iconr, lb_tgt: tgt, rb_tgt: tgt2} = assigns) do | |
| 408 | 411 | ~H""" |
| 409 | 412 | <div phx-feedback-for={@name}> |
| 410 | 413 | <.label for={@id}><%= @label %></.label> |
| 411 | 414 | <div class="input-group"> |
| 412 | − <btn class="btn btn-accent" phx-click="{@actionl}" phx-target={@myself}> | |
| 413 | − <i class="fa-solid {@iconl}"></i> | |
| 415 | + <btn class="btn btn-accent" phx-click={actionl} phx-target={tgt}> | |
| 416 | + <i class="fa-solid #{iconl}"></i> | |
| 414 | 417 | </btn> |
| 415 | 418 | <input |
| 416 | 419 | type={@type} |
| 425 | 428 | ]} |
| 426 | 429 | {@rest} |
| 427 | 430 | /> |
| 428 | − <btn class="btn btn-accent" phx-click="{@actionr}" phx-target={@myself}> | |
| 429 | − <i class="fa-solid {@iconr}"></i> | |
| 431 | + <btn class="btn btn-accent" phx-click={actionr} phx-target={tgt2}> | |
| 432 | + <i class="fa-solid #{iconr}"></i> | |
| 430 | 433 | </btn> |
| 431 | 434 | </div> |
| 432 | 435 | <.error :for={msg <- @errors}><%= msg %></.error> |
| 465 | 468 | |
| 466 | 469 | def label(assigns) do |
| 467 | 470 | ~H""" |
| 468 | − <label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800"> | |
| 471 | + <label for={@for} class="block text-md font-bold leading-6 pt-4 text-primary-content"> | |
| 469 | 472 | <%= render_slot(@inner_block) %> |
| 470 | 473 | </label> |
| 471 | 474 | """ |
modified
apps/room_sanctum/lib/room_sanctum_web/live/aqi_reporting_area_live/show.html.heex
+1
−1
| 1 | 1 | <h1>Show Reporting area</h1> |
| 2 | 2 | |
| 3 | −<.modal :if={@live_action == :edit} id="aqi-reporting-area-modal" show on_cancel={JS.patch({Routes.reporting_area_show_path(@socket, :show, @reporting_area)})}> | |
| 3 | +<.modal :if={@live_action == :edit} id="aqi-reporting-area-modal" show on_cancel={JS.patch(Routes.reporting_area_show_path(@socket, :show, @reporting_area))}> | |
| 4 | 4 | <.live_component |
| 5 | 5 | module={RoomSanctumWeb.ReportingAreaLive.FormComponent} |
| 6 | 6 | id={@reporting_area.id} |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_ankyra/form_component.ex
+6
−6
| 35 | 35 | :ok, |
| 36 | 36 | socket |
| 37 | 37 | |> assign(assigns) |
| 38 | − |> assign(:changeset, changeset) | |
| 38 | + |> assign_form(changeset) | |
| 39 | 39 | } |
| 40 | 40 | end |
| 41 | 41 |
| 48 | 48 | |> Accounts.change_rabbit_user(ankyra_params) |
| 49 | 49 | |> Map.put(:action, :validate) |
| 50 | 50 | |
| 51 | − {:noreply, assign(socket, :changeset, changeset)} | |
| 51 | + {:noreply, assign_form(socket, changeset)} | |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | def handle_event("save", %{"rabbit_user" => ankyra_params}, socket) do |
| 70 | 70 | |
| 71 | 71 | def handle_event("generate-new-password", _params, socket) do |
| 72 | 72 | changeset = socket.assigns.changeset |> Ecto.Changeset.change(password: gen_pw()) |
| 73 | − {:noreply, assign(socket, :changeset, changeset)} | |
| 73 | + {:noreply, assign_form(socket, changeset)} | |
| 74 | 74 | end |
| 75 | 75 | |
| 76 | 76 | def handle_event("generate-new-topic", _params, socket) do |
| 77 | 77 | changeset = socket.assigns.changeset |> Ecto.Changeset.change(topic: gen_topic()) |
| 78 | − {:noreply, assign(socket, :changeset, changeset)} | |
| 78 | + {:noreply, assign_form(socket, changeset)} | |
| 79 | 79 | end |
| 80 | 80 | |
| 81 | 81 |
| 88 | 88 | :noreply, |
| 89 | 89 | socket |
| 90 | 90 | |> put_flash(:info, "Ankyra updated successfully") |
| 91 | − |> push_redirect(to: socket.assigns.return_to) | |
| 91 | + |> push_redirect(to: socket.assigns.patch) | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | {:error, %Ecto.Changeset{} = changeset} -> |
| 105 | 105 | :noreply, |
| 106 | 106 | socket |
| 107 | 107 | |> put_flash(:info, "Ankyra created successfully") |
| 108 | − |> push_redirect(to: socket.assigns.return_to) | |
| 108 | + |> push_redirect(to: socket.assigns.patch) | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | {:error, %Ecto.Changeset{} = changeset} -> |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_ankyra/show.html.heex
+1
−1
| 3 | 3 | |
| 4 | 4 | <h1 class="text-3xl font-bold text-accent mx-4 py-2">Ankyra Detail</h1> |
| 5 | 5 | |
| 6 | −<.modal :if={@live_action == :edit} id="amkyra-modal" show on_cancel={JS.patch({Routes.ankyra_show_path(@socket, :show, @ankyra)})}> | |
| 6 | +<.modal :if={@live_action == :edit} id="amkyra-modal" show on_cancel={JS.patch(Routes.ankyra_show_path(@socket, :show, @ankyra))}> | |
| 7 | 7 | <.live_component |
| 8 | 8 | module={RoomSanctumWeb.AnkyraLive.FormComponent} |
| 9 | 9 | id={@ankyra.id} |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/form_component.ex
+4
−4
| 23 | 23 | :ok, |
| 24 | 24 | socket |
| 25 | 25 | |> assign(assigns) |
| 26 | − |> assign(:changeset, changeset) | |
| 26 | + |> assign_form(changeset) | |
| 27 | 27 | } |
| 28 | 28 | end |
| 29 | 29 |
| 42 | 42 | |> Configuration.change_foci(foci_params) |
| 43 | 43 | |> Map.put(:action, :validate) |
| 44 | 44 | |
| 45 | − {:noreply, assign(socket, :changeset, changeset)} | |
| 45 | + {:noreply, assign_form(socket, changeset)} | |
| 46 | 46 | end |
| 47 | 47 | |
| 48 | 48 | def handle_event("save", %{"foci" => foci_params}, socket) do |
| 79 | 79 | :noreply, |
| 80 | 80 | socket |
| 81 | 81 | |> put_flash(:info, "Foci updated successfully") |
| 82 | − |> push_redirect(to: socket.assigns.return_to) | |
| 82 | + |> push_redirect(to: socket.assigns.patch) | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | {:error, %Ecto.Changeset{} = changeset} -> |
| 95 | 95 | :noreply, |
| 96 | 96 | socket |
| 97 | 97 | |> put_flash(:info, "Foci created successfully") |
| 98 | − |> push_redirect(to: socket.assigns.return_to) | |
| 98 | + |> push_redirect(to: socket.assigns.patch) | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | {:error, %Ecto.Changeset{} = changeset} -> |
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/form_component.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_foci_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/form_component.ex
+3
−2
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.html.heex
+96
−94
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/form_component.ex
+8
−6
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/form_component.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_vision_live/form_component.ex
+11
−10
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/cfg_vision_live/show.html.heex
+110
−108
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_alert_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_alert_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_station_info_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_station_info_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_station_status_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_station_status_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_sys_info_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gbfs_sys_info_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_agency_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_agency_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_calendar_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_calendar_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_direction_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_direction_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_route_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_route_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_stop_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_stop_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_stop_time_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_stop_time_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_trip_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/gtfs_trip_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/hourly_data_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/hourly_data_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/hourly_obs_data_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/hourly_obs_data_live/show.html.heex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/monitoring_site_live/form_component.ex
+1
−1
Click to load diff…
modified
apps/room_sanctum/lib/room_sanctum_web/live/monitoring_site_live/show.html.heex
+1
−1
Click to load diff…
Parents: 9c1f4a5