diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb
index dd50979..a25f31f 100644
--- a/app/controllers/payments_controller.rb
+++ b/app/controllers/payments_controller.rb
@@ -16,6 +16,10 @@ class PaymentsController < ApplicationController
# GET /payments.json
def index
@payments = @payments.order("date DESC")
+ @graph = { :members => chart("members"),
+ :total => chart("total"),
+ :basic => chart("basic"),
+ :associate => chart("associate")}
respond_to do |format|
format.html # index.html.erb
@@ -23,8 +27,9 @@ class PaymentsController < ApplicationController
end
end
- def chart
- chart_name = params[:name] || "total"
+ # Private method for index charts
+ def chart name
+ chart_name = name || "total"
if chart_name == "total"
chart_type = [25, 50, 100]
elsif chart_name == "members"
@@ -58,10 +63,7 @@ class PaymentsController < ApplicationController
end
end
- respond_to do |format|
- format.html # index.html.erb
- format.json { render :json => @payments_by_month }
- end
+ return @payments_by_month
end
def amount_or_level p
diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb
index aee18ae..5b92755 100644
--- a/app/views/payments/index.html.erb
+++ b/app/views/payments/index.html.erb
@@ -1,6 +1,6 @@
-
+
diff --git a/config/routes.rb b/config/routes.rb
index e0b6672..5f0355f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -7,7 +7,6 @@ Dooraccess::Application.routes.draw do
resources :paypal_csvs
match 'paypal_csvs/:id/link' => 'paypal_csvs#link', :as => :link_paypal_csv
- match 'payments/chart' => 'payments#chart', :as => :chart_payments
resources :payments
resources :user_certifications