-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Saving person_email and fetching items according to auth info. #37
- Loading branch information
1 parent
782cc8a
commit d32c90d
Showing
7 changed files
with
154 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,127 @@ | ||
<div> | ||
<section class="todoapp"> | ||
<header class="header"> | ||
<h1>todos</h1> | ||
<%= if @editing.id do %> | ||
<.link href={~p"/items"} | ||
<%= if @loggedin do %> | ||
<section class="todoapp"> | ||
<header class="header"> | ||
<h1>todos</h1> | ||
<%= if @editing.id do %> | ||
<.link href={~p"/items"} | ||
method="get" | ||
class="new-todo"> | ||
Click here to create a new item! | ||
</.link> | ||
<% else %> | ||
<%= new(Map.put(assigns, :action, ~p"/items/new")) %> | ||
<% end %> | ||
</header> | ||
<section class="main" style="display: block;"> | ||
<input id="toggle-all" class="toggle-all" type="checkbox" /> | ||
<label for="toggle-all">Mark all as complete</label> | ||
<ul class="todo-list"> | ||
<%= for item <- filter(@items, @filter) do %> | ||
<li data-id={item.id} class={complete(item)}> | ||
<%= if item.status == 1 do %> | ||
<.link href={~p"/items/toggle/#{item.id}"} | ||
Click here to create a new item! | ||
</.link> | ||
<% else %> | ||
<%= new(Map.put(assigns, :action, ~p"/items/new")) %> | ||
<% end %> | ||
</header> | ||
<section class="main" style="display: block;"> | ||
<input id="toggle-all" class="toggle-all" type="checkbox" /> | ||
<label for="toggle-all">Mark all as complete</label> | ||
<ul class="todo-list"> | ||
<%= for item <- filter(@items, @filter) do %> | ||
<li data-id={item.id} class={complete(item)}> | ||
<%= if item.status == 1 do %> | ||
<.link href={~p"/items/toggle/#{item.id}"} | ||
class="toggle checked"> | ||
type="checkbox" | ||
</.link> | ||
<% else %> | ||
<.link href={~p"/items/toggle/#{item.id}"} | ||
type="checkbox" | ||
</.link> | ||
<% else %> | ||
<.link href={~p"/items/toggle/#{item.id}"} | ||
type="checkbox" | ||
class="toggle"> | ||
</.link> | ||
<% end %> | ||
<div class="view"> | ||
<%= if item.id == @editing.id do %> | ||
<%= edit( | ||
</.link> | ||
<% end %> | ||
<div class="view"> | ||
<%= if item.id == @editing.id do %> | ||
<%= edit( | ||
Map.put(assigns, :action, ~p"/items/#{item.id}/edit") | ||
|> Map.put(:item, item) | ||
) %> | ||
<% else %> | ||
<.link href={~p"/items/#{item}/edit"} class="dblclick"> | ||
<label><%= item.text %></label> | ||
</.link> | ||
<span></span> <!-- used for CSS Double Click --> | ||
<% end %> | ||
<.link | ||
<% else %> | ||
<.link href={~p"/items/#{item}/edit"} class="dblclick"> | ||
<label><%= item.text %></label> | ||
</.link> | ||
<span></span> <!-- used for CSS Double Click --> | ||
<% end %> | ||
<.link | ||
class="destroy" | ||
href={~p"/items/#{item}"} | ||
method="delete" | ||
> | ||
</.link> | ||
</div> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</section> | ||
<%= if got_items?(@items) do %> | ||
<footer class="footer" style="display: block;"> | ||
<span class="todo-count"> | ||
<%= remaining_items(@items) %> <%= pluralise(@items) %> left | ||
</span> | ||
<ul class="filters"> | ||
<li> | ||
<%= if @filter == "items" do %> | ||
<a href="/items" class='selected'> | ||
All | ||
</a> | ||
<% else %> | ||
<a href="/items"> | ||
All | ||
</a> | ||
<% end %> | ||
</li> | ||
<li> | ||
<%= if @filter == "active" do %> | ||
<a href="/items/active" class='selected'> | ||
Active | ||
[<%= Enum.count(filter(@items, "active")) %>] | ||
</a> | ||
<% else %> | ||
<a href="/items/active"> | ||
Active | ||
[<%= Enum.count(filter(@items, "active")) %>] | ||
</a> | ||
<% end %> | ||
</li> | ||
<li> | ||
<%= if @filter == "completed" do %> | ||
<a href="/items/completed" class='selected'> | ||
Completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
<% else %> | ||
<a href="/items/completed"> | ||
Completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
<% end %> | ||
</li> | ||
</.link> | ||
</div> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<a class="clear-completed" href="/items/clear"> | ||
Clear completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
</footer> | ||
<% end %> | ||
</section> | ||
<div class="fixed right-0 mr-10"> | ||
<%= if @loggedin == true do %> | ||
<button | ||
</section> | ||
<%= if got_items?(@items) do %> | ||
<footer class="footer" style="display: block;"> | ||
<span class="todo-count"> | ||
<%= remaining_items(@items) %> <%= pluralise(@items) %> left | ||
</span> | ||
<ul class="filters"> | ||
<li> | ||
<%= if @filter == "items" do %> | ||
<a href="/items" class='selected'> | ||
All | ||
</a> | ||
<% else %> | ||
<a href="/items"> | ||
All | ||
</a> | ||
<% end %> | ||
</li> | ||
<li> | ||
<%= if @filter == "active" do %> | ||
<a href="/items/active" class='selected'> | ||
Active | ||
[<%= Enum.count(filter(@items, "active")) %>] | ||
</a> | ||
<% else %> | ||
<a href="/items/active"> | ||
Active | ||
[<%= Enum.count(filter(@items, "active")) %>] | ||
</a> | ||
<% end %> | ||
</li> | ||
<li> | ||
<%= if @filter == "completed" do %> | ||
<a href="/items/completed" class='selected'> | ||
Completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
<% else %> | ||
<a href="/items/completed"> | ||
Completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
<% end %> | ||
</li> | ||
</ul> | ||
<a class="clear-completed" href="/items/clear"> | ||
Clear completed | ||
[<%= Enum.count(filter(@items, "completed")) %>] | ||
</a> | ||
</footer> | ||
<% end %> | ||
</section> | ||
<div class="fixed right-0 mr-10"> | ||
<button | ||
class="inline-block px-6 py-2.5 bg-[#fea5a5] text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-[#f76e6e] hover:shadow-lg focus:bg-[#f76e6e] focus:shadow-lg focus:outline-none focus:ring-0 active:bg-[#a23434] active:shadow-lg transition duration-150 ease-in-out" | ||
> | ||
<a href="/logout"> | ||
Logout | ||
</a> | ||
</button> | ||
<a href="/logout"> | ||
Logout | ||
</a> | ||
</button> | ||
</div> | ||
<% else %> | ||
<button | ||
class="inline-block px-6 py-2.5 bg-blue-300 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out" | ||
<div class="fixed h-screen ml-[25%] flex justify-center items-center"> | ||
<button | ||
class="max-h-[35px] inline-block px-6 py-2.5 bg-blue-300 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out" | ||
> | ||
<a href="/login"> | ||
Login | ||
</a> | ||
</button> | ||
<a href="/login"> | ||
Login | ||
</a> | ||
</button> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters