Skip to content

Commit

Permalink
Added news and delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
ger619 committed Mar 21, 2024
1 parent 47f4755 commit 2d0bd8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
10 changes: 8 additions & 2 deletions app/views/news/_news_render.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@

<% if current_user %>
<div class="bg-[#FAE115] mt-2 p-2 md:mt-3 md:p-3 rounded-lg sm:mt-2 sm:p-2 mt-2 p-2">
<%= link_to "Edit News", edit_news_path(news.id), class: "text-[#000] lg:text-base md:text-sm sm:text-xs md:font-bold sm:font-semibold md:py-2 sm:py-1 md:px-4 sm:px-2 p-1 rounded mt-2" %>
<%= link_to "Edit", edit_news_path(news.id), class: "text-[#000] lg:text-base md:text-sm sm:text-xs md:font-bold sm:font-semibold md:py-2 sm:py-1 md:px-4 sm:px-2 p-1 rounded mt-2" %>

</div>
<div class="bg-[#FAE115] mt-2 p-2 md:mt-3 md:p-3 rounded-lg sm:mt-2 sm:p-2 mt-2 p-2">
<%= button_to "Delete", @news, method: :delete, data: { turbo_method: :delete },class: "text-[#000] font-semibold " %>
</div>
<% end %>


<% end %>
</div>
</div>
</div>
Expand Down
13 changes: 6 additions & 7 deletions app/views/news/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<div class="shadow-md">
<div class="p-6 bg-[#FAE115] font-bold uppercase lg:text-3xl md:text-3xl text-2xl flex justify-between truncate ...">
<p>NEWS | <%= @news.header_news %></p>
<div class="p-6 bg-[#FAE115] font-bold uppercase lg:text-3xl md:text-3xl text-2xl flex justify-between ">
<p class="md:w-full w-[90%] truncate ...">NEWS | <%= @news.header_news %></p>
</div>
<div class="sm:w-[200px] md:w-[60%] lg:max-w-full xl:max-w-full mx-auto mt-[6px]">
<div>
<div class="w-[90%]">
<%= render "news/image_show" %>
</div>
<% if @news.type_of_news === "Match" %>
<h2 class="text-2xl font-bold mt-4 mr-3 m-4"><%= @news.type_of_news %></h2>

<h2 class="text-2xl font-bold mt-4 mr-3 m-4 flex justify-between uppercase"><%= @news.type_of_news %> <p class="text-xs mt-2 "><%= @news.created_at.strftime("%d.%m.%Y") %></p>
</h2>

<h3 class="text-xl font-semibold m-4"><%= @news.header_news %></h3>
<p class="text-lg mt-2 p-4"><%= raw @news.body %></p>
<p class="text-semibold text-white mt-2 bg-[#D9D9D9]"><%= @news.created_at.strftime("%d.%m.%Y") %></p>
<% end %>
</div>
</div>

0 comments on commit 2d0bd8a

Please sign in to comment.