wco_models 3.1.0.31 → 3.1.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/vendor/bootstrap-4.6.2.min.js +7 -0
  3. data/app/assets/javascripts/vendor/fontawesome-5.0.13.js +5 -0
  4. data/app/assets/javascripts/vendor/fontawesome-5.15.4.min.js +5 -0
  5. data/app/assets/javascripts/vendor/fontawesome-solid-5.0.13.js +5 -0
  6. data/app/assets/javascripts/vendor/jquery-3.3.1.js +10364 -0
  7. data/app/assets/javascripts/vendor/jquery-3.3.1.min.js +2 -0
  8. data/app/assets/javascripts/vendor/jquery-3.3.1.slim.min.js +2 -0
  9. data/app/assets/javascripts/vendor/jquery-3.4.1.min.js +2 -0
  10. data/app/assets/javascripts/vendor/popper-1.14.0.min.js +5 -0
  11. data/app/assets/javascripts/wco/application.js +9 -0
  12. data/app/assets/javascripts/wco/collapse-expand.js +31 -0
  13. data/app/assets/stylesheets/vendor/bootstrap-4.6.2.min.css +7 -0
  14. data/app/assets/stylesheets/{wco_models → wco}/application.css +3 -1
  15. data/app/assets/stylesheets/{wco_models → wco}/utils.scss +32 -18
  16. data/app/controllers/wco/application_controller.rb +44 -0
  17. data/app/controllers/wco/prices_controller.rb +40 -0
  18. data/app/controllers/wco/products_controller.rb +100 -1
  19. data/app/controllers/wco/subscriptions_controller.rb +114 -0
  20. data/app/jobs/wco_hosting/certbot_job.rb +1 -1
  21. data/app/models/ability.rb +20 -0
  22. data/app/models/wco/leadset.rb +0 -1
  23. data/app/models/wco/price.rb +16 -7
  24. data/app/models/wco/product.rb +2 -0
  25. data/app/models/wco/subscription.rb +8 -10
  26. data/app/models/wco_hosting/appliance.rb +2 -1
  27. data/app/models/wco_hosting/appliance_tmpl.rb +21 -3
  28. data/app/views/layouts/wco/application.haml +33 -0
  29. data/app/views/wco/application/_auth_widget.haml +8 -0
  30. data/app/views/wco/application/home.haml +4 -0
  31. data/app/views/wco/prices/_form.haml +17 -0
  32. data/app/views/wco/products/_form.haml +29 -0
  33. data/app/views/wco/products/_list.haml +10 -0
  34. data/app/views/wco/products/_table.haml +20 -0
  35. data/app/views/wco/products/edit.haml +5 -0
  36. data/app/views/wco/products/index.haml +44 -0
  37. data/app/views/wco/products/show.haml +5 -0
  38. data/config/initializers/assets.rb +4 -0
  39. data/config/routes.rb +7 -0
  40. data/lib/wco/engine.rb +5 -2
  41. data/lib/wco_models.rb +8 -2
  42. metadata +87 -7
  43. data/app/controllers/ish_models/application_controller.rb +0 -4
  44. data/app/models/wco_email/tag.rb-trash +0 -15
  45. data/app/views/layouts/ish_models/application.html.erb +0 -15
@@ -1,7 +1,106 @@
1
1
 
2
- class Wco::ProductsController < ActionController::Base
2
+ class Wco::ProductsController < Wco::ApplicationController
3
+
4
+ # before_action :set_lists
5
+
6
+ # Alphabetized : )
7
+
8
+ def create
9
+ @product = Wco::Product.new params[:product].permit( :name )
10
+ authorize! :create, @product
11
+
12
+ stripe_product = Stripe::Product.create({ name: @product.name })
13
+ # puts! stripe_product, 'stripe_product'
14
+ flash_notice 'Created stripe product.'
15
+ @product.product_id = stripe_product[:id]
16
+
17
+ if @product.save
18
+ flash_notice 'Created wco product.'
19
+ else
20
+ flash_alert "Cannot create wco product: #{@product.errors.full_messages.join(', ')}."
21
+ end
22
+ redirect_to action: :index
23
+ end
24
+
25
+ def destroy
26
+ authorize! :destroy, Wco::Product
27
+ # product = Wco::Product.find params[:id]
28
+
29
+ flag = Stripe::Product.delete( params[:id] )
30
+ # puts! flag, 'flag'
31
+ flash[:notice] = flag
32
+ # if product.destroy
33
+ # flash[:notice] = 'Success'
34
+ # else
35
+ # flash[:alert] = "Cannot destroy product: #{product.errors.fill_messages.join(', ')}."
36
+ # end
37
+ redirect_to action: :index
38
+ end
39
+
40
+ def edit
41
+ @product = Wco::Product.find params[:id]
42
+ authorize! :edit, @product
43
+ end
3
44
 
4
45
  def index
46
+ authorize! :index, Wco::Product
47
+
48
+ @stripe_products = {}
49
+ @_stripe_products = Stripe::Product.list().data
50
+ @_stripe_prices = Stripe::Price.list().data
51
+
52
+ @_stripe_products.each do |sp|
53
+ @stripe_products[sp[:id]] = sp
54
+ @stripe_products[sp[:id]][:prices] ||= {}
55
+ end
56
+ @_stripe_prices.each do |price|
57
+ begin
58
+ @stripe_products[price[:product]][:prices][price[:id]] = price
59
+ rescue Exception
60
+ nil
61
+ end
62
+ end
63
+
64
+ @wco_products = Wco::Product.all.includes( :prices )
65
+ @wco_products.each do |item|
66
+ if @stripe_products[item[:product_id]]
67
+ @stripe_products[item[:product_id]][:wco_product] = item
68
+ end
69
+ end
70
+
71
+ ## 2023-09-07 @TODO: move to model:
72
+ ## @wco_prices_hash = Wco::Price.all.hash_by( :price_id )
73
+ ##
74
+ @wco_prices_hash = {}
75
+ @wco_prices = Wco::Price.all
76
+ @wco_prices.each do |item|
77
+ @wco_prices_hash[item[:price_id]] = item
78
+ end
79
+
80
+ end
81
+
82
+ def show
83
+ authorize! :show, @product
84
+ @product = Wco::Product.find params[:id]
5
85
  end
6
86
 
87
+ def update
88
+ authorize! :edit, @product
89
+ @product = Wco::Product.find params[:id]
90
+
91
+ if @product.update_attributes params[:product].permit!
92
+ flash[:notice] = 'Success.'
93
+ redirect_to action: :show, id: @product.id
94
+ else
95
+ flash[:alert] = "No luck: #{@product.errors.full_messages.join(', ')}."
96
+ render action: :edit
97
+ end
98
+
99
+ end
100
+
101
+ ##
102
+ ## private
103
+ ##
104
+ private
105
+
7
106
  end
@@ -0,0 +1,114 @@
1
+
2
+ class Wco::SubscriptionsController < Wco::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ ## Alphabetized : )
7
+
8
+ ##
9
+ ## A stripe subscription is currently single-item only.
10
+ ##
11
+ def create
12
+ @subscription = Wco::Subscription.new params[:subscription].permit!
13
+ authorize! :create, @subscription
14
+
15
+ @subscription.leadset_id = Leadset.where({ customer_id: params[:subscription][:customer_id] }).first&.id
16
+ @subscription.price = Wco::Price.find_by price_id: params[:subscription][:price_id]
17
+ @subscription.product = @subscription.price.product
18
+
19
+ if params[:is_stripe]
20
+ payment_methods = Stripe::Customer.list_payment_methods( params[:subscription][:customer_id] ).data
21
+ params = {
22
+ customer: params[:subscription][:customer_id],
23
+ default_payment_method: payment_methods[0][:id],
24
+ items: [
25
+ { price: params[:subscription][:price_id],
26
+ quantity: params[:subscription][:quantity],
27
+ },
28
+ ],
29
+ }
30
+ @stripe_subscription = Stripe::Subscription.create( params )
31
+ flash_notice @stripe_subscription
32
+ end
33
+
34
+
35
+ flag = @subscription.save
36
+ if flag
37
+ flash_notice @subscription
38
+ redirect_to action: :show, id: @subscription.id
39
+ else
40
+ flash_alert @subscription
41
+ redirect_to action: :new
42
+ end
43
+ end
44
+
45
+
46
+ def index
47
+ authorize! :index, Wco::Subscription
48
+
49
+ @stripe_customers = Stripe::Customer.list().data
50
+ @stripe_subscriptions = Stripe::Subscription.list().data
51
+
52
+ @customers = {} ## still stripe customers
53
+ customer_ids = @stripe_customers.map &:id
54
+ @leadsets = Leadset.where( :customer_id.in => customer_ids )
55
+ @leadsets.each do |i|
56
+ @customers[i[:customer_id]] ||= {}
57
+ @customers[i[:customer_id]][:leadsets] ||= []
58
+ @customers[i[:customer_id]][:leadsets].push( i )
59
+ end
60
+ @profiles = Ish::UserProfile.where( :customer_id.in => customer_ids )
61
+ @profiles.each do |i|
62
+ @customers[i[:customer_id]] ||= {}
63
+ @customers[i[:customer_id]][:profiles] ||= []
64
+ @customers[i[:customer_id]][:profiles].push( i )
65
+ end
66
+ # puts! @customers, '@customers'
67
+
68
+ @wco_subscriptions = Wco::Subscription.all
69
+
70
+ end
71
+
72
+ def new
73
+ @subscription = Wco::Subscription.new
74
+ authorize! :new, @subscription
75
+ end
76
+
77
+ def new_stripe
78
+ @subscription = Wco::Subscription.new
79
+ authorize! :new, @subscription
80
+ end
81
+
82
+ def new_wco
83
+ @subscription = Wco::Subscription.new
84
+ authorize! :new, @subscription
85
+ end
86
+
87
+ def show
88
+ @subscription = Wco::Subscription.find params[:id]
89
+ authorize! :show, @subscription
90
+ end
91
+
92
+ ##
93
+ ## private
94
+ ##
95
+ private
96
+
97
+ def set_lists
98
+ super
99
+ @products_list = Wco::Product.list
100
+ leadsets = Leadset.where( "customer_id IS NOT NULL" ).map { |i| [ "leadset // #{i.company_url} (#{i.email})", i.customer_id ] }
101
+ profiles = ::Ish::UserProfile.where( :customer_id.ne => nil ).map { |i| [ "profile // #{i.email}", i.customer_id ] }
102
+ @customer_ids_list = leadsets + profiles
103
+ @price_ids_list = Wco::Product.all.includes( :prices ).map do |i|
104
+ price = i.prices[0]
105
+ if price&.price_id
106
+ puts! price.interval, 'price.interval'
107
+ [ "#{i.name} // $#{price.amount_cents.to_f/100}/#{price.interval||'onetime'}", price.price_id ]
108
+ else
109
+ [ "#{i.name} - no price!!!", nil ]
110
+ end
111
+ end
112
+ end
113
+
114
+ end
@@ -2,7 +2,7 @@
2
2
  require 'net/scp'
3
3
  require 'open3'
4
4
 
5
- class CertbotJob
5
+ class WcoHosting::CertbotJob
6
6
  include Sidekiq::Job
7
7
  sidekiq_options queue: 'wasya_co_rb'
8
8
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # require 'cancancan'
4
+
5
+ ## v0.0.1 :: 2023-12-26
6
+ class Ability
7
+ include ::CanCan::Ability
8
+
9
+ def initialize(user)
10
+
11
+ if user
12
+
13
+ if [ 'piousbox@gmail.com', 'victor@piousbox.com', 'victor@wasya.co' ].include? user.email
14
+ can :manage, :all
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -5,7 +5,6 @@ class Wco::Leadset
5
5
  store_in collection: 'wco_leadsets'
6
6
 
7
7
  field :company_url
8
- def domain; company_url; end ## @TODO: remove
9
8
  validates :company_url, presence: true, uniqueness: true
10
9
  index({ company_url: 1 }, { name: 'company_url' })
11
10
 
@@ -3,21 +3,30 @@ class Wco::Price
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- belongs_to :product, class_name: 'Wco::Product', inverse_of: :prices
6
+ # belongs_to :product, class_name: 'Wco::Product', inverse_of: :prices
7
+ ## Wco::Product, WcoHosting::ApplianceTmpl:
8
+ belongs_to :product, polymorphic: true # , foreign_key: :wco_price_id
9
+
7
10
  has_many :subscriptions, class_name: 'Wco::Subscription', inverse_of: :price, foreign_key: :wco_price_id
8
11
 
9
12
  field :amount_cents, type: Integer
10
13
 
