Skip to content

Commit

Permalink
Style/Refatora estilo do anuncio
Browse files Browse the repository at this point in the history
  • Loading branch information
caiquedv committed Feb 16, 2024
1 parent 5173ccd commit b256f26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/controllers/advertisements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def new
def create
@advertisement = current_user.advertisements.build(ads_params)

return redirect_to advertisement_path(@advertisement), notice: t('.success') if @advertisement.save

render 'new', status: :unprocessable_entity
if @advertisement.save
redirect_to advertisement_path(@advertisement), notice: t('.success')
else
render 'new', status: :unprocessable_entity
end
end

def show
Expand Down
2 changes: 1 addition & 1 deletion app/views/advertisements/_advertisement.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="advertisement_<%= advertisement.id %>" class="text-center mb-3">
<%= button_to advertisement_path(advertisement), method: :patch,
class: 'advertisement', data: { turbo: false }, id: 'to-ad' do %>
class: 'advertisement rounded btn btn-light w-100', data: { turbo: false }, id: 'to-ad' do %>
<p><%= advertisement.title %></p>
<p><%= image_tag advertisement.image, width: '400rem', alt: 'advertisement' if advertisement.image.present? %></p>
<% end %>
Expand Down

0 comments on commit b256f26

Please sign in to comment.