Created
May 27, 2020 00:11
-
-
Save phirefly/7e9f6947103ee7a225748e03109164c1 to your computer and use it in GitHub Desktop.
Markup for favoriting links
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
<div class="flex flex-wrap -mb-4"> | |
<% @things.each do |thing| %> | |
<div class="w-1/3 max-w-sm rounded overflow-hidden shadow-lg"> | |
<div class="px-6 py-4"> | |
<div class="font-bold text-xl mb-2"><%= thing.title %> </div> | |
<p class="text-gray-700 text-base"> | |
ID: <%= thing.id %> | |
</p> | |
<p class="text-gray-700 text-base"> | |
<%= thing.description || "Description TBD" %> | |
</p> | |
<p class="text-gray-700 text-base"> | |
Status: <%= thing.status %> | |
</p> | |
<p class="text-gray-700 text-base"> | |
Favorited?: <%= @favorites.include?(thing.id) %> | |
</p> | |
</div> | |
<div class="px-6 py-4"> | |
<% if @favorites.include?(thing.id) %> | |
<a href='#' | |
data-userid="<%= current_user.id %>" | |
data-thingid="<%= thing.id %>" | |
data-reflex="click->FavoriteReflex#remove_favorite" | |
>Unfavorite</a> | |
<% else %> | |
<a href='#' | |
data-userid="<%= current_user.id %>" | |
data-thingid="<%= thing.id %>" | |
data-reflex="click->FavoriteReflex#add_favorite" | |
>Favorite</a> | |
<% end %> | |
<span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2">Borrow</span> | |
<span class="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2">More info</span> | |
</div> | |
</div> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment