Skip to content

Commit

Permalink
update buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Sep 10, 2024
1 parent 2c0ab43 commit 4753f5c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/views/achievements/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<% if user_signed_in? %>
<%= link_to 'New Achievement', new_achievement_path, class: 'bg-lime-500 hover:bg-lime-700 text-white font-bold py-2 px-4 rounded mb-4 inline-block' %>
<% end %>

<ul class="space-y-4">
<% @achievements.each do |achievement| %>
<li class="bg-gray-800 p-4 rounded shadow-md">
Expand All @@ -16,10 +17,12 @@
<% if achievement.url.present? %>
<p class="text-gray-500">URL: <a href="<%= achievement.url %>" class="text-lime-300 hover:underline" target="_blank"><%= achievement.url %></a></p>
<% end %>
<div class="mt-2">

<!-- Edit and Delete Buttons -->
<div class="mt-4 flex space-x-2">
<% if user_signed_in? && achievement.user == current_user %>
<%= link_to 'Edit', edit_achievement_path(achievement), class: 'text-lime-300 hover:text-lime-500' %> |
<%= link_to 'Delete', achievement, method: :delete, data: { confirm: 'Are you sure?' }, class: 'text-lime-300 hover:text-lime-500' %>
<%= link_to 'Edit', edit_achievement_path(achievement), class: 'bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded' %>
<%= link_to 'Delete', achievement, method: :delete, data: { confirm: 'Are you sure?' }, class: 'bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded cursor-pointer' %>
<% end %>
</div>
</li>
Expand Down

0 comments on commit 4753f5c

Please sign in to comment.