Skip to content

Commit

Permalink
Enhance invoice update UI and styling
Browse files Browse the repository at this point in the history
- Replace redirect with Turbo Stream for smoother invoice updates
- Update flash message handling to use Turbo Stream
- Improve invoice actions layout with better spacing and icons
- Change edit button styling to green with pen icon for better UX
  • Loading branch information
OlegPhenomenon committed Dec 16, 2024
1 parent ef4b321 commit d912c96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/controllers/invoices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ class InvoicesController < ParentController
def update
@invoice = Invoice.find(params[:id])
@invoice.update(invoice_params)
redirect_to invoice_creators_path, notice: 'Invoice was successfully updated.', status: :see_other

flash.now[:notice] = 'Invoice was successfully updated.'
render turbo_stream: turbo_stream.replace('flash', partial: 'shared/flash')
end

def edit
Expand Down
17 changes: 9 additions & 8 deletions app/views/invoices/_invoice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
<% end %>

</td>
<td class="px-6 py-1 break-all border-b border-gray-200">
<%= link_to edit_invoice_path(invoice), class: 'w-6 h-6 p-2 rounded-full bg-blue-300 hover:bg-blue-500 text-black border-gray-300 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black text-center', data: { turbo_frame: 'modal' } do %>
<i class="fa-solid fa-info"></i>
<% end %>

<%= link_to invoice_details_description_path(invoice), class: 'w-6 h-6 p-2 rounded-full bg-blue-300 hover:bg-blue-500 text-black border-gray-300 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black text-center', data: { turbo_frame: 'modal' } do %>
<i class="fa-solid fa-info"></i>
<% end %>
<td class="px-6 py-1 break-all border-b border-gray-200 space-x-2">
<div class="flex items-center justify-center">
<%= link_to edit_invoice_path(invoice), class: 'w-6 h-6 p-2 rounded-full bg-green-300 hover:bg-green-500 text-white border-gray-300 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white text-center', data: { turbo_frame: 'modal' } do %>
<i class="fa-solid fa-pen"></i>
<% end %>

<%= link_to invoice_details_description_path(invoice), class: 'w-6 h-6 p-2 rounded-full bg-blue-300 hover:bg-blue-500 text-black border-gray-300 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black text-center', data: { turbo_frame: 'modal' } do %>
<i class="fa-solid fa-info"></i>
<% end %>
</div>
</td>
<td class="px-6 py-1 break-all border-b border-gray-200"><%= invoice.sent_at_omniva.to_formatted_s(:long) unless invoice.sent_at_omniva.nil? %></td>
<td class="px-6 py-1 break-all border-b border-gray-200"><%= invoice.in_directo %></td>
Expand Down

0 comments on commit d912c96

Please sign in to comment.