Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions app/controllers/spree/admin/subscriptions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
class Spree::Admin::SubscriptionsController < Spree::Admin::ResourceController
module Spree
module Admin
class SubscriptionsController < Spree::Admin::BaseController

def index
# DD: stolen from Spree::Admin::OrdersController
@search = Spree::Subscription.ransack(params[:q])
@subscriptions = @search.result.includes([:user]).
page(params[:page]).
per(params[:per_page] || Spree::Config[:orders_per_page])
def index
@search = Spree::Subscription.post_cart.ransack(params[:q])
@subscriptions = @search.result.includes([:user]).
page(params[:page]).
per(params[:per_page] || Spree::Config[:orders_per_page])
end

def edit

end
end
end
end
1 change: 1 addition & 0 deletions app/models/spree/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Spree::Subscription < ActiveRecord::Base
has_many :reorders, :class_name => "Spree::Order"

scope :active, where(:state => 'active')
scope :post_cart, where("state != ?", "cart")

state_machine :state, :initial => 'cart' do
event :suspend do
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/subscriptions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<span class="product-name"><%= sub.line_item.variant.name %></span><br/>
<%= sub.line_item.variant.options_text %>
</td>
<td class="subscription-user"><%= sub.user.id %></td>
<td class="subscription-user"><%= link_to(sub.user.email, :controller => "spree/admin/users", :action => "show", :id => sub.user.id) if sub.user %></td>
<td class="subscription-price"><%= money sub.line_item.price %></td>
<td class="subscription-interval"><%= sub.time_title %></td>
<td class="subscription-reorder-date">
Expand Down