accountability 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +86 -9
- data/app/assets/stylesheets/accountability/application.scss +0 -0
- data/app/controllers/accountability/accounts_controller.rb +2 -4
- data/app/controllers/accountability/billing_configurations_controller.rb +80 -0
- data/app/controllers/accountability/order_groups_controller.rb +2 -4
- data/app/controllers/accountability/payments_controller.rb +25 -0
- data/app/controllers/accountability/products_controller.rb +7 -5
- data/app/controllers/accountability/statements_controller.rb +19 -0
- data/app/controllers/accountability_controller.rb +47 -0
- data/app/helpers/accountability/{application_helper.rb → accountability_helper.rb} +1 -1
- data/app/helpers/accountability/billing_configurations_helper.rb +47 -0
- data/app/helpers/accountability/products_helper.rb +21 -0
- data/app/models/accountability/account.rb +31 -1
- data/app/models/accountability/application_record.rb +24 -0
- data/app/models/accountability/billing_configuration.rb +41 -0
- data/app/models/accountability/coupon.rb +2 -0
- data/app/models/accountability/credit.rb +53 -29
- data/app/models/accountability/debit.rb +10 -0
- data/app/models/accountability/inventory.rb +61 -0
- data/app/models/accountability/offerable.rb +28 -1
- data/app/models/accountability/offerable/scope.rb +48 -0
- data/app/models/accountability/order_item.rb +3 -7
- data/app/models/accountability/payment.rb +22 -3
- data/app/models/accountability/product.rb +45 -5
- data/app/models/accountability/statement.rb +46 -0
- data/app/models/accountability/{account/transactions.rb → transactions.rb} +14 -2
- data/app/models/concerns/accountability/active_merchant_interface.rb +15 -0
- data/app/models/concerns/accountability/active_merchant_interface/stripe_interface.rb +134 -0
- data/app/pdfs/statement_pdf.rb +91 -0
- data/app/views/accountability/accounts/show.html.haml +21 -9
- data/app/views/accountability/products/index.html.haml +17 -34
- data/app/views/accountability/products/new.html.haml +73 -0
- data/app/views/accountability/shared/_session_info.html.haml +24 -0
- data/config/locales/en.yml +19 -0
- data/db/migrate/20190814000455_create_accountability_tables.rb +43 -1
- data/lib/accountability.rb +2 -1
- data/lib/accountability/configuration.rb +22 -2
- data/lib/accountability/engine.rb +6 -1
- data/lib/accountability/extensions/acts_as_billable.rb +11 -0
- data/lib/accountability/rails/routes.rb +72 -0
- data/lib/accountability/types.rb +9 -0
- data/lib/accountability/types/billing_configuration_types.rb +57 -0
- data/lib/accountability/version.rb +1 -1
- data/lib/generators/accountability/install_generator.rb +47 -0
- data/lib/generators/accountability/templates/migration.rb.tt +155 -0
- data/lib/generators/accountability/templates/price_overrides_migration.rb.tt +13 -0
- metadata +73 -12
- data/app/assets/stylesheets/accountability/application.css +0 -15
- data/app/controllers/accountability/application_controller.rb +0 -45
- data/app/views/accountability/products/new.html.erb +0 -40
- data/lib/accountability/cartographer.rb +0 -28
@@ -0,0 +1,155 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :accountability_accounts do |t|
|
4
|
+
t.belongs_to :billable, null: true, polymorphic: true
|
5
|
+
t.integer :statement_schedule, default: 0, null: false # end_of_month bi_weekly
|
6
|
+
t.datetime :last_balanced_at, default: nil, null: true
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :accountability_statements do |t|
|
12
|
+
t.belongs_to :account, null: false, index: { name: :index_account_on_statement }
|
13
|
+
t.datetime :end_date, default: nil, null: false
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
create_table :accountability_debits do |t|
|
19
|
+
t.belongs_to :account, null: false, index: { name: :index_account_on_debit }
|
20
|
+
t.belongs_to :payment, null: true, index: { name: :index_payment_on_debit }
|
21
|
+
t.decimal :amount, default: 0.00, precision: 8, scale: 2, null: false
|
22
|
+
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table :accountability_credits do |t|
|
27
|
+
t.belongs_to :account, null: false, index: { name: :index_account_on_credit }
|
28
|
+
t.belongs_to :order_item, null: false, index: { name: :index_order_item_on_credit }
|
29
|
+
t.belongs_to :statement, null: false, index: { name: :index_statement_on_credit }
|
30
|
+
t.decimal :amount, default: 0.00, precision: 8, scale: 2, null: false
|
31
|
+
t.decimal :taxes, default: 0.00, precision: 8, scale: 2, null: false
|
32
|
+
|
33
|
+
t.timestamps
|
34
|
+
end
|
35
|
+
|
36
|
+
create_table :accountability_payments do |t|
|
37
|
+
t.belongs_to :account, null: false, index: { name: :index_account_on_payment }
|
38
|
+
t.belongs_to :billing_configuration, null: false, index: { name: :index_billing_configuration_on_payment }
|
39
|
+
|
40
|
+
t.decimal :amount, default: 0.00, precision: 8, scale: 2, null: false
|
41
|
+
t.integer :status, default: 0, null: false # Pending, Processing, Complete, Failed
|
42
|
+
|
43
|
+
t.timestamps
|
44
|
+
end
|
45
|
+
|
46
|
+
create_table :accountability_order_groups do |t|
|
47
|
+
t.belongs_to :account, null: true, index: { name: :index_account_on_order_group }
|
48
|
+
|
49
|
+
t.integer :status, default: 0, null: false # Pending, Complete, Abandoned
|
50
|
+
t.text :notes, default: nil, null: true, limit: 10_000
|
51
|
+
|
52
|
+
t.timestamps
|
53
|
+
end
|
54
|
+
|
55
|
+
create_table :accountability_order_items do |t|
|
56
|
+
t.belongs_to :order_group, null: false, index: { name: :index_order_group_on_order_iem }
|
57
|
+
t.belongs_to :product, null: false, index: { name: :index_product_on_order_iem }
|
58
|
+
|
59
|
+
t.text :source_scope, default: nil, null: true, limit: 1_000
|
60
|
+
t.datetime :termination_date, default: nil, null: true
|
61
|
+
|
62
|
+
t.timestamps
|
63
|
+
end
|
64
|
+
|
65
|
+
create_table :accountability_deductions do |t|
|
66
|
+
t.belongs_to :credit, null: false, index: { name: :index_credit_on_deduction }
|
67
|
+
t.belongs_to :discount, null: false, index: { name: :index_discount_on_deduction }
|
68
|
+
|
69
|
+
t.decimal :amount, default: 0.00, precision: 8, scale: 2, null: false
|
70
|
+
|
71
|
+
t.timestamps
|
72
|
+
end
|
73
|
+
|
74
|
+
create_table :accountability_discounts do |t|
|
75
|
+
t.belongs_to :order_item, null: false, index: { name: :index_order_item_on_discount }
|
76
|
+
t.belongs_to :coupon, null: false, index: { name: :index_coupon_on_discount }
|
77
|
+
|
78
|
+
t.timestamps
|
79
|
+
end
|
80
|
+
|
81
|
+
create_table :accountability_products do |t|
|
82
|
+
t.boolean :public, default: true, null: false
|
83
|
+
t.boolean :tax_exempt, default: false, null: false
|
84
|
+
t.decimal :price, default: 0.00, precision: 8, scale: 2, null: false
|
85
|
+
t.integer :quantity, default: 1, null: false
|
86
|
+
t.string :name, default: nil, null: false
|
87
|
+
t.string :sku, default: nil, null: true
|
88
|
+
t.text :description, default: nil, null: true, limit: 10_000
|
89
|
+
t.integer :schedule, default: 0, null: false # OneTime, Weekly, Monthly, Annually
|
90
|
+
t.string :offerable_category, default: nil, null: false
|
91
|
+
t.text :source_scope, default: nil, null: true, limit: 1_000
|
92
|
+
t.text :billing_configuration, default: nil, null: true, limit: 1_000
|
93
|
+
|
94
|
+
t.datetime :activation_date, default: nil, null: true
|
95
|
+
t.datetime :expiration_date, default: nil, null: true
|
96
|
+
t.datetime :termination_date, default: nil, null: true
|
97
|
+
|
98
|
+
t.timestamps
|
99
|
+
end
|
100
|
+
|
101
|
+
create_table :accountability_coupons do |t|
|
102
|
+
t.decimal :amount, default: 0.00, precision: 8, scale: 2, null: false
|
103
|
+
t.boolean :public, default: true, null: false
|
104
|
+
t.integer :limit, default: nil, null: true
|
105
|
+
t.string :name, default: nil, null: false
|
106
|
+
t.string :code, default: nil, null: true
|
107
|
+
|
108
|
+
t.integer :usage_cap, default: 1, null: false
|
109
|
+
|
110
|
+
t.datetime :activation_date, default: nil, null: true
|
111
|
+
t.datetime :expiration_date, default: nil, null: true
|
112
|
+
t.datetime :termination_date, default: nil, null: true
|
113
|
+
|
114
|
+
t.timestamps
|
115
|
+
end
|
116
|
+
|
117
|
+
# rubocop:disable Rails/CreateTableWithTimestamps
|
118
|
+
create_table :accountability_coupons_products, id: false do |t|
|
119
|
+
t.belongs_to :product, index: { name: :index_product_on_product_coupon }
|
120
|
+
t.belongs_to :coupon, index: { name: :index_coupon_on_product_coupon }
|
121
|
+
end
|
122
|
+
# rubocop:enable Rails/CreateTableWithTimestamps
|
123
|
+
|
124
|
+
# rubocop:disable Rails/CreateTableWithTimestamps
|
125
|
+
create_table :accountability_identities do |t|
|
126
|
+
t.belongs_to :identifiable, polymorphic: true, index: { name: :index_identifiable_on_identity }
|
127
|
+
end
|
128
|
+
# rubocop:enable Rails/CreateTableWithTimestamps
|
129
|
+
|
130
|
+
create_table :accountability_billing_configurations do |t|
|
131
|
+
t.belongs_to :account, null: false, index: { name: :index_account_on_billing_configuration }
|
132
|
+
t.boolean :primary, default: false, null: false
|
133
|
+
t.text :billing_address, default: nil, null: true # JSON serialized value object
|
134
|
+
t.text :active_merchant_data, default: nil, null: true # JSON serialized data for ActiveMerchant
|
135
|
+
t.integer :provider, default: 0, null: false # [unselected, stripe]
|
136
|
+
t.string :token, default: nil, null: true # A token used to retrieve & charge the payment method from the provider
|
137
|
+
t.string :configuration_name, default: nil, null: true # A name for the payment method
|
138
|
+
t.string :contact_email, default: nil, null: true
|
139
|
+
t.string :contact_first_name, default: nil, null: true
|
140
|
+
t.string :contact_last_name, default: nil, null: true
|
141
|
+
|
142
|
+
t.timestamps
|
143
|
+
end
|
144
|
+
|
145
|
+
create_table :accountability_price_overrides do |t|
|
146
|
+
t.belongs_to :product, index: { name: :index_product_on_price_override }
|
147
|
+
t.belongs_to :offerable_source, null: false, polymorphic: true, index: { name: :index_offerable_source_on_price_override }
|
148
|
+
|
149
|
+
t.decimal :price, default: 0.00, precision: 8, scale: 2, null: false # The inventory item's new price
|
150
|
+
t.text :description, default: nil, null: true, limit: 10_000 # Optional field for describing adjustment rationale
|
151
|
+
|
152
|
+
t.timestamps
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :accountability_price_overrides do |t|
|
4
|
+
t.belongs_to :product, index: { name: :index_product_on_price_override }
|
5
|
+
t.belongs_to :offerable_source, null: false, polymorphic: true, index: { name: :index_offerable_source_on_price_override }
|
6
|
+
|
7
|
+
t.decimal :price, default: 0.00, precision: 8, scale: 2, null: false # The inventory item's new price
|
8
|
+
t.text :description, default: nil, null: true, limit: 10_000 # Optional field for describing adjustment rationale
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: accountability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Stowers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active_accountability_merchant
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: prawn
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: prawn-table
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
13
55
|
- !ruby/object:Gem::Dependency
|
14
56
|
name: rails
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
16
58
|
requirements:
|
17
|
-
- - "
|
59
|
+
- - ">="
|
18
60
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
61
|
+
version: '0'
|
20
62
|
type: :runtime
|
21
63
|
prerelease: false
|
22
64
|
version_requirements: !ruby/object:Gem::Requirement
|
23
65
|
requirements:
|
24
|
-
- - "
|
66
|
+
- - ">="
|
25
67
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: sqlite3
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -49,44 +91,63 @@ files:
|
|
49
91
|
- MIT-LICENSE
|
50
92
|
- README.md
|
51
93
|
- app/assets/config/accountability_manifest.js
|
52
|
-
- app/assets/stylesheets/accountability/application.
|
94
|
+
- app/assets/stylesheets/accountability/application.scss
|
53
95
|
- app/controllers/accountability/accounts_controller.rb
|
54
|
-
- app/controllers/accountability/
|
96
|
+
- app/controllers/accountability/billing_configurations_controller.rb
|
55
97
|
- app/controllers/accountability/order_groups_controller.rb
|
98
|
+
- app/controllers/accountability/payments_controller.rb
|
56
99
|
- app/controllers/accountability/products_controller.rb
|
57
|
-
- app/
|
100
|
+
- app/controllers/accountability/statements_controller.rb
|
101
|
+
- app/controllers/accountability_controller.rb
|
102
|
+
- app/helpers/accountability/accountability_helper.rb
|
103
|
+
- app/helpers/accountability/billing_configurations_helper.rb
|
104
|
+
- app/helpers/accountability/products_helper.rb
|
58
105
|
- app/models/accountability/account.rb
|
59
|
-
- app/models/accountability/account/transactions.rb
|
60
106
|
- app/models/accountability/application_record.rb
|
107
|
+
- app/models/accountability/billing_configuration.rb
|
61
108
|
- app/models/accountability/coupon.rb
|
62
109
|
- app/models/accountability/credit.rb
|
63
110
|
- app/models/accountability/debit.rb
|
64
111
|
- app/models/accountability/deduction.rb
|
65
112
|
- app/models/accountability/discount.rb
|
113
|
+
- app/models/accountability/inventory.rb
|
66
114
|
- app/models/accountability/offerable.rb
|
115
|
+
- app/models/accountability/offerable/scope.rb
|
67
116
|
- app/models/accountability/order_group.rb
|
68
117
|
- app/models/accountability/order_item.rb
|
69
118
|
- app/models/accountability/payment.rb
|
70
119
|
- app/models/accountability/product.rb
|
120
|
+
- app/models/accountability/statement.rb
|
121
|
+
- app/models/accountability/transactions.rb
|
122
|
+
- app/models/concerns/accountability/active_merchant_interface.rb
|
123
|
+
- app/models/concerns/accountability/active_merchant_interface/stripe_interface.rb
|
124
|
+
- app/pdfs/statement_pdf.rb
|
71
125
|
- app/views/accountability/accounts/index.html.haml
|
72
126
|
- app/views/accountability/accounts/show.html.haml
|
73
127
|
- app/views/accountability/order_groups/new.html.haml
|
74
128
|
- app/views/accountability/order_groups/show.html.haml
|
75
129
|
- app/views/accountability/products/edit.html.erb
|
76
130
|
- app/views/accountability/products/index.html.haml
|
77
|
-
- app/views/accountability/products/new.html.
|
131
|
+
- app/views/accountability/products/new.html.haml
|
78
132
|
- app/views/accountability/products/show.html.erb
|
133
|
+
- app/views/accountability/shared/_session_info.html.haml
|
79
134
|
- app/views/layouts/acts_as_billable/application.html.erb
|
135
|
+
- config/locales/en.yml
|
80
136
|
- config/routes.rb
|
81
137
|
- db/migrate/20190814000455_create_accountability_tables.rb
|
82
138
|
- lib/accountability.rb
|
83
|
-
- lib/accountability/cartographer.rb
|
84
139
|
- lib/accountability/configuration.rb
|
85
140
|
- lib/accountability/engine.rb
|
86
141
|
- lib/accountability/extensions.rb
|
87
142
|
- lib/accountability/extensions/acts_as_billable.rb
|
88
143
|
- lib/accountability/extensions/acts_as_offerable.rb
|
144
|
+
- lib/accountability/rails/routes.rb
|
145
|
+
- lib/accountability/types.rb
|
146
|
+
- lib/accountability/types/billing_configuration_types.rb
|
89
147
|
- lib/accountability/version.rb
|
148
|
+
- lib/generators/accountability/install_generator.rb
|
149
|
+
- lib/generators/accountability/templates/migration.rb.tt
|
150
|
+
- lib/generators/accountability/templates/price_overrides_migration.rb.tt
|
90
151
|
homepage: https://elevatesystems.com
|
91
152
|
licenses:
|
92
153
|
- MIT
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
* require_tree accountability
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Accountability
|
2
|
-
class ApplicationController < ::ApplicationController
|
3
|
-
protect_from_forgery with: :exception
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def track_order
|
8
|
-
# Check if session is billable (billable_identifier proc returns )
|
9
|
-
billable_record = instance_exec(&Configuration.billable_identifier)
|
10
|
-
|
11
|
-
if billable_record.present?
|
12
|
-
track_user_session(billable_record)
|
13
|
-
else
|
14
|
-
track_guest_session
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def track_user_session(billable_record)
|
19
|
-
raise 'Record not billable' unless billable_record.acts_as.billable?
|
20
|
-
|
21
|
-
current_account = billable_record.accounts.first_or_create!
|
22
|
-
session[:current_account_id] = current_account.id
|
23
|
-
|
24
|
-
if current_order_group&.unassigned?
|
25
|
-
current_order_group.assign_account! current_account
|
26
|
-
else
|
27
|
-
current_order_group = current_account.order_groups.pending.first_or_create!
|
28
|
-
session[:current_order_group_id] = current_order_group.id
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def track_guest_session
|
33
|
-
# Check if the order already belongs to someone
|
34
|
-
return if current_order_group&.unassigned?
|
35
|
-
|
36
|
-
current_order_group = OrderGroup.create!
|
37
|
-
session[:current_order_group_id] = current_order_group.id
|
38
|
-
end
|
39
|
-
|
40
|
-
def current_order_group
|
41
|
-
order_group_id = session[:current_order_group_id]
|
42
|
-
OrderGroup.find_by(id: order_group_id)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<h1>Product#new</h1>
|
2
|
-
|
3
|
-
<% @product.errors.full_messages.each do |message| %>
|
4
|
-
<div class="alert alert-danger">
|
5
|
-
<%= message %>
|
6
|
-
</div>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<%= form_with model: [:accountability, @product], local: true do |f| %>
|
10
|
-
<div class="card my-3">
|
11
|
-
<div class="card-header">
|
12
|
-
<b>Info</b>
|
13
|
-
</div>
|
14
|
-
<div class="card-body">
|
15
|
-
<div class="form-row">
|
16
|
-
<div class="form-group col-md-8">
|
17
|
-
<%= f.label :name %>
|
18
|
-
<%= f.text_field :name, class: 'form-control' %>
|
19
|
-
</div>
|
20
|
-
<div class="form-group col-md-4">
|
21
|
-
<%= f.label :sku %>
|
22
|
-
<%= f.text_field :sku, class: 'form-control' %>
|
23
|
-
</div>
|
24
|
-
<div class="form-group col-md-4">
|
25
|
-
<%= f.label :price %>
|
26
|
-
<%= f.number_field :price, step: 2, class: 'form-control' %>
|
27
|
-
</div>
|
28
|
-
<div class="form-group col-md-12">
|
29
|
-
<%= f.label :description %>
|
30
|
-
<%= f.text_area :description, class: 'form-control' %>
|
31
|
-
</div>
|
32
|
-
<div class="form-group col-md-4">
|
33
|
-
<%= f.label :source_class, 'Category' %>
|
34
|
-
<%= f.select :source_class, Accountability::Offerable.collection.stringify_keys.keys.map(&:titleize), {}, {class: 'form-control' } %>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
<%= f.submit 'Submit', class: 'btn btn-success' %>
|
40
|
-
<% end %>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# TODO: Rewrite cartographer logic to be less flaky (see Devise)
|
2
|
-
|
3
|
-
module ActionDispatch::Routing
|
4
|
-
class Mapper
|
5
|
-
def accountability_views_for(*tenants)
|
6
|
-
options = tenants.extract_options!
|
7
|
-
|
8
|
-
options[:path_prefix] ||= options[:path] if options[:path_prefix].nil?
|
9
|
-
|
10
|
-
cartographer = proc do
|
11
|
-
namespace :accountability, path: options[:path_prefix], as: :accountability do
|
12
|
-
resources :accounts, only: %i[index show]
|
13
|
-
resources :products
|
14
|
-
resources :order_groups, path: 'orders' do
|
15
|
-
member do
|
16
|
-
post :add_item
|
17
|
-
end
|
18
|
-
end
|
19
|
-
root to: 'products#index'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
cartographer.call
|
24
|
-
|
25
|
-
Accountability::Engine.routes.draw(&cartographer)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|