Skip to content

Commit

Permalink
Merge pull request #1284 from internetee/1282-show-action-is-broken-i…
Browse files Browse the repository at this point in the history
…n-admin-view-for-auciton

fix for show action in admin controller of auction
  • Loading branch information
vohmar authored Jul 4, 2024
2 parents 7f9a651 + 857b42a commit 8f32ebd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions app/views/admin/auctions/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content_for :title, "#{t('.title')}: #{@auction.domain_name}" %>

<div class="o-container" data-controller="auction-timezone" data-auction-timezone-end-time-value="<%= auction.ends_at&.iso8601 %>" data-auction-timezone-start-time-value="<%= auction.starts_at.iso8601 %>">
<div class="o-container" data-controller="auction-timezone" data-auction-timezone-end-time-value="<%= @auction&.ends_at&.iso8601 %>" data-auction-timezone-start-time-value="<%= @auction&.starts_at&.iso8601 %>">
<div class="c-table c-table--sortable" data-controller='form--bundle-checkbox'>
<%= component 'common/table', header_collection: [], options: { class: 'js-table-dt dataTable no-footer' } do %>
<%= tag.tbody id: "auctions-table-body", class: 'contents' do %>
Expand All @@ -13,14 +13,14 @@
<tr>
<td><strong><%= t('auctions.starts_at') %></strong></td>
<%= tag.td do %>
<span data-auction-timezone-target="starttime"><%= auction.starts_at %></span>
<% end @auction.starts_at.present? %>
<span data-auction-timezone-target="starttime"><%= @auction.starts_at %></span>
<% end if @auction.starts_at.present? %>
</tr>
<tr>
<td><strong><%= t('auctions.ends_at') %></strong></td>
<%= tag.td do %>
<span data-auction-timezone-target="endtime"><%= auction.ends_at %></span>
<% end @auction.ends_at.present? %>
<span data-auction-timezone-target="endtime"><%= @auction.ends_at %></span>
<% end if @auction.ends_at.present? %>
</tr>
<%- if @auction.offer_from_user(current_user).present? %>
<tr>
Expand All @@ -45,13 +45,15 @@
<%= component 'common/table', header_collection:, options: { class: 'js-table-dt' } do %>
<%= tag.tbody id: "auctions-table-body", class: 'contents' do %>
<%- if @offers.present? %>
<tr class="offers-table-row">
<td><%= t('offers.price_in_currency', price: offer.price) %></td>
<td><%= offer.user&.display_name || t(:deleted_user) %></td>
<td><%= I18n.l(offer.created_at) %></td>
<td><%= I18n.l(offer.updated_at) %></td>
<td><%= link_to t(:versions_name), admin_offer_versions_path(offer), class: "ui button primary" %></td>
</tr>
<% @offers.each do |offer| %>
<tr class="offers-table-row">
<td><%= t('offers.price_in_currency', price: offer.price) %></td>
<td><%= offer.user&.display_name || t(:deleted_user) %></td>
<td><%= I18n.l(offer.created_at) %></td>
<td><%= I18n.l(offer.updated_at) %></td>
<td><%= link_to t(:versions_name), admin_offer_versions_path(offer), class: "ui button primary" %></td>
</tr>
<% end %>
<%- else %>
<tr>
<td colspan="5" style="text-align: center; font-weight: bold; font-size: 1.2rem; padding: 3rem 0 !important;"><%= t(:no_offers) %></td>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
end

namespace :admin, constraints: Constraints::Administrator.new do
resources :auctions, concerns: %i[auditable], except: [:show] do
resources :auctions, concerns: %i[auditable] do
collection do
post 'bulk_starts_at', to: 'auctions#bulk_starts_at', as: 'bulk_starts_at'
post 'apply_auction_participants', to: 'auctions#apply_auction_participants', as: 'apply_auction_participants'
Expand Down

0 comments on commit 8f32ebd

Please sign in to comment.