Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
214 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/controllers/saasaparilla/admin/subscriptions_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class Saasaparilla::Admin::SubscriptionsController < ActionController::Base | ||
|
||
unloadable | ||
|
||
include Authorization::InstanceMethods | ||
|
||
# GET /admin/subscriptions | ||
def index | ||
@subscriptions = Subscription.all.paginate(:page => params[:page], :per_page => 20, :order => "created_at DESC") | ||
end | ||
|
||
def show | ||
@subscription = Subscription.find(params[:id]) | ||
end | ||
|
||
|
||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/views/saasaparilla/admin/subscriptions/_subscription.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%tr | ||
%td= subscription.email | ||
%td= subscription.created_at.to_s(:month_day_year) | ||
%td= subscription.last_transaction_date | ||
%td= subscription.status | ||
%td= subscription.plan_name | ||
%td= link_to "Show Detail", admin_subscription_path(subscription) |
13 changes: 13 additions & 0 deletions
13
app/views/saasaparilla/admin/subscriptions/index.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
%h1 Listing Subscriptions | ||
|
||
%table | ||
%tr | ||
%th Email | ||
%th Sign up | ||
%th Last Transaction Date | ||
%th Status | ||
%th Plan | ||
|
||
= render :partial => "subscription", :collection => @subscriptions | ||
|
||
= will_paginate @subscriptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%h1 Subscription Detail | ||
|
||
%h2 Subscriber Contact Info | ||
%p | ||
= "#{@subscription.first_name} #{@subscription.last_name}" | ||
%br | ||
= @subscription.address | ||
%br | ||
= "#{@subscription.city}, #{@subscription.state} #{@subscription.zip}" | ||
%br | ||
= "#{@subscription.phone_number}" | ||
|
||
%h2 Subscription Details | ||
%p | ||
="Status: " | ||
= @subscription.status | ||
%br | ||
= "Balance: " | ||
= number_to_currency(@subscription.balance) | ||
%br | ||
= "Last Invoiced: " | ||
= @subscription.invoiced_on.to_s(:month_day_year) unless @subscription.invoiced_on.nil? | ||
%br | ||
= "Last Transaction Date: " | ||
= @subscription.last_transaction_date | ||
%br | ||
= "Last Transaction Amount: " | ||
= number_to_currency(@subscription.last_transaction_amount) |
5 changes: 2 additions & 3 deletions
5
app/views/saasaparilla/subscription/_credit_card_form.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
%h2 Billing info | ||
|
||
/ = f.input :first_name | ||
/ = f.input :last_name | ||
|
||
= f.input :card_type, :collection => CreditCard::CARD_TYPES, :include_blank => false | ||
- if f.object.new_record? | ||
= f.input :card_number | ||
- else | ||
= f.input :card_number, :input_html => {:value => ""} | ||
= f.input :expiry_month, :collection => CreditCard::MONTHS | ||
= f.input :expiry_year, :collection => CreditCard::YEARS | ||
= f.input :expiry_year, :collection => CreditCard::YEARS, :error_html => { :id => "subscription_credit_card_attributes_expiry_date_error"} | ||
= f.input :card_verification | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Authorization | ||
module ClassMethods | ||
|
||
end | ||
module InstanceMethods | ||
def self.included(base) | ||
if Saasaparilla::CONFIG["authorization"] == "cancan" | ||
base.rescue_from CanCan::AccessDenied do |exception| | ||
redirect_to '/' | ||
flash[:error] = exception.to_s | ||
end | ||
base.load_and_authorize_resource | ||
end | ||
# Override this module an initializer with Authorization::InstanceMethods.module_eval and add your own authorization | ||
# base.before_filter :custom_method | ||
end | ||
|
||
|
||
# def custom_method | ||
|
||
# end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
module Saasaparilla | ||
require 'saasaparilla/engine' if defined?(Rails) | ||
end | ||
|
||
require 'saasaparilla/engine' if defined?(Rails) | ||
require 'extensions/billable' | ||
|
||
require 'country_select/lib/country_select' | ||
require 'extensions/active_record/statuses' | ||
require 'extensions/active_record/nested_attributes' | ||
require 'extensions/active_record/nested_attributes' | ||
|
||
module Saasaparilla | ||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.