Skip to content

Commit 195ec3a

Browse files
committed
add url to tip form
1 parent 78b58cc commit 195ec3a

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

lib/algora_web/components/ui/drawer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ defmodule AlgoraWeb.Components.UI.Drawer do
114114

115115
def drawer_content(assigns) do
116116
~H"""
117-
<div class={classes(["overflow-y-auto px-1 -mx-1", @class])} {@rest}>
117+
<div class={classes(["overflow-y-auto scrollbar-thin px-1 -mx-1", @class])} {@rest}>
118118
{render_slot(@inner_block)}
119119
</div>
120120
"""

lib/algora_web/forms/tip_form.ex

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ defmodule AlgoraWeb.Forms.TipForm do
88
alias Algora.Validations
99

1010
embedded_schema do
11+
field :url, :string
1112
field :github_handle, :string
1213
field :amount, USD
14+
15+
embeds_one :ticket_ref, TicketRef, primary_key: false do
16+
field :owner, :string
17+
field :repo, :string
18+
field :number, :integer
19+
field :type, :string
20+
end
1321
end
1422

1523
def changeset(form, attrs \\ %{}) do
1624
form
17-
|> cast(attrs, [:github_handle, :amount])
18-
|> validate_required([:github_handle, :amount])
25+
|> cast(attrs, [:url, :github_handle, :amount])
26+
|> validate_required([:url, :github_handle, :amount])
1927
|> Validations.validate_money_positive(:amount)
28+
|> Validations.validate_ticket_ref(:url, :ticket_ref)
2029
end
2130
end

lib/algora_web/live/home_live.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ defmodule AlgoraWeb.HomeLive do
4444
|> assign(:stats, stats)
4545
|> assign(:faq_items, get_faq_items())
4646
|> assign(:bounty_form, to_form(BountyForm.changeset(%BountyForm{}, %{})))
47+
# TODO: add url
4748
|> assign(:tip_form, to_form(TipForm.changeset(%TipForm{}, %{})))
4849
|> assign(:pending_action, nil)}
4950
end

lib/algora_web/live/org/dashboard_live.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,9 +1231,9 @@ defmodule AlgoraWeb.Org.DashboardLive do
12311231
<.input label="Amount" icon="tabler-currency-dollar" field={@tip_form[:amount]} />
12321232
<.input
12331233
label="URL"
1234-
field={@bounty_form[:url]}
1234+
field={@tip_form[:url]}
12351235
placeholder="https://github.com/owner/repo/issues/123"
1236-
helptext="We'll add a comment to the issue with your tip to notify the developer."
1236+
helptext="We'll add a comment to the issue to notify the developer."
12371237
/>
12381238
<.input
12391239
label="Message (optional)"

lib/algora_web/live/swift_bounties_live.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ defmodule AlgoraWeb.SwiftBountiesLive do
590590
end
591591

592592
def handle_event("create_tip" = event, %{"tip_form" => params} = unsigned_params, socket) do
593+
# TODO: add url
593594
changeset =
594595
%TipForm{}
595596
|> TipForm.changeset(params)

0 commit comments

Comments
 (0)