effective_learndash 0.1.0 → 0.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f10afce8560043990198e9b364944ce9ed5d50f4c97f0a070074fa58a2e56014
|
4
|
+
data.tar.gz: b4f516fcd3ceac21941a5db7e7bb8a43766608bba652998dd5f6677c74b3eccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2d11bce9c397f42f95b823003530eedfe21feb80fa08a28d04c92272085906812b9dcf2685b798a171262ae1054661535394246e7374a7f5f3dcd941d4e939
|
7
|
+
data.tar.gz: 1eef5bd56979080599f509b17df4835370fc392d0eded403d39091b0d3974846e9462ed215df69835158d4c0e0d3dad7bc2bea9b9f8160ae34875179522268f9
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Dashboard LearndashUsers
|
2
|
+
class EffectiveLearndashEnrollmentsDatatable < Effective::Datatable
|
3
|
+
datatable do
|
4
|
+
col :learndash_course
|
5
|
+
col :progress_status
|
6
|
+
|
7
|
+
col :last_step, visible: false
|
8
|
+
col :steps_completed, visible: false
|
9
|
+
col :steps_total, visible: false
|
10
|
+
|
11
|
+
col :date_started, as: :date
|
12
|
+
col :date_completed, as: :date
|
13
|
+
end
|
14
|
+
|
15
|
+
collection do
|
16
|
+
Effective::LearndashEnrollment.deep.where(learndash_user: current_user.learndash_user)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -44,6 +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
|
52
|
+
|
47
53
|
def refresh!
|
48
54
|
assign_api_course_enrollments
|
49
55
|
save!
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- learndash_user = current_user.try(:learndash_user)
|
2
|
+
|
3
|
+
%h2 Learndash Courses
|
4
|
+
|
5
|
+
- if learndash_user.blank?
|
6
|
+
%p You do not have a Learndash account.
|
7
|
+
|
8
|
+
- if learndash_user.present?
|
9
|
+
- # This queries the API
|
10
|
+
- learndash_user.check_and_refresh!
|
11
|
+
|
12
|
+
%p
|
13
|
+
= succeed('.') do
|
14
|
+
You have an existing account on
|
15
|
+
= link_to('Learndash', EffectiveLearndash.learndash_url.chomp('/'), target: '_blank')
|
16
|
+
|
17
|
+
%ul
|
18
|
+
%li Email: #{learndash_user.email}
|
19
|
+
%li Username: #{learndash_user.username}
|
20
|
+
%li Password: #{learndash_user.password}
|
21
|
+
|
22
|
+
- if learndash_user&.learndash_enrollments.present?
|
23
|
+
%p You are enrolled in #{pluralize(learndash_user.learndash_enrollments.length, 'course')}.
|
24
|
+
|
25
|
+
- datatable = EffectiveResources.best('EffectiveLearndashEnrollmentsDatatable').new(self)
|
26
|
+
= render_datatable(datatable, simple: true)
|
27
|
+
- else
|
28
|
+
You are not enrolled in any Learndash courses.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- app/datatables/admin/effective_learndash_courses_datatable.rb
|
186
186
|
- app/datatables/admin/effective_learndash_enrollments_datatable.rb
|
187
187
|
- app/datatables/admin/effective_learndash_users_datatable.rb
|
188
|
+
- app/datatables/effective_learndash_enrollments_datatable.rb
|
188
189
|
- app/helpers/effective_learndash_helper.rb
|
189
190
|
- app/models/concerns/effective_learndash_owner.rb
|
190
191
|
- app/models/effective/learndash_api.rb
|
@@ -196,6 +197,7 @@ files:
|
|
196
197
|
- app/views/admin/learndash_owners/_form.html.haml
|
197
198
|
- app/views/admin/learndash_users/_form.html.haml
|
198
199
|
- app/views/admin/learndash_users/_learndash_user.html.haml
|
200
|
+
- app/views/effective/learndash/_dashboard.html.haml
|
199
201
|
- config/effective_learndash.rb
|
200
202
|
- config/routes.rb
|
201
203
|
- db/migrate/01_create_effective_learndash.rb.erb
|