effective_learndash 0.1.3 → 0.1.4
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 +6 -0
- data/app/assets/config/effective_learndash_manifest.js +0 -1
- data/app/controllers/admin/course_registrations_controller.rb +8 -0
- data/app/controllers/effective/course_registrations_controller.rb +13 -0
- data/app/controllers/effective/learndash_courses_controller.rb +32 -0
- data/app/datatables/admin/effective_course_registrations_datatable.rb +28 -0
- data/app/datatables/admin/effective_learndash_courses_datatable.rb +4 -0
- data/app/datatables/admin/effective_learndash_enrollments_datatable.rb +1 -2
- data/app/datatables/effective_course_registrants_datatable.rb +24 -0
- data/app/datatables/effective_course_registrations_datatable.rb +35 -0
- data/app/datatables/effective_learndash_courses_datatable.rb +28 -0
- data/app/datatables/effective_learndash_enrollments_datatable.rb +4 -1
- data/app/models/concerns/effective_learndash_course_registration.rb +167 -0
- data/app/models/concerns/effective_learndash_owner.rb +1 -1
- data/app/models/effective/course_registrant.rb +53 -0
- data/app/models/effective/course_registration.rb +5 -0
- data/app/models/effective/learndash_api.rb +10 -1
- data/app/models/effective/learndash_course.rb +78 -3
- data/app/models/effective/learndash_enrollment.rb +7 -3
- data/app/models/effective/learndash_user.rb +5 -6
- data/app/views/admin/learndash_courses/_form.html.haml +25 -0
- data/app/views/admin/learndash_courses/_form_course_registration_content.html.haml +19 -0
- data/app/views/admin/learndash_courses/_form_learndash_course.html.haml +32 -0
- data/app/views/effective/course_registrations/_content.html.haml +10 -0
- data/app/views/effective/course_registrations/_course.html.haml +9 -0
- data/app/views/effective/course_registrations/_course_registration.html.haml +3 -0
- data/app/views/effective/course_registrations/_dashboard.html.haml +30 -0
- data/app/views/effective/course_registrations/_layout.html.haml +3 -0
- data/app/views/effective/course_registrations/_orders.html.haml +4 -0
- data/app/views/effective/course_registrations/_summary.html.haml +35 -0
- data/app/views/effective/course_registrations/billing.html.haml +15 -0
- data/app/views/effective/course_registrations/checkout.html.haml +6 -0
- data/app/views/effective/course_registrations/course.html.haml +21 -0
- data/app/views/effective/course_registrations/start.html.haml +24 -0
- data/app/views/effective/course_registrations/submitted.html.haml +16 -0
- data/app/views/effective/course_registrations/summary.html.haml +8 -0
- data/app/views/effective/learndash/_dashboard.html.haml +1 -1
- data/app/views/effective/learndash_courses/_learndash_course.html.haml +13 -0
- data/app/views/effective/learndash_courses/index.html.haml +5 -0
- data/app/views/effective/learndash_courses/show.html.haml +6 -0
- data/config/effective_learndash.rb +9 -0
- data/config/routes.rb +13 -3
- data/db/migrate/01_create_effective_learndash.rb.erb +98 -33
- data/lib/effective_learndash/engine.rb +1 -0
- data/lib/effective_learndash/version.rb +1 -1
- data/lib/effective_learndash.rb +6 -1
- data/lib/generators/effective_learndash/install_generator.rb +0 -1
- metadata +31 -2
@@ -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,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,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'
|
@@ -13,7 +13,7 @@
|
|
13
13
|
= link_to('Learndash', EffectiveLearndash.learndash_url, target: '_blank')
|
14
14
|
|
15
15
|
- if learndash_user.present? && authorized
|
16
|
-
- learndash_user.
|
16
|
+
- learndash_user.refresh!
|
17
17
|
|
18
18
|
%p Please sign into Learndash with the following credentials:
|
19
19
|
|
@@ -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,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,
|
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, :
|
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
|
-
|
3
|
-
|
4
|
-
|
2
|
+
def change
|
3
|
+
create_table :learndash_users do |t|
|
4
|
+
t.integer :owner_id
|
5
|
+
t.string :owner_type
|
5
6
|
|
6
|
-
|
7
|
+
t.datetime :last_synced_at
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# Wordpress
|
10
|
+
t.integer :user_id
|
11
|
+
t.string :email
|
12
|
+
t.string :username
|
13
|
+
t.string :password
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
t.timestamps
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
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
|
-
|
28
|
-
t.integer :owner_id
|
29
|
-
t.string :owner_type
|
92
|
+
t.integer :learndash_course_id
|
30
93
|
|
31
|
-
|
32
|
-
|
94
|
+
# Acts as Statused
|
95
|
+
t.string :status
|
96
|
+
t.text :status_steps
|
33
97
|
|
34
|
-
|
98
|
+
# Acts as Wizard
|
99
|
+
t.text :wizard_steps
|
35
100
|
|
36
|
-
|
37
|
-
|
101
|
+
# Dates
|
102
|
+
t.datetime :submitted_at
|
38
103
|
|
39
|
-
|
40
|
-
|
41
|
-
|
104
|
+
t.datetime :updated_at
|
105
|
+
t.datetime :created_at
|
106
|
+
end
|
42
107
|
|
43
|
-
|
44
|
-
|
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
|
|
data/lib/effective_learndash.rb
CHANGED
@@ -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
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_learndash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -179,25 +179,54 @@ files:
|
|
179
179
|
- app/assets/javascripts/effective_learndash/base.js
|
180
180
|
- app/assets/stylesheets/effective_learndash.scss
|
181
181
|
- app/assets/stylesheets/effective_learndash/base.scss
|
182
|
+
- app/controllers/admin/course_registrations_controller.rb
|
182
183
|
- app/controllers/admin/learndash_courses_controller.rb
|
183
184
|
- app/controllers/admin/learndash_enrollments_controller.rb
|
184
185
|
- app/controllers/admin/learndash_users_controller.rb
|
186
|
+
- app/controllers/effective/course_registrations_controller.rb
|
187
|
+
- app/controllers/effective/learndash_courses_controller.rb
|
188
|
+
- app/datatables/admin/effective_course_registrations_datatable.rb
|
185
189
|
- app/datatables/admin/effective_learndash_courses_datatable.rb
|
186
190
|
- app/datatables/admin/effective_learndash_enrollments_datatable.rb
|
187
191
|
- app/datatables/admin/effective_learndash_users_datatable.rb
|
192
|
+
- app/datatables/effective_course_registrants_datatable.rb
|
193
|
+
- app/datatables/effective_course_registrations_datatable.rb
|
194
|
+
- app/datatables/effective_learndash_courses_datatable.rb
|
188
195
|
- app/datatables/effective_learndash_enrollments_datatable.rb
|
189
196
|
- app/helpers/effective_learndash_helper.rb
|
197
|
+
- app/models/concerns/effective_learndash_course_registration.rb
|
190
198
|
- app/models/concerns/effective_learndash_owner.rb
|
199
|
+
- app/models/effective/course_registrant.rb
|
200
|
+
- app/models/effective/course_registration.rb
|
191
201
|
- app/models/effective/learndash_api.rb
|
192
202
|
- app/models/effective/learndash_course.rb
|
193
203
|
- app/models/effective/learndash_enrollment.rb
|
194
204
|
- app/models/effective/learndash_user.rb
|
205
|
+
- app/views/admin/learndash_courses/_form.html.haml
|
206
|
+
- app/views/admin/learndash_courses/_form_course_registration_content.html.haml
|
207
|
+
- app/views/admin/learndash_courses/_form_learndash_course.html.haml
|
195
208
|
- app/views/admin/learndash_courses/_learndash_course.html.haml
|
196
209
|
- app/views/admin/learndash_enrollments/_form.html.haml
|
197
210
|
- app/views/admin/learndash_owners/_form.html.haml
|
198
211
|
- app/views/admin/learndash_users/_form.html.haml
|
199
212
|
- app/views/admin/learndash_users/_learndash_user.html.haml
|
213
|
+
- app/views/effective/course_registrations/_content.html.haml
|
214
|
+
- app/views/effective/course_registrations/_course.html.haml
|
215
|
+
- app/views/effective/course_registrations/_course_registration.html.haml
|
216
|
+
- app/views/effective/course_registrations/_dashboard.html.haml
|
217
|
+
- app/views/effective/course_registrations/_layout.html.haml
|
218
|
+
- app/views/effective/course_registrations/_orders.html.haml
|
219
|
+
- app/views/effective/course_registrations/_summary.html.haml
|
220
|
+
- app/views/effective/course_registrations/billing.html.haml
|
221
|
+
- app/views/effective/course_registrations/checkout.html.haml
|
222
|
+
- app/views/effective/course_registrations/course.html.haml
|
223
|
+
- app/views/effective/course_registrations/start.html.haml
|
224
|
+
- app/views/effective/course_registrations/submitted.html.haml
|
225
|
+
- app/views/effective/course_registrations/summary.html.haml
|
200
226
|
- app/views/effective/learndash/_dashboard.html.haml
|
227
|
+
- app/views/effective/learndash_courses/_learndash_course.html.haml
|
228
|
+
- app/views/effective/learndash_courses/index.html.haml
|
229
|
+
- app/views/effective/learndash_courses/show.html.haml
|
201
230
|
- config/effective_learndash.rb
|
202
231
|
- config/routes.rb
|
203
232
|
- db/migrate/01_create_effective_learndash.rb.erb
|