11
- INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
14
+ def to_s
15
+ price = self
16
+ "$#{ price[:amount_cents].to_f/100 }/#{ price.interval||'onetime' }"
17
+ end
18
+
19
+ INTERVAL_DAY = 'day'
20
+ INTERVAL_WEEK = 'week'
21
+ INTERVAL_MONTH = 'month'
22
+ INTERVAL_YEAD = 'year'
23
+ INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
12
24
  field :interval, type: String
13
25
 
14
26
  field :price_id # stripe
15
27
 
16
- def name
17
- "$#{ amount_cents.to_f/100 } / #{interval}"
18
- end
19
- def name_simple
20
- "$#{ amount_cents.to_f/100 }"
28
+ def self.list
29
+ [[nil,nil]] + all.map { |p| [ "#{p.product.name} :: #{p.amount_cents.to_f/100}/#{p.interval||'onetime'}", p.id ] }
21
30
  end
22
31
 
23
32
  end
@@ -9,6 +9,8 @@ class Wco::Product
9
9
 
10
10
  has_many :prices, class_name: 'Wco::Price', inverse_of: :product
11
11
 
12
+ has_many :subscriptions, as: :product
13
+
12
14
  def self.list
13
15
  [ [nil,nil] ] + self.all.order_by({ name: :asc }).map { |i| [i.name, i.id] }
14
16
  end
@@ -2,20 +2,18 @@
2
2
  class Wco::Subscription
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
+ store_in collection: 'wco_subscriptions'
5
6
 
6
- field :customer_id, type: :string # stripe
7
- field :price_id, type: :string # stripe
7
+ belongs_to :product, polymorphic: true # includes: Wco::Product , WcoHosting::ApplianceTmpl
8
8
 
9
- field :leadset_id
10
- def leadset
11
- Leadset.find leadset_id
12
- end
13
-
14
- field :quantity, type: :integer
15
-
16
- belongs_to :product, class_name: 'Wco::Product', inverse_of: :subscriptions
17
9
  belongs_to :price, class_name: 'Wco::Price', inverse_of: :subscriptions, foreign_key: :wco_price_id
10
+ field :price_id # stripe
11
+
18
12
  belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :subscriptions
13
+ field :customer_id # stripe
14
+
15
+ field :quantity, type: :integer
16
+
19
17
 
20
18
  end
21
19
 
@@ -4,7 +4,8 @@ class WcoHosting::Appliance
4
4
  include Mongoid::Timestamps
5
5
  store_in collection: 'wco_appliances'
6
6
 
7
- belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances
7
+ belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances
8
+ belongs_to :subscription, class_name: 'Wco::Subscription' # , inverse_of: :appliance
8
9
 
9
10
  field :service_name
10
11
  before_validation :set_service_name, on: :create, unless: ->{ service_name }
@@ -1,3 +1,4 @@
1
+ # require_relative '../wco/subscription'
1
2
 
2
3
  class WcoHosting::ApplianceTmpl
3
4
  include Mongoid::Document
@@ -11,6 +12,9 @@ class WcoHosting::ApplianceTmpl
11
12
  validates :version, uniqueness: { scope: :kind }, presence: true
12
13
  index({ kind: -1, version: -1 }, { name: :kind_version })
13
14
 
15
+ def name
16
+ "#{kind} #{version}"
17
+ end
14
18
  field :descr, type: :string
15
19
 
16
20
  field :image
@@ -42,16 +46,30 @@ class WcoHosting::ApplianceTmpl
42
46
  KIND_PRESTASHOP = 'prestashop'
43
47
  KIND_SMT = 'smt'
44
48
  KIND_WORDPRESS = 'wordpress'
49
+ KIND_TRASH = 'trash'
50
+ KIND_TMP = 'tmp'
45
51
 
46
- KINDS = [ KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR,
52
+ KINDS = [ nil, KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR,
47
53
  KIND_JENKINS, KIND_MATOMO, KIND_MOODLE, KIND_PRESTASHOP, KIND_SMT,
48
- KIND_WORDPRESS ]
54
+ KIND_WORDPRESS, KIND_TRASH, KIND_TMP ]
49
55
 
50
- has_many :appliances, class_name: 'WcoHosting::Appliance'
56
+ def self.list
57
+ # [[nil,nil]] + all.map { |t| [t.kind, t.id] }
58
+ KINDS
59
+ end
51
60
 
