effective_learndash 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/app/assets/config/effective_learndash_manifest.js +0 -1
  4. data/app/controllers/admin/course_registrations_controller.rb +8 -0
  5. data/app/controllers/effective/course_registrations_controller.rb +13 -0
  6. data/app/controllers/effective/learndash_courses_controller.rb +32 -0
  7. data/app/datatables/admin/effective_course_registrations_datatable.rb +28 -0
  8. data/app/datatables/admin/effective_learndash_courses_datatable.rb +4 -0
  9. data/app/datatables/admin/effective_learndash_enrollments_datatable.rb +1 -2
  10. data/app/datatables/effective_course_registrants_datatable.rb +24 -0
  11. data/app/datatables/effective_course_registrations_datatable.rb +35 -0
  12. data/app/datatables/effective_learndash_courses_datatable.rb +28 -0
  13. data/app/datatables/effective_learndash_enrollments_datatable.rb +15 -1
  14. data/app/models/concerns/effective_learndash_course_registration.rb +167 -0
  15. data/app/models/concerns/effective_learndash_owner.rb +1 -1
  16. data/app/models/effective/course_registrant.rb +53 -0
  17. data/app/models/effective/course_registration.rb +5 -0
  18. data/app/models/effective/learndash_api.rb +10 -1
  19. data/app/models/effective/learndash_course.rb +78 -3
  20. data/app/models/effective/learndash_enrollment.rb +15 -3
  21. data/app/models/effective/learndash_user.rb +5 -6
  22. data/app/views/admin/learndash_courses/_form.html.haml +25 -0
  23. data/app/views/admin/learndash_courses/_form_course_registration_content.html.haml +19 -0
  24. data/app/views/admin/learndash_courses/_form_learndash_course.html.haml +32 -0
  25. data/app/views/effective/course_registrations/_content.html.haml +10 -0
  26. data/app/views/effective/course_registrations/_course.html.haml +9 -0
  27. data/app/views/effective/course_registrations/_course_registration.html.haml +3 -0
  28. data/app/views/effective/course_registrations/_dashboard.html.haml +30 -0
  29. data/app/views/effective/course_registrations/_layout.html.haml +3 -0
  30. data/app/views/effective/course_registrations/_orders.html.haml +4 -0
  31. data/app/views/effective/course_registrations/_summary.html.haml +35 -0
  32. data/app/views/effective/course_registrations/billing.html.haml +15 -0
  33. data/app/views/effective/course_registrations/checkout.html.haml +6 -0
  34. data/app/views/effective/course_registrations/course.html.haml +21 -0
  35. data/app/views/effective/course_registrations/start.html.haml +24 -0
  36. data/app/views/effective/course_registrations/submitted.html.haml +16 -0
  37. data/app/views/effective/course_registrations/summary.html.haml +8 -0
  38. data/app/views/effective/learndash/_dashboard.html.haml +8 -5
  39. data/app/views/effective/learndash_courses/_learndash_course.html.haml +13 -0
  40. data/app/views/effective/learndash_courses/index.html.haml +5 -0
  41. data/app/views/effective/learndash_courses/show.html.haml +6 -0
  42. data/config/effective_learndash.rb +9 -0
  43. data/config/routes.rb +13 -3
  44. data/db/migrate/01_create_effective_learndash.rb.erb +98 -33
  45. data/lib/effective_learndash/engine.rb +1 -0
  46. data/lib/effective_learndash/version.rb +1 -1
  47. data/lib/effective_learndash.rb +6 -1
  48. data/lib/generators/effective_learndash/install_generator.rb +0 -1
  49. metadata +31 -2
@@ -44,13 +44,12 @@ module Effective
44
44
  owner&.to_s || username.presence || 'learndash user'
45
45
  end
46
46
 
47
- def check_and_refresh!
48
- return if last_synced_at.present? && (Time.zone.now - last_synced_at) < 10
49
- return if learndash_enrollments.none? { |enrollment| !enrollment.completed? }
50
- refresh!
51
- end
47
+ def refresh!(force: false)
48
+ unless force
49
+ return if last_synced_at.present? && (Time.zone.now - last_synced_at) < 5
50
+ return if learndash_enrollments.none? { |enrollment| !enrollment.completed? }
51
+ end
52
52
 
53
- def refresh!
54
53
  assign_api_course_enrollments
55
54
  save!
56
55
  end
