Skip to content

Commit

Permalink
Revert "Issue #3736 - move purchases to new area"
Browse files Browse the repository at this point in the history
This reverts commit cd08a7b.

:wq#
  • Loading branch information
rae-stanton committed Jul 29, 2023
1 parent cd08a7b commit a7e46c6
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 243 deletions.
2 changes: 2 additions & 0 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def index

@donations = current_organization.donations.during(helpers.selected_range)
@recent_donations = @donations.recent
@purchases = current_organization.purchases.during(helpers.selected_range)
@recent_purchases = @purchases.recent.includes(:vendor)

distributions = current_organization.distributions.includes(:partner).during(helpers.selected_range)
@recent_distributions = distributions.recent
Expand Down
7 changes: 0 additions & 7 deletions app/controllers/purchases_summary_controller.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<br>
<div class="pull-left purchase">
<%= link_to purchase do %>
<%= number_with_delimiter purchase.line_items.total %> items from <%= purchase.purchased_from_view %>
Expand All @@ -7,4 +7,3 @@
<div class="pull-right">
<%= distance_of_time_in_words_to_now purchase.created_at %> ago
</div>

20 changes: 20 additions & 0 deletions app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,26 @@
</div>
<% end %>

<%= render(
"card",
id: "purchases",
gradient: "secondary",
title: "Purchases",
subtitle: @selected_date_range,
footer_options: { class: "text-center" },
footer: link_to("See more...", purchases_path),
) do %>
<%= new_button_to new_purchase_path, {text: "New Purchase"} %>
<h3 class="text-center"><%= dollar_presentation(@purchases.sum(&:amount_spent_in_cents)) %>
spent
<%= @selected_date_range_label %>
</h3>
<div class="box-body">
<h4>Recent purchases</h4>
<%= render partial: "purchase", collection: @recent_purchases, as: :purchase %>
</div>
<% end %>

<%= render(
"card",
gradient: "warning",
Expand Down
5 changes: 0 additions & 5 deletions app/views/layouts/_lte_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
<i class="nav-icon fa fa-circle-o"></i> New Purchase
<% end %>
</li>
<li class="nav-item <%= 'active' if current_page?(purchases_summary_path(organization_id: current_user.organization)) %>">
<%= link_to(purchases_summary_path(organization_id: current_user.organization), class: "nav-link #{"active" if current_page?(purchases_summary_path)}") do %>
<i class="nav-icon fa fa-circle-o"></i> Purchases Summary
<% end %>
</li>
</ul>
</li>
<li class="nav-item <%= 'active' if current_page?(requests_path) %>">
Expand Down
76 changes: 0 additions & 76 deletions app/views/purchases_summary/_card.html.erb

This file was deleted.

20 changes: 0 additions & 20 deletions app/views/purchases_summary/index.html.erb

This file was deleted.

19 changes: 0 additions & 19 deletions app/views/purchases_summary/index.html.orginal.erb

This file was deleted.

76 changes: 0 additions & 76 deletions app/views/shared/_card.html.erb

This file was deleted.

37 changes: 0 additions & 37 deletions app/views/shared/_filtered_card.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ def set_up_flipper
get "historical_trends/distributions", to: "historical_trends/distributions#index"
get "historical_trends/purchases", to: "historical_trends/purchases#index"
get "historical_trends/donations", to: "historical_trends/donations#index"
get "purchases_summary", to: "purchases_summary#index"
end

resources :attachments, only: %i(destroy)
Expand Down

0 comments on commit a7e46c6

Please sign in to comment.