effective_learndash 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4c40ac53a2b543a2ec07ef72b03c9a99c299c1a791c07e41b8d7293bf14aac
|
4
|
+
data.tar.gz: 317aae5636eab574dba9dcf5b05c8d5739b971d7f8b7c4b55e5b22acad2a1f99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a3c2d3e21f8c26f4fa36e46540d18d725b0f7f82a32b4ff066ef1eaa722fbed716ae8191e890bd343c8622493c099169bcda4d655916cd1a8edab938a26b940
|
7
|
+
data.tar.gz: 923e01c208aae2cdd5d77f7729f08f69cc319bf29996bfbcf1d4a47b50da57654d600864cce1f474781e5c6328b32076d47c8dc28fcaf380aacb01751ca1c5d9
|
data/README.md
CHANGED
@@ -71,6 +71,9 @@ All authorization checks are handled via the effective_resources gem found in th
|
|
71
71
|
The permissions you actually want to define are as follows (using CanCan):
|
72
72
|
|
73
73
|
```ruby
|
74
|
+
can(:show, Effective::LearndashUser) { |lduser| lduser.owner_id == user.id }
|
75
|
+
can(:index, Effective::LearndashEnrollment)
|
76
|
+
|
74
77
|
if user.admin?
|
75
78
|
can :admin, :effective_learndash
|
76
79
|
|
@@ -10,6 +10,17 @@ class EffectiveLearndashEnrollmentsDatatable < Effective::Datatable
|
|
10
10
|
|
11
11
|
col :date_started, as: :date
|
12
12
|
col :date_completed, as: :date
|
13
|
+
|
14
|
+
actions_col(show: false) do |enrollment|
|
15
|
+
if enrollment.not_started?
|
16
|
+
dropdown_link_to('Start', EffectiveLearndash.learndash_url, target: '_blank')
|
17
|
+
elsif enrollment.in_progress?
|
18
|
+
dropdown_link_to('Continue', EffectiveLearndash.learndash_url, target: '_blank')
|
19
|
+
else
|
20
|
+
dropdown_link_to('Show', EffectiveLearndash.learndash_url, target: '_blank')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
13
24
|
end
|
14
25
|
|
15
26
|
collection do
|
@@ -46,6 +46,14 @@ module Effective
|
|
46
46
|
persisted? ? "#{learndash_user} #{learndash_course}" : 'learndash enrollment'
|
47
47
|
end
|
48
48
|
|
49
|
+
def not_started?
|
50
|
+
progress_status == 'not-started'
|
51
|
+
end
|
52
|
+
|
53
|
+
def in_progress?
|
54
|
+
progress_status == 'in-progress'
|
55
|
+
end
|
56
|
+
|
49
57
|
def completed?
|
50
58
|
progress_status == 'completed'
|
51
59
|
end
|
@@ -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
|
13
|
+
= link_to('Learndash', EffectiveLearndash.learndash_url, target: '_blank')
|
14
|
+
|
15
|
+
- if learndash_user.present? && authorized
|
16
|
+
- learndash_user.check_and_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
|
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)
|