@@ -0,0 +1,25 @@
1
+ = tabs do
2
+ = tab "Learndash Course" do
3
+ = render 'admin/learndash_courses/form_learndash_course', learndash_course: learndash_course
4
+
5
+ - if learndash_course.persisted?
6
+ = tab 'Enrollments' do
7
+ %h2 Enrollments
8
+ %p Click the New button from the below table to enroll a user into this course.
9
+ %p Enrolling a user here will enroll them on the Learndash site.
10
+ %p Alternately, if this course is available for registration, the enrollment will be created upon registration purchase.
11
+
12
+ - datatable = Admin::EffectiveLearndashEnrollmentsDatatable.new(learndash_course: learndash_course)
13
+ = render_datatable(datatable, inline: true)
14
+
15
+ = tab 'Registrations' do
16
+ %h2 Purchases
17
+ - datatable = Admin::EffectiveCourseRegistrationsDatatable.new(learndash_course: learndash_course)
18
+ = render_inline_datatable(datatable)
19
+
20
+ = tab 'Wizard' do
21
+ = render '/admin/learndash_courses/form_course_registration_content', learndash_course: learndash_course
22
+
23
+ - if learndash_course.respond_to?(:log_changes_datatable)
24
+ = tab "Logs" do
25
+ = render_inline_datatable(learndash_course.log_changes_datatable)
@@ -0,0 +1,19 @@
1
+ %p Each of the following content areas will be displayed on the course purchase wizard.
2
+
3
+ = effective_form_with(model: [:admin, learndash_course], engine: true) do |f|
4
+ = card("All Steps") do
5
+ = f.rich_text_area "rich_text_all_steps_content", label: false,
6
+ hint: "displayed on all steps"
7
+
8
+ %hr
9
+
10
+ - enabled = EffectiveLearndash.CourseRegistration.all_wizard_steps
11
+
12
+ - EffectiveLearndash.CourseRegistration::WIZARD_STEPS.each do |step, title|
13
+ - next unless enabled.include?(step)
14
+
15
+ = card("#{title}") do
16
+ = f.rich_text_area "rich_text_#{step}_content", label: false,
17
+ hint: "displayed on the course purchase wizard #{step} wizard step only"
18
+
19
+ = f.submit
@@ -0,0 +1,32 @@
1
+ = effective_form_with(model: [:admin, learndash_course], engine: true) do |f|
2
+ = f.static_field :title
3
+
4
+ = f.static_field :learndash_course_url do
5
+ = link_to(learndash_course.link, learndash_course.link, target: '_blank')
6
+
7
+ = f.static_field :learndash_course_admin do
8
+ = link_to "Learndash LMS Course Admin", EffectiveLearndash.learndash_url.chomp('/') + "/wp-admin/post.php?post=#{learndash_course.course_id}&action=edit", target: '_blank'
9
+
10
+ - if f.object.persisted? || f.object.errors.include?(:slug)
11
+ - current_url = (effective_learndash.learndash_course_url(f.object) rescue nil)
12
+ = f.text_field :slug, hint: "The slug controls this course's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This course is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url }".html_safe
13
+
14
+ = f.check_box :can_register, label: 'Yes, this course is displayed and available for registration'
15
+
16
+ = f.show_if :can_register, true do
17
+ = card('Pricing Information') do
18
+ %p.text-muted
19
+ Charge the following amounts during course registration. Enter $0 for free.
20
+
21
+ .row
22
+ .col-lg-3= f.price_field :regular_price, label: 'Price to applicants or new users'
23
+
24
+ .row
25
+ .col-lg-3= f.price_field :member_price, label: 'Price to existing members'
26
+
27
+ = f.check_box :tax_exempt
28
+
29
+ .row
30
+ .col-lg-3= f.text_field :qb_item_name, label: "Quickbooks Item Name"
31
+
32
+ = f.submit
@@ -0,0 +1,10 @@
1
+ - all_steps_content = resource.learndash_course&.rich_text_all_steps_content
2
+ - step_content = resource.learndash_course&.send("rich_text_#{step}_content")
3
+
4
+ - if all_steps_content.present?
5
+ .card.mb-4
6
+ .card-body= all_steps_content
7
+
8
+ - if step_content.present?
9
+ .card.mb-4
10
+ .card-body= step_content
@@ -0,0 +1,9 @@
1
+ = card do
2
+ .row
3
+ .col-sm
4
+ %h5.card-title= course_registration.wizard_step_title(:course)
5
+ .col-sm-auto.text-right
6
+ = link_to('Edit', wizard_path(:course)) if edit_effective_wizard?
7
+
8
+ - datatable = EffectiveCourseRegistrantsDatatable.new(course_registration: course_registration)
9
+ .mb-4= render_simple_datatable(datatable)
@@ -0,0 +1,3 @@
1
+ .effective-course-registration
2
+ - course_registration.render_steps.each do |partial|
3
+ = render "effective/course_registrations/#{partial}", course_registration: course_registration, step: partial
@@ -0,0 +1,30 @@
1
+ -# In progress course purchase
2
+ - wizard = EffectiveLearndash.CourseRegistration.in_progress.for(current_user).first
3
+ - datatable = EffectiveResources.best('EffectiveCourseRegistrationsDatatable').new(self, namespace: :effective)
4
+
5
+ - if wizard.present?
6
+ %h2 In Progress Course Registrations
7
+
8
+ %p
9
+ Your course registration for
10
+ = link_to(wizard.learndash_course, effective_learndash.learndash_course_path(wizard.learndash_course))
11
+ is incomplete
12
+
13
+ %p
14
+ Please
15
+ = link_to("Continue registration for #{wizard.learndash_course}", effective_learndash.learndash_course_course_registration_build_path(wizard.learndash_course, wizard, wizard.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
16
+ or you can
17
+ = link_to('Abandon course registration', effective_learndash.learndash_course_course_registration_path(wizard.learndash_course, wizard), 'data-confirm': "Really delete #{wizard}?", 'data-method': :delete, class: 'btn btn-danger')
18
+ to register for another course.
19
+
20
+ %hr
21
+
22
+ %h2 Course Registrations
23
+
24
+ - if datatable.present?
25
+ = render_simple_datatable(datatable)
26
+ - else
27
+ %p You have no past course registrations. When you do, we'll show them here.
28
+
29
+ - if false
30
+ %p= link_to 'View all Course', effective_learndash.learndash_courses_path, class: 'btn btn-primary'
@@ -0,0 +1,3 @@
1
+ .row
2
+ .col-lg-3.mb-3= render_wizard_sidebar(resource)
3
+ .col-lg-9= yield
@@ -0,0 +1,4 @@
1
+ - if course_registration.submit_order&.purchased?
2
+ .card.mb-4
3
+ .card-body
4
+ = render(course_registration.submit_order)
@@ -0,0 +1,35 @@
1
+ = card('Course Registration') do
2
+ %table.table.table-sm
3
+ %tbody
4
+ %tr
5
+ %th.border-0 Learndash Course
6
+ %td.border-0
7
+ %p= link_to(course_registration.course, EffectiveLearndash.learndash_url, target: '_blank')
8
+
9
+ %p Please sign into Learndash with the following credentials:
10
+ - learndash_user = course_registration.learndash_owner.learndash_user
11
+
12
+ %ul
13
+ %li Email: #{learndash_user.email}
14
+ %li Username: #{learndash_user.username}
15
+ %li Password: #{learndash_user.password}
16
+
17
+ %p= link_to('Learndash LMS', EffectiveLearndash.learndash_url, target: '_blank')
18
+
19
+ - if request.path.start_with?('/admin')
20
+ %tr
21
+ %th Registered by
22
+ %td
23
+ - url = (polymorphic_admin_path(course_registration.owner) rescue "/admin/users/#{course_registration.owner.to_param}/edit")
24
+ = link_to(course_registration.owner, url)
25
+ - else
26
+ %tr
27
+ %th Registered by
28
+ %td= course_registration.owner
29
+
30
+ - if course_registration.orders.present?
31
+ %tr
32
+ %th Order
33
+ %td
34
+ - course_registration.orders.each do |order|
35
+ = link_to(order, effective_orders.order_path(order))
@@ -0,0 +1,15 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ - raise('expected owner to respond to billing_address') unless resource.owner.respond_to?(:billing_address)
5
+
6
+ = card('Billing Address') do
7
+ %p Please enter your billing address
8
+
9
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
+ = f.hidden_field :id
11
+
12
+ = f.fields_for(:owner, f.object.owner) do |fu|
13
+ = effective_address_fields(fu, :billing)
14
+
15
+ = f.save 'Save and Continue'
@@ -0,0 +1,6 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ = render_checkout_step2(resource.submit_order, purchased_url: wizard_path(:submitted), deferred_url: wizard_path(:checkout), declined_url: wizard_path(:checkout))
@@ -0,0 +1,21 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ = card('Course') do
5
+ = render('effective/learndash_courses/learndash_course', learndash_course: resource.learndash_course)
6
+
7
+ %p You qualify for #{resource.member_pricing? ? 'member' : 'regular'} pricing.
8
+
9
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
10
+ = f.hidden_field :id
11
+
12
+ = f.fields_for :course_registrants, (f.object.course_registrant || f.object.build_course_registrant) do |fr|
13
+ = fr.hidden_field :course_registration_id
14
+ = fr.hidden_field :course_registration_type
15
+
16
+ = fr.hidden_field :owner_id
17
+ = fr.hidden_field :owner_type
18
+
19
+ = fr.hidden_field :learndash_course_id
20
+
21
+ = f.save 'Save and Continue'
@@ -0,0 +1,24 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ .card
5
+ .card-body
6
+ %p Welcome #{current_user}!
7
+
8
+ %p You are registering for #{resource.course}.
9
+
10
+ - existing = resource.owner.learndash_user&.enrollment(course: resource.course)
11
+
12
+ - if existing.present?
13
+ .alert.alert-warning
14
+ You are already enrolled in #{link_to(resource.course, EffectiveLearndash.learndash_url, target: '_blank')}.
15
+
16
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
17
+ = f.hidden_field :id
18
+
19
+ = f.hidden_field :learndash_course_id
20
+
21
+ = f.hidden_field :owner_type
22
+ = f.hidden_field :owner_id
23
+
24
+ = f.save 'Save and Continue'
@@ -0,0 +1,16 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ - raise('expected a submitted course_registration') unless resource.was_submitted?
5
+ - raise('expected a purchased course_registration submit_order') unless resource.submit_order&.purchased?
6
+
7
+ .alert.alert-warning.mb-4
8
+ Successfully paid on #{resource.submit_order.purchased_at.strftime('%F')}.
9
+
10
+ = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
11
+
12
+ = render 'effective/course_registrations/summary', course_registration: resource
13
+ = render 'effective/course_registrations/course_registration', course_registration: resource
14
+ = render 'effective/course_registrations/orders', course_registration: resource
15
+
16
+ = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary'
@@ -0,0 +1,8 @@
1
+ = render 'layout' do
2
+ = render 'effective/course_registrations/content', resource: resource
3
+
4
+ = render('effective/course_registrations/course_registration', course_registration: resource)
5
+
6
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
+ = f.hidden_field :id
8
+ = f.submit 'Save and Continue', class: 'btn btn-primary'
@@ -1,4 +1,5 @@
1
1
  - learndash_user = current_user.try(:learndash_user)
2
+ - authorized = learndash_user && EffectiveResources.authorized?(self, :show, learndash_user)
2
3
 
3
4
  %h2 Learndash Courses
4
5
 
@@ -6,20 +7,22 @@
6
7
  %p You do not have a Learndash account.
7
8
 
8
9
  - if learndash_user.present?
9
- - # This queries the API
10
- - learndash_user.check_and_refresh!
11
-
12
10
  %p
13
11
  = succeed('.') do
14
12
  You have an existing account on
15
- = link_to('Learndash', EffectiveLearndash.learndash_url.chomp('/'), target: '_blank')
13
+ = link_to('Learndash', EffectiveLearndash.learndash_url, target: '_blank')
14
+
15
+ - if learndash_user.present? && authorized
16
+ - learndash_user.refresh!
17
+
18
+ %p Please sign into Learndash with the following credentials:
16
19
 
17
20
  %ul
18
21
  %li Email: #{learndash_user.email}
19
22
  %li Username: #{learndash_user.username}
20
23
  %li Password: #{learndash_user.password}
21
24
 
22
- - if learndash_user&.learndash_enrollments.present?
25
+ - if learndash_user.learndash_enrollments.present?
23
26
  %p You are enrolled in #{pluralize(learndash_user.learndash_enrollments.length, 'course')}.
24
27
 
25
28
  - datatable = EffectiveResources.best('EffectiveLearndashEnrollmentsDatatable').new(self)
@@ -0,0 +1,13 @@
1
+ %table.table.effective-learndash-courses-table
2
+ %tbody
3
+ %tr
4
+ %th Regular Price
5
+ %td= price_to_currency(learndash_course.regular_price)
6
+ %tr
7
+ %th Member Price
8
+ %td= price_to_currency(learndash_course.member_price)
9
+
10
+ - if learndash_course.body.present?
11
+ %tr
12
+ %th Description
13
+ %td= learndash_course.body
@@ -0,0 +1,5 @@
1
+ = card do
2
+ - if @datatable.present?(self)
3
+ = render_datatable(@datatable, simple: true)
4
+ - else
5
+ %p There are no courses available for purchase. When there are, we'll show them here.
@@ -0,0 +1,6 @@
1
+ .effective-learndash-course
2
+ - if @learndash_course.registerable?
3
+ .resource-buttons
4
+ = link_to 'Register', effective_learndash.new_learndash_course_course_registration_path(@learndash_course), class: 'btn btn-primary'
5
+
6
+ = render 'effective/learndash_courses/learndash_course', learndash_course: @learndash_course
@@ -15,4 +15,13 @@ EffectiveLearndash.setup do |config|
15
15
  # Usernames can only contain lowercase letters (a-z) and numbers.
16
16
  # config.wp_username = Proc.new { |user| "user#{user.id}" }
17
17
  # config.wp_password = Proc.new { |user| SecureRandom.base64(12) }
18
+
19
+ # Course Purchase Wizard Settings
20
+ # config.course_registration_class_name = 'Effective::CourseRegistration'
21
+
22
+ # Pagination length on the Events#index page
23
+ config.per_page = 10
24
+
25
+ # Events can be restricted by role
26
+ config.use_effective_roles = true
18
27
  end
data/config/routes.rb CHANGED
@@ -5,10 +5,19 @@ Rails.application.routes.draw do
5
5
  end
6
6
 
7
7
  EffectiveLearndash::Engine.routes.draw do
8
+ # Public routes
9
+ scope module: 'effective' do
10
+ resources :learndash_courses, only: [:index, :show] do
11
+ resources :course_registrations, only: [:new, :show, :destroy] do
12
+ resources :build, controller: :course_registrations, only: [:show, :update]
13
+ end
14
+ end
15
+ end
16
+
8
17
  namespace :admin do
9
18
  get '/learndash', to: 'learndash#index', as: :learndash
10
19
 
11
- resources :learndash_users, only: [:index, :show, :new, :create, :update] do
20
+ resources :learndash_users, except: [:edit, :destroy] do
12
21
  post :refresh, on: :member
13
22
  end
14
23
 
@@ -16,10 +25,11 @@ EffectiveLearndash::Engine.routes.draw do
16
25
  post :refresh, on: :member
17
26
  end
18
27
 
19
- resources :learndash_courses, only: [:index, :show, :update] do
28
+ resources :learndash_courses, only: [:index, :edit, :update] do
20
29
  get :refresh, on: :collection
21
30
  end
22
31
 
32
+ resources :course_registrants, only: [:index]
33
+ resources :course_registrations, only: [:index, :show]
23
34
  end
24
-
25
35
  end
@@ -1,48 +1,113 @@
1
1
  class CreateEffectiveLearndash < ActiveRecord::Migration[6.1]
2
- create_table :learndash_users do |t|
3
- t.integer :owner_id
4
- t.string :owner_type
2
+ def change
3
+ create_table :learndash_users do |t|
4
+ t.integer :owner_id
5
+ t.string :owner_type
5
6
 
6
- t.datetime :last_synced_at
7
+ t.datetime :last_synced_at
7
8
 
8
- # Wordpress
9
- t.integer :user_id
10
- t.string :email
11
- t.string :username
12
- t.string :password
9
+ # Wordpress
10
+ t.integer :user_id
11
+ t.string :email
12
+ t.string :username
13
+ t.string :password
13
14
 
14
- t.timestamps
15
- end
15
+ t.timestamps
16
+ end
16
17
 
17
- create_table :learndash_courses do |t|
18
- # Wordpress
19
- t.integer :course_id
20
- t.string :status
21
- t.string :title
22
- t.string :link
18
+ create_table :learndash_courses do |t|
19
+ # Wordpress
20
+ t.integer :course_id
21
+ t.string :status
22
+ t.string :title
23
+ t.string :link
23
24
 
24
- t.timestamps
25
- end
25
+ # Our attributes
26
+ t.string :slug
27
+
28
+ t.integer :roles_mask
29
+ t.boolean :authenticate_user, default: false
30
+
31
+ # Course Purchases
32
+ t.boolean :can_register, default: false
33
+
34
+ t.integer :regular_price
35
+ t.integer :member_price
36
+
37
+ t.string :qb_item_name
38
+ t.boolean :tax_exempt, default: false
39
+
40
+ t.timestamps
41
+ end
42
+
43
+ create_table :learndash_enrollments do |t|
44
+ t.integer :owner_id
45
+ t.string :owner_type
46
+
47
+ t.integer :learndash_course_id
48
+ t.integer :learndash_user_id
49
+
50
+ t.datetime :last_synced_at
51
+
52
+ # Wordpress
53
+ t.string :progress_status
54
+
55
+ t.integer :last_step
56
+ t.integer :steps_completed
57
+ t.integer :steps_total
58
+
59
+ t.datetime :date_started
60
+ t.datetime :date_completed
61
+
62
+ t.timestamps
63
+ end
64
+
65
+ create_table :course_registrants do |t|
66
+ t.integer :owner_id
67
+ t.string :owner_type
68
+
69
+ t.integer :course_registration_id
70
+ t.string :course_registration_type
71
+
72
+ t.integer :learndash_course_id
73
+
74
+ # Acts as purchasable
75
+ t.integer :purchased_order_id
76
+ t.integer :price
77
+ t.boolean :tax_exempt, default: false
78
+ t.string :qb_item_name
79
+
80
+ t.timestamps
81
+ end
82
+
83
+ create_table :course_registrations do |t|
84
+ t.string :token
85
+
86
+ t.integer :owner_id
87
+ t.string :owner_type
88
+
89
+ t.integer :user_id
90
+ t.string :user_type
26
91
 
27
- create_table :learndash_enrollments do |t|
28
- t.integer :owner_id
29
- t.string :owner_type
92
+ t.integer :learndash_course_id
30
93
 
31
- t.integer :learndash_course_id
32
- t.integer :learndash_user_id
94
+ # Acts as Statused
95
+ t.string :status
96
+ t.text :status_steps
33
97
 
34
- t.datetime :last_synced_at
98
+ # Acts as Wizard
99
+ t.text :wizard_steps
35
100
 
36
- # Wordpress
37
- t.string :progress_status
101
+ # Dates
102
+ t.datetime :submitted_at
38
103
 
39
- t.integer :last_step
40
- t.integer :steps_completed
41
- t.integer :steps_total
104
+ t.datetime :updated_at
105
+ t.datetime :created_at
106
+ end
42
107
 
43
- t.datetime :date_started
44
- t.datetime :date_completed
108
+ add_index :course_registrations, [:owner_id, :owner_type]
109
+ add_index :course_registrations, :status
110
+ add_index :course_registrations, :token
45
111
 
46
- t.timestamps
47
112
  end
48
113
  end
@@ -15,6 +15,7 @@ module EffectiveLearndash
15
15
  initializer 'effective_learndash.active_record' do |app|
16
16
  ActiveSupport.on_load :active_record do
17
17
  ActiveRecord::Base.extend(EffectiveLearndashOwner::Base)
18
+ ActiveRecord::Base.extend(EffectiveLearndashCourseRegistration::Base)
18
19
  end
19
20
  end
20
21
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveLearndash
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
@@ -11,7 +11,8 @@ module EffectiveLearndash
11
11
  [
12
12
  :learndash_url, :learndash_username, :learndash_password,
13
13
  :wp_username, :wp_password,
14
- :layout
14
+ :layout, :per_page, :use_effective_roles,
15
+ :course_registration_class_name
15
16
  ]
16
17
  end
17
18
 
@@ -49,4 +50,8 @@ module EffectiveLearndash
49
50
  owner.instance_exec(owner, &wp_password)
50
51
  end
51
52
 
53
+ def self.CourseRegistration
54
+ course_registration_class_name&.constantize || Effective::CourseRegistration
55
+ end
56
+
52
57
  end
@@ -20,7 +20,6 @@ module EffectiveLearndash
20
20
  end
21
21
 
22
22
  def create_migration_file
23
- @learndash_courses_table_name = ':' + EffectiveLearndash.learndash_courses_table_name.to_s
24
23
  migration_template ('../' * 3) + 'db/migrate/01_create_effective_learndash.rb.erb', 'db/migrate/create_effective_learndash.rb'
25
24
  end
26
25