52
61
  def self.latest_of kind
53
62
  where({ kind: kind }).order_by({ version: :desc }).first
54
63
  end
55
64
 
65
+ has_many :appliances, class_name: 'WcoHosting::Appliance'
66
+
67
+ has_many :subscriptions, as: :product, class_name: 'Wco::Subscription'
68
+
69
+ # belongs_to :price, class_name: 'Wco::Price', foreign_key: :wco_price_id
70
+ has_one :price, as: :product, class_name: 'Wco::Price'
71
+ field :price_id # stripe
72
+
73
+
56
74
  end
57
75
  AppTmpl = WcoHosting::ApplianceTmpl
@@ -0,0 +1,33 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{content: "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}
5
+ %title Wco Models
6
+ = csrf_meta_tags
7
+ = csp_meta_tag
8
+ = javascript_include_tag "wco/application"
9
+ = stylesheet_link_tag "wco/application", media: "all"
10
+ %body
11
+
12
+ %h2 Wco Models
13
+ %nav.flex-row
14
+ %ul
15
+ %li= link_to 'ROOT', '/'
16
+ %li= link_to '/hosting', '/hosting'
17
+ %li= link_to '/email', '/email'
18
+ %ul
19
+ -# %li= link_to 'ApplianceTmpl`s', appliance_tmpls_path
20
+ -# %li= link_to 'Appliances', appliances_path
21
+ %li= link_to 'Products', products_path
22
+ -# %li= link_to 'Serverhosts', serverhosts_path
23
+ %hr
24
+
25
+ = render '/wco/application/alerts_notices'
26
+ %hr
27
+
28
+ = yield
29
+ %hr
30
+
31
+ -# = render '/wco/application/auth_widget'
32
+
33
+
@@ -0,0 +1,8 @@
1
+
2
+ .application--auth-widget
3
+ - if current_user
4
+ = current_user.email
5
+ = button_to 'Sign Out', "/users/sign_out", method: :delete, data: { confirm: 'Are you sure?' }
6
+ - else
7
+ -# = link_to 'Login', new_user_session_path
8
+ = button_to "Login", "/users/auth/keycloakopenid"
@@ -0,0 +1,4 @@
1
+
2
+ .application-home
3
+ %h5 WcoModels Home
4
+
@@ -0,0 +1,17 @@
1
+
2
+ -# - url = price.new_record? ? prices_path : price_path( price )
3
+ .products--prices-form
4
+
5
+ = form_for price, as: :price, html: { class: 'flex-row' } do |f|
6
+ = hidden_field_tag 'price[product_id]', price.product_id
7
+
8
+ .field
9
+ %label amount cents
10
+ = f.number_field :amount_cents
11
+
12
+ .field
13
+ %label interval
14
+ = f.select :interval, options_for_select( Wco::Price::INTERVALS, selected: price.interval ), class: 'select2'
15
+
16
+ .actions
17
+ = f.submit '>'
@@ -0,0 +1,29 @@
1
+
2
+ - url = product.new_record? ? products_path : product_path( product )
3
+ .products--form
4
+ = form_for product do |f|
5
+
6
+ .form-field
7
+ %label Name
8
+ = text_field_tag 'product[name]'
9
+
10
+ -# .form-field
11
+ -# %label Price in cents
12
+ -# = text_field_tag 'price[amount_cents]'
13
+
14
+ -# .form-field
15
+ -# %label Recurring?
16
+ -# = select_tag 'price[interval]', options_for_select(Wco::Price::INTERVALS)
17
+
18
+ .form-field
19
+ %label Stripe product_id
20
+ -# = f.text_field :product_id
21
+ = product.product_id
22
+
23
+ -# .form-field
24
+ -# %label Stripe price_id
25
+ -# -# = f.text_field :price_id
26
+ -# = product.price_id
27
+
28
+ .actions
29
+ = f.submit 'Submit'
@@ -0,0 +1,10 @@
1
+
2
+ %ol
3
+ - products.each do |product|
4
+ %li
5
+ = link_to '[~]', edit_product_path( product )
6
+ #{product.name} // $#{product.price_cents.to_f/100}/#{product.interval.presence || 'onetime'}
7
+ - if product.product_id
8
+ .ml-5 <b>product_id:</b> #{product.product_id}
9
+ - if product.price_id
10
+ .ml-5 <b>price_id:</b> #{product.price_id}
@@ -0,0 +1,20 @@
1
+
2
+ .products--index-table
3
+ %table.bordered.data-table
4
+ %thead
5
+ %tr
6
+ %th.name Name
7
+ %th.prices Prices
8
+
9
+ - products.each do |product|
10
+ %tr
11
+ %td.p-2
12
+ = link_to '[~]', edit_product_path( product )
13
+ = product.name
14
+ .gray= product.product_id
15
+ %td.p-2
16
+ %ul
17
+ - product.prices.each do |price|
18
+ %li
19
+ = price
20
+ .gray= price.price_id
@@ -0,0 +1,5 @@
1
+
2
+ .products-edit.max-width
3
+ %h5 Edit product
4
+
5
+ = render 'form', product: @product
@@ -0,0 +1,44 @@
1
+
2
+ .products-index.maxwidth
3
+
4
+ .a
5
+ %h5 New Product:
6
+ = render 'wco/products/form', product: Wco::Product.new
7
+ %hr
8
+
9
+ .row
10
+ .col-md-6
11
+ %h5.collapse-expand#stripeProducts
12
+ Stripe Products (#{@stripe_products.length}):
13
+ -# = link_to '[+]', new_product_path
14
+ %ol
15
+ - @stripe_products.each do |product_id, product|
16
+ %li
17
+ .flex-row
18
+ = button_to '[x]', product_path( product.id ), method: :delete, data: { :confirm => 'Are you sure?' }
19
+ = link_to '[~]', edit_product_path( product.id )
20
+ %span.gray= product.id
21
+ - if product[:wco_product]
22
+ = link_to product.name, product_path( product )
23
+ - else
24
+ = product.name
25
+ %ul
26
+ %li
27
+ New price:
28
+ = render 'wco/prices/form', price: Wco::Price.new({ product: product[:wco_product] })
29
+ - product[:prices].each do |price_id, price|
30
+ %li
31
+ %span.gray= price.id
32
+ - if @wco_prices_hash[price.id]
33
+ = link_to "#{price.unit_amount.to_f/100}/#{price.type}", price_path( @wco_prices_hash[price.id] )
34
+ - else
35
+ = "#{price.unit_amount.to_f/100}/#{price.type}"
36
+
37
+ %hr
38
+
39
+ .col-md-6
40
+ %h5.collapse-expand#wcoProducts
41
+ Wco::Product`s (#{@wco_products.length}):
42
+ = render 'table', products: @wco_products
43
+ -# = render 'list', products: @wco_products
44
+
@@ -0,0 +1,5 @@
1
+
2
+ .products-show.max-width
3
+ %h5
4
+ Show product #{@product.name}
5
+ = link_to '[~]', edit_product_path( @product )
@@ -0,0 +1,4 @@
1
+
2
+ Rails.application.config.assets.version = '1.0'
3
+
4
+ Rails.application.config.assets.precompile += %w( wco/application.js )
data/config/routes.rb CHANGED
@@ -1,3 +1,10 @@
1
1
 
2
2
  Wco::Engine.routes.draw do
3
+ root to: 'application#home'
4
+
5
+ resources :prices
6
+ resources :products
7
+
8
+ resources :subscriptions
9
+
3
10
  end
data/lib/wco/engine.rb CHANGED
@@ -1,4 +1,7 @@
1
1
 
2
- class Wco::Engine < ::Rails::Engine
3
- isolate_namespace Wco
2
+ module Wco
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Wco
5
+ end
4
6
  end
7
+
data/lib/wco_models.rb CHANGED
@@ -1,10 +1,16 @@
1
1
 
2
- # require 'mongoid'
2
+ require 'cancancan'
3
+ require 'devise'
4
+ require 'haml'
5
+
6
+ ## Fix for:
7
+ ## wco_hosting_rb/test/dummy/app/models/user.rb:3:in `<class:User>': uninitialized constant User::Mongoid (NameError)
8
+ require 'mongoid'
9
+
3
10
  require 'stripe'
4
11
 
5
12
  require "wco/engine"
6
13
 
7
- module IshModels; end
8
14
  module Wco; end
9
15
  module WcoEmail; end
10
16
  module WcoHosting; end