Skip to content

Commit afdf79b

Browse files
committed
Hide forms initially
1 parent 0a769b0 commit afdf79b

File tree

1 file changed

+59
-52
lines changed

1 file changed

+59
-52
lines changed

lib/ex_rss_web/feed_live/index.html.heex

+59-52
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,68 @@
1-
<h1 class="text-m">Discover feeds on a site</h1>
2-
3-
<.form for={@form} class="flex flex-row space-x-6" phx-submit="discover_feeds">
4-
<div class="grow">
5-
<.input type="url" field={@form[:feed_url]} label="Address to discover feeds on" />
1+
<div id="add-feeds-forms" class="border rounded-md p-4">
2+
<div class="flex">
3+
<h1 class="text-m">Discover feeds on a site</h1>
4+
<a class="ml-auto" phx-click={JS.show(to: "#add-feeds-forms")}>Open</a>
65
</div>
76

8-
<button class="self-end px-4 py-2 text-sm font-extrabold bg-blue-700 text-white">
9-
Discover
10-
</button>
11-
</.form>
7+
<div id="add-feeds-forms" class="hidden">
8+
<.form for={@form} class="flex flex-row space-x-6" phx-submit="discover_feeds">
9+
<div class="grow">
10+
<.input type="url" field={@form[:feed_url]} label="Address to discover feeds on" />
11+
</div>
1212

13-
<p>
14-
Enter the address of a site that contains one or more feeds. Make sure it starts with
15-
<code>http://</code>
16-
or <code>https://</code>.
17-
</p>
13+
<button class="self-end px-4 py-2 text-sm font-extrabold bg-blue-700 text-white">
14+
Discover
15+
</button>
16+
</.form>
1817

19-
<h1 class="text-m">Add feed by address</h1>
18+
<p>
19+
Enter the address of a site that contains one or more feeds. Make sure it starts with
20+
<code>http://</code>
21+
or <code>https://</code>.
22+
</p>
2023

21-
<form method="GET" action="/feeds/new/" class="flex flex-row space-x-6">
22-
<div class="grow">
23-
<.input type="url" name="url" value="" label="Address of the feed" />
24-
</div>
24+
<h1 class="text-m">Add feed by address</h1>
2525

26-
<input
27-
class="self-end px-4 py-2 text-sm font-extrabold bg-blue-700 text-white"
28-
type="submit"
29-
value="Discover"
30-
/>
31-
</form>
32-
33-
<p>
34-
Enter the address of an RSS or Atom feed. Make sure it starts with <code>http://</code>
35-
or <code>https://</code>.
36-
</p>
37-
38-
<%= if length(@discovered_feeds) > 0 do %>
39-
<h1 class="text-m">These feeds can be added</h1>
40-
41-
<ul class="mb-2">
42-
<li :for={discovered_feed <- @discovered_feeds}>
43-
{discovered_feed.title || "<this feed comes without a title>"}
44-
<small class="inline-block ml-6">{format_frequency(discovered_feed.frequency)}</small>
45-
<p><code>{discovered_feed.url}</code></p>
46-
47-
<button
48-
class="px-4 py-2 text-sm font-extrabold bg-blue-700 text-white"
49-
type="button"
50-
phx-click="add_feed"
51-
phx-value-title={discovered_feed.title}
52-
phx-value-url={discovered_feed.url}
53-
>
54-
Add
55-
</button>
56-
</li>
57-
</ul>
58-
<% end %>
26+
<form method="GET" action="/feeds/new/" class="flex flex-row space-x-6">
27+
<div class="grow">
28+
<.input type="url" name="url" value="" label="Address of the feed" />
29+
</div>
30+
31+
<input
32+
class="self-end px-4 py-2 text-sm font-extrabold bg-blue-700 text-white"
33+
type="submit"
34+
value="Discover"
35+
/>
36+
</form>
37+
38+
<p>
39+
Enter the address of an RSS or Atom feed. Make sure it starts with <code>http://</code>
40+
or <code>https://</code>.
41+
</p>
42+
43+
<%= if length(@discovered_feeds) > 0 do %>
44+
<h1 class="text-m">These feeds can be added</h1>
45+
46+
<ul class="mb-2">
47+
<li :for={discovered_feed <- @discovered_feeds}>
48+
{discovered_feed.title || "<this feed comes without a title>"}
49+
<small class="inline-block ml-6">{format_frequency(discovered_feed.frequency)}</small>
50+
<p><code>{discovered_feed.url}</code></p>
51+
52+
<button
53+
class="px-4 py-2 text-sm font-extrabold bg-blue-700 text-white"
54+
type="button"
55+
phx-click="add_feed"
56+
phx-value-title={discovered_feed.title}
57+
phx-value-url={discovered_feed.url}
58+
>
59+
Add
60+
</button>
61+
</li>
62+
</ul>
63+
<% end %>
64+
</div>
65+
</div>
5966

6067
<ul class="flex space-x-2 my-2">
6168
<li>

0 commit comments

Comments
 (0)