Compare commits

...

445 Commits

Author SHA1 Message Date
Jannat Patel
f5af07086b Merge branch 'main' of https://github.com/frappe/school into rename-app-to-school 2021-10-19 19:20:31 +05:30
Jannat Patel
4d534db63f Merge pull request #241 from pateljannat/fix-styles 2021-10-19 19:18:46 +05:30
Jannat Patel
aec69e96cb fix: style for certificate button and card responsive 2021-10-19 19:09:42 +05:30
Jannat Patel
6172b09aa3 fix: conflicts 2021-10-19 12:37:16 +05:30
Jannat Patel
98c386729c Merge pull request #240 from pateljannat/fix-translation-issue 2021-10-18 13:29:58 +05:30
Jannat Patel
91ebcd8253 fix: translation issue 2021-10-18 13:28:48 +05:30
Jannat Patel
3a51299e8d Merge pull request #239 from pateljannat/fix-rating-issue 2021-10-18 13:18:26 +05:30
Jannat Patel
eaa8876f4e fix: made quotes same throughout file 2021-10-18 13:13:19 +05:30
Jannat Patel
7d80178b48 fix: allow import on course chapter lesson quiz 2021-10-18 13:02:11 +05:30
Jannat Patel
8090f2f397 fix: made strings translatable 2021-10-18 12:43:34 +05:30
Jannat Patel
bf986e26bc fix: rating issue 2021-10-18 12:24:37 +05:30
Jannat Patel
c95d957d2c refactor: build file and patch 2021-10-13 13:51:41 +05:30
Jannat Patel
b1aaddae59 Merge pull request #235 from anandology/fix-reindex-exercises
fix: error on reindex-exercises
2021-10-12 17:23:13 +05:30
Anand Chitipothu
8fe9bad2bb fix: error on reindex-exercises
Issue fossunited/mon_school#69
2021-10-12 12:38:26 +05:30
Jannat Patel
23dab6312d Merge pull request #233 from pateljannat/quiz-question-length-issue
fix: quiz question length issue
2021-10-12 10:48:32 +05:30
Jannat Patel
c91b1a7a23 fix: quiz question length issue 2021-10-12 10:34:15 +05:30
Jannat Patel
d07dbcc50a refactor: renamed app to school 2021-10-11 20:31:27 +05:30
Jannat Patel
49771a627d Merge pull request #232 from anandology/ignore-xss-for-lesson
fix: fixed the issue of lesson body getting mangled on save
2021-10-11 17:13:50 +05:30
Anand Chitipothu
25ec4ae7c6 fix: fixed the issue of lesson body getting mangled on save
enabled `ignore_xss_filter` for lesson body to disable sanitizing the
input.

Issue #231
2021-10-11 15:34:16 +05:30
Jannat Patel
13022e0bcc Merge pull request #229 from pateljannat/ix-profile-cards 2021-10-08 20:34:58 +05:30
pateljannat
cdc4b6992d fix: clickable course cards from profile page 2021-10-08 20:28:06 +05:30
Jannat Patel
f178f3806d Merge pull request #224 from pateljannat/change-patch-sequence 2021-10-06 21:52:34 +05:30
pateljannat
d84f621813 fix: patch sequence 2021-10-06 21:33:13 +05:30
Jannat Patel
7ba2ac1efd Merge pull request #222 from pateljannat/ci-fix 2021-10-04 13:39:51 +05:30
Jannat Patel
658a9e6172 fix: path to frappe-bench 2021-10-04 13:26:06 +05:30
Jannat Patel
0b44e78cc2 fix: removed frappe-path 2021-10-04 13:20:08 +05:30
Jannat Patel
1c5766d022 Merge pull request #205 from pateljannat/discussions-shift 2021-10-04 13:10:56 +05:30
pateljannat
3bff000cc9 fix: bench init command 2021-10-04 12:21:02 +05:30
pateljannat
30a8750f16 fix: ci 2021-10-04 10:34:47 +05:30
pateljannat
f3ad3f6d18 Merge branch 'main' of https://github.com/fossunited/community into discussions-shift 2021-10-03 12:12:31 +05:30
Jannat Patel
65a7dde47b Merge pull request #221 from pateljannat/fix-progress-api 2021-10-02 19:50:02 +05:30
pateljannat
38ebab59c7 fix: api call for progress save 2021-10-02 19:39:27 +05:30
Jannat Patel
b7f79b4832 Merge pull request #217 from pateljannat/remove-unused-doctypes 2021-10-02 19:00:21 +05:30
pateljannat
876a2f562f fix: conflicts 2021-10-02 18:54:05 +05:30
Jannat Patel
5f4fc2fb59 Merge pull request #219 from pateljannat/reload-doctypes-in-patch
fix: relaod doctypes in patch
2021-10-02 13:25:41 +05:30
pateljannat
44e8efd39b fix: relaod doctypes in patch 2021-10-02 13:12:04 +05:30
Jannat Patel
51c625da4d Merge pull request #218 from pateljannat/courses-page-headings 2021-10-01 19:40:50 +05:30
pateljannat
a795cd23a8 fix: conflicts 2021-10-01 11:52:20 +05:30
pateljannat
ebc3cf1cbf feat: live and upcoming course headers 2021-09-30 18:31:41 +05:30
pateljannat
c717b3ba9d fix: removed unused folders 2021-09-30 17:54:59 +05:30
pateljannat
0ed3c87f79 fix: conflicts 2021-09-30 17:36:15 +05:30
Jannat Patel
9499700988 Merge pull request #216 from pateljannat/rename-chapters-and-lessons
fix: renamed chapter and lesson doctype
2021-09-30 17:17:42 +05:30
pateljannat
8366721643 fix: indentation 2021-09-30 17:09:35 +05:30
pateljannat
66afd0fcdd fix: remove unused doctype 2021-09-30 16:20:44 +05:30
pateljannat
a105a1d3b4 fix: removed chapter and lesson links 2021-09-30 15:04:19 +05:30
pateljannat
5488947922 fix: rename parenttype for lesson reference 2021-09-30 11:27:27 +05:30
Jannat Patel
aa466f9fb7 Merge pull request #215 from fossunited/duplicate-course-interest 2021-09-30 11:24:59 +05:30
pateljannat
b3840e056f fix: naming series 2021-09-29 19:37:37 +05:30
pateljannat
ddffc8372b fix: condition to check course and chapter 2021-09-29 17:55:08 +05:30
pateljannat
dc877a9c09 fix: renamed chapter and lesson doctype 2021-09-29 16:42:07 +05:30
Anand Chitipothu
04d2384283 fix: avoid creating duplicate entries of LMS Course Interest 2021-09-29 13:34:38 +05:30
Jannat Patel
50938afe77 Merge pull request #214 from pateljannat/course-progress-report
feat: course progress summary
2021-09-28 20:10:00 +05:30
pateljannat
ea6bd1f598 fix: columns 2021-09-28 19:58:07 +05:30
pateljannat
fb0f9885c1 feat: course progress summary 2021-09-28 18:03:12 +05:30
pateljannat
4248a3af07 Merge branch 'main' of https://github.com/fossunited/community into discussions-shift 2021-09-28 11:16:46 +05:30
pateljannat
a3dc2402f7 fix: semicolon 2021-09-28 11:16:42 +05:30
Jannat Patel
153b439510 Merge pull request #211 from pateljannat/preview-message
fix: preview message
2021-09-27 13:00:46 +05:30
pateljannat
06b925435d fix: preview message 2021-09-27 12:46:11 +05:30
pateljannat
93c2c3cc45 fix: conflicts 2021-09-21 12:38:43 +05:30
Jannat Patel
04a3d58028 Merge pull request #210 from pateljannat/patch-for-chapters-and-lessons
fix: Patch for chapters and lessons
2021-09-21 10:21:31 +05:30
Jannat Patel
8551cfa32e fix: check if present before adding 2021-09-20 21:40:49 +05:30
Jannat Patel
b19c7f2fac fix: move data between doctypes 2021-09-20 18:11:19 +05:30
Jannat Patel
d135338088 fix: patch 2021-09-20 17:49:13 +05:30
Jannat Patel
b8fae5cd28 Merge pull request #209 from pateljannat/username-validation
fix: Username validation
2021-09-20 15:23:18 +05:30
Jannat Patel
29fe75d807 fix: regex in page renderer 2021-09-20 15:12:23 +05:30
Jannat Patel
1dbbf7c769 Merge branch 'main' of https://github.com/fossunited/community into username-validation 2021-09-20 13:44:51 +05:30
Jannat Patel
3be20b5658 Merge pull request #208 from pateljannat/misc
fix: minor issues
2021-09-20 12:26:59 +05:30
Jannat Patel
73b6ddf365 fix: deleted unnecessary file 2021-09-20 12:21:40 +05:30
Jannat Patel
64048a8a18 fix: minor issues 2021-09-20 12:10:35 +05:30
Jannat Patel
e245af57a8 fix: regex change for username 2021-09-19 19:15:45 +05:30
Jannat Patel
0ab708396a Merge pull request #207 from pateljannat/fixes
fix: issues
2021-09-16 18:21:58 +05:30
Jannat Patel
29855a0cbc fix: issues 2021-09-16 18:04:03 +05:30
Jannat Patel
ff6457171f Merge pull request #206 from kennethsequeira/patch-1
fix: spell check in Validation Message
2021-09-16 16:35:13 +05:30
Kenneth Sequeira
9fd59b5d38 fix: spell check in Validation Message
Change unedrscore to underscore
2021-09-16 15:59:32 +05:30
Jannat Patel
c750c62993 fix: style and message 2021-09-16 13:26:11 +05:30
Jannat Patel
a0d90ab16b fix: conflicts 2021-09-14 18:36:21 +05:30
Jannat Patel
af15d978c6 Merge pull request #204 from pateljannat/discussions-markdown-support
fix: discussions markdown support
2021-09-14 16:38:02 +05:30
Jannat Patel
f4271e7c0e fix: discussions markdown support 2021-09-14 16:22:56 +05:30
Jannat Patel
0440e1062d fix: shifting discussions from community app 2021-09-14 15:58:12 +05:30
Jannat Patel
2bc30d696a Merge pull request #203 from pateljannat/certification-redesign
fix: certificate-redesign
2021-09-11 11:21:07 +05:30
Jannat Patel
6dcd210031 certificate-redesign 2021-09-11 11:09:28 +05:30
Jannat Patel
c78c4c92b7 Merge pull request #200 from pateljannat/progress-indicators-and-dashboard
fix: profile and progress on dashboard
2021-09-10 19:52:16 +05:30
Jannat Patel
6a2c749a86 fix: formatting 2021-09-10 19:46:48 +05:30
Jan Doe
56d738474a fix: course card buttons 2021-09-10 18:54:27 +05:30
Jan Doe
7721f31342 fix: profile urls 2021-09-09 15:34:39 +05:30
Jan Doe
90e268ff2f fix: conflicts 2021-09-09 11:01:59 +05:30
Jannat Patel
69bdb75625 Merge pull request #202 from fossunited/profile-urls
Added support for making profile urls to be top-level
2021-09-09 10:26:23 +05:30
Anand Chitipothu
a0b77f5d08 feat: added get_profile_url function to get the profile url in templates
This takes care of generating the correct profile URL depending on the
`profile_url_prefix` setting.

Issue #192
2021-09-07 17:58:09 +05:30
Anand Chitipothu
77c4b53b71 feat: added redirect rule to redirect /profile_/foo to the profile url
Hack to allow redirecting to profile url from JS as it doesn't know
the `profile_url_prefix`.

Issue #192
2021-09-07 17:58:09 +05:30
Anand Chitipothu
035a674cff feat: added support for making profile urls to be top-level
Made the profile_url_prefix customizable by adding it in the hooks.

Issue #192
2021-09-07 17:58:04 +05:30
pateljannat
b9736cc6d6 fix: conflicts 2021-09-06 19:35:32 +05:30
Jannat Patel
f52e5067b6 Merge pull request #201 from pateljannat/discussion-second-cut
fix: Discussions Redesign
2021-09-06 19:29:40 +05:30
pateljannat
d657525359 fix: discussions redesign 2021-09-06 18:59:59 +05:30
pateljannat
3a2ebd42a7 fix: progress pill and certificate secondary cta 2021-09-02 13:26:45 +05:30
pateljannat
916e64d607 feat: discussions sidebar 2021-09-02 10:47:35 +05:30
pateljannat
e0b25c1e6e fix: certificate link 2021-09-01 16:50:27 +05:30
pateljannat
13b968e18c fix: profile and progress on dashboard 2021-09-01 16:21:55 +05:30
pateljannat
9e1daf5062 fix: reply card ui 2021-08-31 19:17:00 +05:30
pateljannat
941a34784c Merge branch 'main' of https://github.com/fossunited/community into discussion-second-cut 2021-08-31 17:38:13 +05:30
Jannat Patel
cd4ffa2eff Merge pull request #199 from pateljannat/certificate-ui
fix: certificate ui
2021-08-31 16:31:14 +05:30
pateljannat
17a7af74f2 fix: certificate ui 2021-08-31 16:19:41 +05:30
Jannat Patel
ff22eaa606 Merge pull request #198 from pateljannat/issue-fixes
fix: ui and removed mockup
2021-08-31 12:51:32 +05:30
pateljannat
417436d7b6 fix: course filter in review 2021-08-31 12:43:51 +05:30
pateljannat
f228489173 fix: ui and removed mockup 2021-08-31 12:30:52 +05:30
pateljannat
a49563e23f fix: discussions template 2021-08-30 18:39:00 +05:30
pateljannat
b3403b78ee fix: removed global discussions page 2021-08-30 12:47:15 +05:30
pateljannat
7a9039090d fix: discussions structure 2021-08-30 12:46:08 +05:30
Jannat Patel
289195e6c9 fix: readme url 2021-08-30 11:14:25 +05:30
Jannat Patel
e6502784ea Merge pull request #197 from pateljannat/ui-issues
fix: ui issues
2021-08-27 09:58:22 +05:30
pateljannat
54f301e8eb fix: edit-profile-link 2021-08-27 09:53:30 +05:30
pateljannat
ed91801769 fix: ui issues 2021-08-26 18:32:14 +05:30
Jannat Patel
6965148e4e Merge pull request #196 from pateljannat/course-cards-web-template
feat: course cards web template
2021-08-26 10:59:28 +05:30
pateljannat
b5481e1dd5 fix: margin 2021-08-26 10:54:38 +05:30
pateljannat
4ec9b56366 feat: course cards web template 2021-08-26 10:44:17 +05:30
Jannat Patel
530fcf9a39 Merge pull request #194 from fossunited/certification-fixes
fix: certificate, profile, quiz, and video markdown
2021-08-25 21:11:28 +05:30
pateljannat
ff1363b437 fix: certificate, profile, quiz, and video markdown 2021-08-25 21:01:13 +05:30
Jannat Patel
952e3a9906 Merge pull request #190 from fossunited/web-form-changes
fix: web form issues
2021-08-24 21:23:23 +05:30
pateljannat
9d530e35fb fix: web form issues 2021-08-24 20:58:12 +05:30
Jannat Patel
2c2ad78eb7 Merge pull request #189 from sumaiya2908/event-registration
fix: attendee-route
2021-08-24 18:09:27 +05:30
Summayya
f61c5a2fa1 fix: implicit user in speaker and exhibitor 2021-08-24 17:47:58 +05:30
Summayya
3e24ff9678 fix: implicit user 2021-08-24 17:27:16 +05:30
Summayya
b0280c3be4 fix: attendee-route 2021-08-24 16:40:46 +05:30
Jannat Patel
b10eb5c979 Merge pull request #188 from fossunited/talks-thumbnail
fix: talk card schedule
2021-08-24 12:27:13 +05:30
pateljannat
e2072c72da fix: talk card schedule 2021-08-24 12:12:55 +05:30
Jannat Patel
84a43912db Merge pull request #186 from fossunited/fixes
fix: minor issues
2021-08-23 18:52:14 +05:30
pateljannat
841819436a fix: minor issues 2021-08-23 18:22:36 +05:30
pateljannat
14a984c75f Merge branch 'main' of https://github.com/frappe/community into fixes 2021-08-23 11:14:35 +05:30
Jannat Patel
445de61ce4 Merge pull request #185 from fossunited/web-form-url-fixes
fix: web form redirects
2021-08-23 10:32:40 +05:30
pateljannat
f83007788d fix: web form redirects 2021-08-23 10:22:40 +05:30
Jannat Patel
aefee791ca Merge pull request #184 from sumaiya2908/event-management
fix: redirections
2021-08-23 10:21:24 +05:30
Summayya
00154d80df fix: redirections 2021-08-23 10:08:43 +05:30
Summayya
a1e12d29ac fix: redirections 2021-08-23 10:02:06 +05:30
Jannat Patel
5069832165 Merge pull request #183 from fossunited/event-doctype-fixes
fix: event doctypes and templates
2021-08-20 17:41:56 +05:30
pateljannat
e2cb003935 fix: doctypes and templates 2021-08-20 17:35:13 +05:30
Jannat Patel
b83a10c282 Merge pull request #180 from sumaiya2908/event-management
Create web templates for event management
2021-08-20 15:34:48 +05:30
Summayya
c6fc0a22d2 fix: add user to exhibitor doctype 2021-08-20 15:26:47 +05:30
pateljannat
c6d3994383 fix: course page 2021-08-20 14:23:18 +05:30
Summayya
07f9721aeb fix: remove speaker-registration 2021-08-20 13:45:40 +05:30
Summayya
dba956e473 fix: remove speaker-registration 2021-08-20 13:41:11 +05:30
Summayya
2894a5e479 fix: change date format 2021-08-19 17:22:01 +05:30
Summayya
ad0913500c fix: link user to speaker/attendee 2021-08-19 16:08:54 +05:30
Jannat Patel
79a765b725 Merge pull request #182 from fossunited/profile-urls
fix: profile urls
2021-08-19 12:05:59 +05:30
pateljannat
eaec991f47 fix: chapter teaser drawer 2021-08-19 10:06:39 +05:30
pateljannat
e31b189045 fix: profile urls 2021-08-19 09:35:02 +05:30
Summayya
eb58b1c149 fix: remove hover 2021-08-18 23:53:02 +05:30
Summayya
af9760f944 fix: remove div in schedule template 2021-08-18 19:49:12 +05:30
Summayya
21b2412362 fix: remove dummy data 2021-08-18 19:41:37 +05:30
Summayya
7e5e167eec fix: remove dummy data 2021-08-18 19:40:35 +05:30
Jannat Patel
7bf254319b Merge pull request #181 from fossunited/certification
feat: certification
2021-08-18 18:39:12 +05:30
pateljannat
d7e1745c09 fix: added back update progress code 2021-08-18 18:17:40 +05:30
pateljannat
ef238c1b25 fix: export label 2021-08-18 18:08:33 +05:30
pateljannat
cb60d97bb7 feat: certification 2021-08-18 18:04:47 +05:30
Summayya
7c3189e273 fix:conflict 2021-08-18 11:41:09 +05:30
Summayya
ace74febc7 Template for Previous content 2021-08-18 11:37:04 +05:30
Summayya
8dbdabd52c Create web templates for event management 2021-08-17 22:31:15 +05:30
Jannat Patel
f0ee8d7b88 Merge pull request #173 from fossunited/sketch-redesign
fix: sketch cards
2021-08-16 13:47:05 +05:30
Jannat Patel
7e5203f058 Merge pull request #179 from fossunited/discussions
feat: Discussions
2021-08-16 13:45:00 +05:30
pateljannat
a3672e9d91 feat: discussions 2021-08-16 13:33:08 +05:30
pateljannat
7017382451 fix: removed sketch card 2021-08-11 11:40:57 +05:30
pateljannat
6c9d49bf8c discussion doctypes 2021-08-11 11:14:40 +05:30
pateljannat
2de058246b Merge branch 'main' of https://github.com/frappe/community into main 2021-08-11 10:46:11 +05:30
pateljannat
798ea30382 fix: chapter teaser jerk issue 2021-08-11 10:46:01 +05:30
pateljannat
3e2c6b3343 fix: sketch image call 2021-08-10 17:08:32 +05:30
pateljannat
5ea744de5c fix: removed unused file 2021-08-10 16:46:48 +05:30
pateljannat
aedb3d3d45 fix: sketch cards 2021-08-10 16:39:17 +05:30
Jannat Patel
83a2f42df9 Merge pull request #171 from fossunited/username-fixes
fix: username issues
2021-08-10 13:19:29 +05:30
pateljannat
66aace247c fix: conditions and tests 2021-08-10 10:28:59 +05:30
pateljannat
bc3db06960 fix: username issues 2021-08-09 16:54:02 +05:30
Jannat Patel
ddaa063587 Merge pull request #170 from fossunited/upcoming-course-notify
feat: notify me
2021-08-09 15:39:04 +05:30
pateljannat
f9b4fe468e fix: removed unused import 2021-08-09 13:27:09 +05:30
pateljannat
6cbca8d1bb feat: notify me 2021-08-09 13:13:48 +05:30
Jannat Patel
d5067a4bcd Merge pull request #169 from fossunited/username-validations
fix: Username validations
2021-08-06 15:05:36 +05:30
pateljannat
04d44510de fix: redirect after edit profile save 2021-08-06 14:41:37 +05:30
pateljannat
844fcc9bca fix: username validations 2021-08-06 14:41:11 +05:30
Jannat Patel
145b5efab0 Merge pull request #168 from fossunited/minor-issues
fix: quiz, course outline, and lesson indexing
2021-08-05 18:41:15 +05:30
pateljannat
4079ed97b9 fix: quiz, course outline, and lesson indexing 2021-08-05 18:26:41 +05:30
pateljannat
63d70fc037 fix: username space and empty validations 2021-08-05 15:51:21 +05:30
Jannat Patel
ce86b5deda Merge pull request #167 from fossunited/issues
fix: cleanup
2021-08-04 19:18:45 +05:30
pateljannat
037e946bbe fix: mentors cleanup 2021-08-04 19:07:14 +05:30
pateljannat
a51c8de1eb fix: profile progress and review links 2021-08-04 14:01:52 +05:30
Jannat Patel
53dc517180 Merge pull request #165 from fossunited/quiz-cleanup
refactor: Quiz cleanup
2021-08-03 19:04:37 +05:30
pateljannat
44ca940c6b fix: quiz enhancements and tests 2021-08-03 18:30:52 +05:30
pateljannat
c0b688c720 Merge branch 'main' of https://github.com/frappe/community into quiz-cleanup 2021-07-30 18:35:23 +05:30
Jannat Patel
861d5f231d Merge pull request #164 from fossunited/issues
fix: default image, meta, reviews, lesson headers
2021-07-30 17:07:19 +05:30
pateljannat
d14b4f55a6 fix: default image, meta, reviews, lesson headers 2021-07-30 16:24:56 +05:30
Jannat Patel
db9a6c3eda Merge pull request #163 from fossunited/chapter-lesson-patch-fix
fix: chapter lesson patch
2021-07-29 13:48:23 +05:30
pateljannat
a667643681 fix: chapter lesson patch 2021-07-29 13:43:31 +05:30
Jannat Patel
f278e4b6a5 Merge pull request #162 from fossunited/lesson-enhancements
fix: lesson indexing
2021-07-29 12:12:14 +05:30
pateljannat
33a12c2dec fix: lesson indexing 2021-07-29 11:54:30 +05:30
Jannat Patel
508f90f459 Merge pull request #161 from fossunited/upcoming-courses
fix: upcoming course and doctype cleanup
2021-07-26 12:22:02 +05:30
pateljannat
709f0c2274 fix: profile profession section width 2021-07-26 11:42:30 +05:30
pateljannat
be47700e7c Merge branch 'main' of https://github.com/frappe/community into upcoming-courses 2021-07-26 11:14:38 +05:30
pateljannat
40842830a4 fix: profile page social icons position 2021-07-26 11:14:32 +05:30
pateljannat
11d070fa0d fix: condition for chapter description 2021-07-23 19:16:36 +05:30
pateljannat
dd2f830a33 fix: upcoming course and doctype cleanup 2021-07-23 19:07:26 +05:30
pateljannat
5431fcb450 fix: quiz ui change 2021-07-23 17:55:41 +05:30
Jannat Patel
324033e9ee Merge pull request #160 from fossunited/only-show-published-courses
fix: minor issues
2021-07-20 17:35:18 +05:30
pateljannat
86596d0cfe fix: minor issues 2021-07-20 17:19:18 +05:30
Jannat Patel
9323cfd748 Merge pull request #159 from rmehta/fix-global-container
fix(style): max-width on container padding
2021-07-20 13:06:36 +05:30
Jannat Patel
d125b02cec fix: added max width to container padding 2021-07-20 13:05:15 +05:30
pateljannat
282c4c5351 feat: explanation field in quiz 2021-07-20 09:36:22 +05:30
Rushabh Mehta
276d64a66a fix(style): don't mess with global container styles 2021-07-20 09:30:58 +05:30
Rushabh Mehta
79eb381a41 Merge pull request #157 from rmehta/remove-old-styles
fix(cleanup): remove old styles
2021-07-19 17:19:54 +05:30
Rushabh Mehta
44f9c0dfd3 fix(minor): remove old styles 2021-07-19 17:14:52 +05:30
Jannat Patel
0ca4cd724e Merge pull request #156 from fossunited/fix-only-show-published-courses
fix: only show the published courses on All Courses page
2021-07-19 17:11:03 +05:30
Anand Chitipothu
8a3e31f021 fix: only show the published courses on All Courses page
Closes #155
2021-07-19 17:03:38 +05:30
Jannat Patel
9be8a1af0b Merge pull request #154 from fossunited/fix-invite-email
Fix invite email
2021-07-19 13:43:36 +05:30
Anand Chitipothu
b9cac20613 fix: the delay in sending signup email 2021-07-19 13:32:18 +05:30
Anand Chitipothu
e6d5e6d37b fix: "Hello None" in the signup email
We were trying to show the full_name, but invite request only knows the email.
2021-07-19 13:31:44 +05:30
Jannat Patel
0abfcac7da Merge pull request #153 from fossunited/improve-email-templates
fix: fixed the email message sent out on signup
2021-07-19 13:23:55 +05:30
Anand Chitipothu
b70e8b9acc fix: fixed the email message sent out on signup
Currently updated keeping Mon.School in mind.
2021-07-19 13:14:13 +05:30
Jannat Patel
3b1e1aa3c3 Merge pull request #152 from fossunited/cleanup
fix: Cleanup
2021-07-19 12:49:22 +05:30
pateljannat
8f74c74d50 fix: removed unused styles and folders 2021-07-19 10:55:06 +05:30
pateljannat
d2f435016c fix: layout cleanup 2021-07-16 20:24:35 +05:30
pateljannat
389b35802b Merge branch 'main' of https://github.com/frappe/community into cleanup 2021-07-15 17:36:31 +05:30
Jannat Patel
a9192a74f9 Merge pull request #151 from fossunited/redesign-fixes
fix: Profile page, course card ratings, lesson completion tick
2021-07-15 17:36:17 +05:30
pateljannat
1366c7cf75 fix: removed unwanted image 2021-07-15 17:16:49 +05:30
pateljannat
eaa9e8e3ea fix: added linkedin icon 2021-07-15 17:05:54 +05:30
pateljannat
5ecae0df61 fix: removed unused pages 2021-07-15 17:01:15 +05:30
pateljannat
4891be1d8c fix: profile page fixes and course completion tick 2021-07-15 11:16:01 +05:30
pateljannat
ec852fc255 fix: rating on course card and profile page responsive 2021-07-13 16:54:45 +05:30
Jannat Patel
47f2d3cb7b Merge pull request #148 from fossunited/redesign
feat: Redesign
2021-07-13 15:22:59 +05:30
pateljannat
37820c1e19 Merge branch 'redesign' of https://github.com/frappe/community into redesign 2021-07-13 15:15:29 +05:30
pateljannat
230fab3bb2 fix: responsive design 2021-07-13 15:15:23 +05:30
Jannat Patel
d292d2d093 Merge pull request #149 from fossunited/disable-exercises-for-non-members
feat: include membership info in page context
2021-07-12 10:59:28 +05:30
Anand Chitipothu
51d5db01e9 feat: include membership info in page context
Added `is_member` field to page_context of learn page. This is required to
disable exercises to non-members.
2021-07-11 12:55:26 +05:30
pateljannat
0fd760df81 fix: pre tag overflow 2021-07-09 18:32:51 +05:30
pateljannat
71d0a89968 fix: made image non mandatory, remove unnecessary code 2021-07-09 15:05:46 +05:30
pateljannat
d939a63412 responsive fixes 2021-07-09 13:24:38 +05:30
pateljannat
daaa2d2fe2 responsive fixes 2021-07-09 13:03:42 +05:30
pateljannat
6dd7cb19df Merge branch 'main' of https://github.com/frappe/community into redesign 2021-07-09 09:50:38 +05:30
pateljannat
b1de2481a8 feat: profile page and other issues 2021-07-09 09:48:08 +05:30
pateljannat
27c01b3b0c fix: course details interactions 2021-07-08 10:55:03 +05:30
Jannat Patel
b7aa9aff51 Merge pull request #147 from fossunited/fix-profile
fix: error on profile page
2021-07-08 10:41:08 +05:30
Anand Chitipothu
524a041fb9 fix: error on profile page
Profile page was importing Sketch which was removed recently, even
though it was not using that. Removed it to fix the issue.
2021-07-08 10:33:12 +05:30
Jannat Patel
9de0203914 Merge pull request #145 from fossunited/sketch-cleanup
Sketch cleanup
2021-07-07 11:22:05 +05:30
pateljannat
0ed5309b97 feat: course details page structure 2021-07-06 20:51:20 +05:30
pateljannat
68fd32d536 fix: links and breadcrumbs 2021-07-06 18:13:09 +05:30
pateljannat
5ea3b25d21 feat: course home 2021-07-06 17:58:36 +05:30
Anand Chitipothu
2c24412633 refactor: removed the unused dashboard portal page 2021-07-06 14:20:00 +05:30
Anand Chitipothu
1b8a45ba4a refactor: removed sketch doctype and portal page for home
Both of these will be moved to mon_school.
2021-07-06 13:20:41 +05:30
Jannat Patel
3dd4adbc1f Merge pull request #143 from fossunited/switch-batch
feat: added a utililty to switch a student from one batch to another
2021-07-05 19:04:52 +05:30
Jannat Patel
0c52c9c4bc Merge pull request #144 from fossunited/page-context
feat: make it possible to enable tracking for livecode execution
2021-07-05 19:03:47 +05:30
Anand Chitipothu
9caf44cdbd feat: make it possible to enable tracking for livecode execution
Tracking of livecode execution is made possible by making the page
context with course, batch and lesson available in js.

Added a global page_context variable in js and the data for that gets
initialzied in the learn.py.
2021-07-02 23:58:59 +05:30
pateljannat
45d88bdc08 feat: course header wide 2021-07-02 15:43:21 +05:30
Anand Chitipothu
94b3ccd3d9 feat: added a utililty to switch a student from one batch to another 2021-07-01 17:29:02 +05:30
pateljannat
ee8273fd30 feat: new fields in user doctype and new web form 2021-06-30 16:16:22 +05:30
pateljannat
60c1449f40 Merge branch 'main' of https://github.com/frappe/community into redesign 2021-06-29 19:28:50 +05:30
Jannat Patel
67708325ae Merge pull request #141 from fossunited/workspace
feat: lms workspace
2021-06-29 15:24:22 +05:30
pateljannat
3e99577401 feat: lms workspace 2021-06-29 15:15:49 +05:30
pateljannat
5e916dc2c8 feat: review card style 2021-06-29 12:58:12 +05:30
pateljannat
0c64d46e99 feat: reviews 2021-06-28 20:27:17 +05:30
pateljannat
3aa974f8bd fix: removed review doctype 2021-06-28 13:26:29 +05:30
Jannat Patel
621d01d502 Merge pull request #140 from fossunited/exercise-refactor
fix: enabled livecode on community
2021-06-28 13:11:26 +05:30
pateljannat
aa20136223 fix: undo status change on livecode 2021-06-28 13:05:20 +05:30
pateljannat
9bc5408a44 feat: course card redesign 2021-06-28 12:52:10 +05:30
pateljannat
5a7afb3092 fix: added livecode editor in community 2021-06-24 16:38:02 +05:30
Jannat Patel
f8948ac2ef Merge pull request #138 from fossunited/learn-page-fix
fix: learn page
2021-06-24 12:28:34 +05:30
pateljannat
8b1576a028 fix: learn page 2021-06-24 12:21:25 +05:30
Jannat Patel
56d8a72a7d Merge pull request #136 from fossunited/quiz
feat: Quizzes, Youtube Video integration and Other Minor Fixes
2021-06-24 10:34:36 +05:30
pateljannat
f6c11ce52f fix: conflicts 2021-06-24 10:27:01 +05:30
pateljannat
0284c9305c fix: quiz progress and youtube video integration 2021-06-24 10:25:23 +05:30
Jannat Patel
d785fb7562 Merge pull request #127 from fossunited/livecode-cleanup
refactor: removed the portal pages for showing sketches
2021-06-23 13:09:26 +05:30
Anand Chitipothu
9f50af4ebd refactor: removed the portal pages for showing sketches
Moved them to mon_school.
2021-06-23 12:53:35 +05:30
Jannat Patel
4c3645f0d4 Merge pull request #133 from fossunited/mon-fixes-01
Various fixes from mon.school
2021-06-23 11:44:35 +05:30
Anand Chitipothu
20b3ae7d76 fix: error in linking lessons on course page
The course was adding `{{ no such element: community.lms.doctype.lms_course.lms_course.LMSCourse object['query_parameter'] }}`
to the lesson links. Fixed it by setting query_parameter to "".
2021-06-23 10:27:01 +05:30
Anand Chitipothu
f303be4db5 fix: error in find_macros when the input is empty
Added a special case to handle this issue.
2021-06-22 18:12:31 +05:30
Anand Chitipothu
fc1c393f15 feat: allow a student to be mentor of another batch
This is a requirement for mon.school. The students are of the first
batch are now mentors of new batches.
2021-06-22 18:09:21 +05:30
pateljannat
5d96bf544d fix: conflicts 2021-06-22 12:28:12 +05:30
Jannat Patel
5abfa35095 Merge pull request #132 from fossunited/learning-modes
feat: learning modes and batch switching
2021-06-22 12:23:46 +05:30
pateljannat
6c751cdf39 fix: test 2021-06-22 12:17:06 +05:30
pateljannat
2c570ea214 fix: added default value for arguements 2021-06-22 10:48:33 +05:30
pateljannat
ecfcc8a2f7 fix: redirects and urls 2021-06-22 10:45:07 +05:30
pateljannat
3384f974e5 fix: batch switch with query parameters 2021-06-22 10:11:21 +05:30
pateljannat
eb435261fe feat: learning modes 2021-06-18 18:31:10 +05:30
Jannat Patel
dc7eabefb9 Merge pull request #131 from fossunited/minor-fixes
fix: web form, progress ui, title non unique
2021-06-16 13:15:10 +05:30
pateljannat
fed4b5568b fix: web form, progress ui, title non unique 2021-06-16 13:04:45 +05:30
Jannat Patel
aa77c60abd Merge pull request #129 from fossunited/minor-fix
fix: minor issues
2021-06-15 18:46:33 +05:30
pateljannat
9c1506d3c8 fix: minor issues 2021-06-15 18:40:14 +05:30
Jannat Patel
e94c3f27ab Merge pull request #128 from fossunited/ui-fixes
fix: UI fixes
2021-06-15 13:19:03 +05:30
pateljannat
5fa8bdd40c fix: invite request test, removed print statements and unused classes' 2021-06-15 13:09:48 +05:30
pateljannat
17f03aeee7 fix: join batch, removed code revision, redirects for other pages if batch missing 2021-06-15 13:01:57 +05:30
pateljannat
7840512a13 fix: ui, preview, progress, batches 2021-06-14 18:45:46 +05:30
Anand Chitipothu
526ded784b Merge pull request #125 from fossunited/hotfix-exercise-image
fix: fixed error on saving exercises
2021-06-12 21:42:27 +05:30
Anand Chitipothu
6b5ddcd54a fix: fixed error on saving exercises
Removed the image generation when exercise is saved. The library used
for exercises has changed and generating the image doesn't work any
more.
2021-06-12 10:49:27 +05:30
Jannat Patel
c42247db42 Merge pull request #122 from fderyckel/patch-1
frappe wasn't imported
2021-06-10 20:47:05 +05:30
François de Ryckel
8f8d4901ff frappe wasn't imported
error with NameError: name 'frappe' is not defined
2021-06-10 18:04:40 +03:00
pateljannat
f5f3c808d4 Merge branch 'main' of https://github.com/frappe/community into ui-fixes 2021-06-10 13:41:31 +05:30
pateljannat
1e3152e303 fix: ui 2021-06-10 13:41:11 +05:30
Jannat Patel
344661cf83 Merge pull request #121 from fossunited/lesson-markup
Lesson markup
2021-06-10 12:32:16 +05:30
Anand Chitipothu
d9185c0b6b feat: integrated lesson markup
- added PageExtension plugin to inject custom styles scripts in a page
- removed the livecode integration and enabled PageExtension plugins for
  learn page
- also merged the profile_tab.py with plugins.py
- added a utility to find the macros from given text
- updated the before_save of lesson to find exercises using the macros
  and update the exercises as before

Issue #115
2021-06-09 23:58:21 +05:30
Anand Chitipothu
5363fb7eb3 feat: extend markdown to support macros
With this feature, the exercises can be added to the lesson as:

    {{ Exercise("two-circles") }}

This also added fenced_code extension that allows adding id and classes
to code blocks.

This uses Python-Markdown library instead of Markdown2 that is used
everywhere in Frappe. The Python-Markdown is more easily extensible than
Markdown2.

Issue #115
2021-06-09 23:22:00 +05:30
pateljannat
1cb81de5c0 feat: lms quizzes 2021-06-09 13:17:42 +05:30
Jannat Patel
d90a1247f1 Merge pull request #120 from fossunited/profile-tabs
feat: pluggable profile tabs
2021-06-08 14:53:38 +05:30
Anand Chitipothu
ef0c3e4a24 feat: pluggable profile tabs
Added ProfileTab class to represent a profile tab and made the profile
page render the tabs specified in the hook `profile_tabs`. This allows
plugging in new tabs in the profile page without makeing any changes to
the community module.
2021-06-08 10:36:12 +05:30
Anand Chitipothu
3619b136f8 Merge pull request #117 from fossunited/lesson-progress
feat: lesson progress
2021-06-07 11:24:52 +05:30
pateljannat
671b4a0650 fix: api and orm 2021-06-02 20:19:36 +05:30
Anand Chitipothu
586b39c0fd fix: issue with numbering the exercises
The exercises being listed in unpredicted order instead of the order
they were listed in the lesson. The was because the `index_` of the
exercise was never updated. Fixed this by updating the `index_` whenever
a lesson edited. However, the user still need to run reindex exercises
on the course correct the ordering, which wasn't possible earlier.
2021-06-02 17:48:02 +05:30
pateljannat
4fd7af053b fix: tests 2021-06-02 16:47:17 +05:30
pateljannat
5fd1143f76 feat: lesson progress 2021-06-02 13:52:50 +05:30
Jannat Patel
0dc4743556 Merge pull request #116 from fossunited/reindex-exercises
feat: actions to reindex lessons and exercises
2021-06-01 11:40:52 +05:30
Anand Chitipothu
c96a14c972 feat: ignore orphan exercises in the progress
Don't show exercises that are not added to any lesson in the progress.
2021-06-01 08:15:52 +05:30
Anand Chitipothu
400e706be1 feat: update the index of orphan exercises
When an exercise is removed from a lesson, the link to the lesson is
removed from that exercise and the index is reset. This will make sure
the removed exercises won't show up in places like progress.
2021-06-01 05:59:01 +05:30
Anand Chitipothu
a12a52747e feat: show exercise index in the title
Show exercise as "Exercise 2.1: Draw a Circle".
2021-06-01 05:49:45 +05:30
Anand Chitipothu
b9a93bb160 feat: added actions to reindex lessons and exercises
Some lessons gets deleted and some new ones get added in the progress of
course creation and it may happen then some of the lesson index may
become inconsistent.  Also, we would like to maintain an index for the
exercises. To support both of these, added actions to reindex lessons
and exercises to the course doctype.
2021-06-01 05:46:32 +05:30
Jannat Patel
9c65ff8ae6 Merge pull request #113 from fossunited/invite-based-membership
feat: Invite based membership
2021-05-31 13:41:12 +05:30
pateljannat
bb0aa09b4e fix: messages and url 2021-05-31 13:39:31 +05:30
pateljannat
a8752afb3b feat: invite based membership become a member page 2021-05-28 13:53:34 +05:30
pateljannat
327bde870b Merge branch 'main' of https://github.com/frappe/community into invite-based-membership 2021-05-27 17:32:48 +05:30
Jannat Patel
640ead4922 Merge pull request #109 from fossunited/style-fixes
fix: Style fixes
2021-05-27 11:54:08 +05:30
pateljannat
687f7f7f7b fix: minor home page issues 2021-05-27 11:25:05 +05:30
Anand Chitipothu
527a563e4a chore: added "programming" to the hero title 2021-05-27 09:39:07 +05:30
pateljannat
5bc9a7fe37 Merge branch 'style-fixes' of https://github.com/frappe/community into invite-based-membership 2021-05-26 19:10:38 +05:30
pateljannat
24835acd9c fix: jinja 2021-05-26 19:10:08 +05:30
pateljannat
3648b3ab47 Merge branch 'style-fixes' of https://github.com/frappe/community into invite-based-membership 2021-05-26 19:08:38 +05:30
pateljannat
914f8504a0 fix: added class in lms_message 2021-05-26 18:56:57 +05:30
pateljannat
ab8546a121 fix: course outline, discussion, lms batch 2021-05-26 17:16:00 +05:30
pateljannat
f327c6fb10 fix: tests for course description 2021-05-26 12:38:50 +05:30
pateljannat
c7ccefa632 fix: discussion, batch home page, new fields for batches 2021-05-26 12:13:04 +05:30
Anand Chitipothu
823cf4e431 style: fixed word-wrap of output 2021-05-25 16:06:12 +05:30
pateljannat
18f074d8ac fix: ignore user permission for membership 2021-05-24 19:35:26 +05:30
pateljannat
c9185ae68c fix: tabs and learn page 2021-05-24 19:24:07 +05:30
Anand Chitipothu
82fa0fa4d7 fix: error in loading the progress page 2021-05-24 13:46:59 +05:30
Jannat Patel
64752433d2 Merge pull request #106 from fossunited/issue-103
Redirect the learn page to the current lesson of the user
2021-05-24 13:40:50 +05:30
Anand Chitipothu
50856fdfa5 fix: fixed failing test 2021-05-24 13:30:47 +05:30
Anand Chitipothu
cac4f2afef feat: redirect the learn page to the current lesson of the user
The current lesson is maintained in the LMS Batch Membership and that is
updated everytime a lesson page is visited.
2021-05-24 13:07:29 +05:30
Anand Chitipothu
df431165e8 feat: redirect non-members visiting any batch page to the course page 2021-05-24 12:57:01 +05:30
Anand Chitipothu
69125e571f feat: added member_username and current_lesson fields to LMS Batch Membership
And removed member_email field which is a duplicate of member.
2021-05-24 12:43:20 +05:30
Anand Chitipothu
68f7215b95 fix: error in updating LMS Batch membership
The validation was always failing when trying to updating an LMS Batch
Membership document. This was due to a bug in the validation logic that
was considering itself as a duplicate record. This has been fixed.

Also added tests to verify that.
2021-05-24 12:15:16 +05:30
pateljannat
ca42c32f54 Merge branch 'main' of https://github.com/frappe/community into style-fixes 2021-05-24 11:57:53 +05:30
Anand Chitipothu
20adc8079e Merge pull request #105 from fossunited/community-member-to-user-refactor
refactor: Community Member to User refactor
2021-05-24 11:44:45 +05:30
Anand Chitipothu
d55941d4bb Merge branch 'main' into community-member-to-user-refactor 2021-05-24 11:39:20 +05:30
Jannat Patel
6074ee3688 Merge pull request #104 from fossunited/resume-course
Added "Resume Course" button to the course teaser
2021-05-24 11:36:06 +05:30
pateljannat
b3f87ba5b6 fix: removed community course member and references to profile macro 2021-05-24 10:39:04 +05:30
pateljannat
631275e9a8 refactor: course and sidebar cleanup 2021-05-24 10:28:02 +05:30
Anand Chitipothu
8d7963fc60 feat: added "Resume Course" button to course teaser
Closes #102
2021-05-24 09:55:35 +05:30
Anand Chitipothu
38938ac14b feat: added ability to find the batch of a student
Added the course field and member_email fields to LMS Batch Membership
to allow the possibility of querying if a user is a student of a course.

Closes #101
2021-05-24 09:55:13 +05:30
Anand Chitipothu
14f9d4875a chore: added issue template for Feature Request 2021-05-24 08:36:09 +05:30
pateljannat
419a7e666f refactor: tests, mentor request, messages 2021-05-22 20:49:47 +05:30
pateljannat
713dcf178a refactor: patches to fix data, profile dashboard, lms mentor mapping page fixes 2021-05-21 21:40:31 +05:30
pateljannat
637c795321 refactor: moved community member class functions to user override 2021-05-21 16:22:59 +05:30
pateljannat
63d00a46c4 Merge branch 'main' of https://github.com/frappe/community into community-member-to-user-refactor 2021-05-21 13:27:22 +05:30
pateljannat
e991dc5c73 refactor: removed community member doctype 2021-05-21 13:27:15 +05:30
Anand Chitipothu
4a2ecff15d Merge pull request #98 from fossunited/remove-primary-color-from-app
fix: removed primary color from app
2021-05-21 13:26:38 +05:30
Jannat Patel
f8d6b5b949 Merge pull request #99 from fossunited/mentor-dashboard
Refactored batch pages and added batch progress page
2021-05-21 13:25:56 +05:30
Anand Chitipothu
c77835b81f feat: added page to see progress of a batch 2021-05-21 13:13:34 +05:30
Anand Chitipothu
e04bbb633d refactor: moved courses/*/index pages to batch/* 2021-05-21 13:12:52 +05:30
Anand Chitipothu
a2b856aaf8 feat: added image to exercise submission 2021-05-21 13:10:54 +05:30
pateljannat
7a650b46ac fix: removed primary color from app 2021-05-21 11:06:37 +05:30
Jannat Patel
b61ca1d7a2 Merge pull request #97 from fossunited/gitignore-build-file
fix: gitignore dist folder
2021-05-21 10:31:40 +05:30
pateljannat
573019bbcc fix: added build dist folder to gitignore 2021-05-21 10:23:44 +05:30
Anand Chitipothu
632693c9f8 fix: show submitted solution in the exercise 2021-05-20 21:03:24 +05:30
Anand Chitipothu
463aec01f8 fix: permission issue when a student submits an exercise 2021-05-20 21:02:54 +05:30
Anand Chitipothu
e7d116f31c chore: removed obsolete doctype LMS Topic
It has been replaced by Chapter and Lesson.
Moved the section_parser from lms_topic directory to the lms.
2021-05-20 16:52:51 +05:30
Anand Chitipothu
f1b3ee19b6 Merge pull request #93 from fossunited/exercises
Added Exercise and Exercise Submission doctypes
2021-05-20 16:43:29 +05:30
Anand Chitipothu
9cb9fad05c fix: fixed failing tests 2021-05-20 16:24:41 +05:30
Anand Chitipothu
0859afdf34 style: fixed the styles of the sidebar 2021-05-20 15:08:12 +05:30
Anand Chitipothu
6407b24324 feat: added course, batch and lesson to exercise submission
Useful to find all the submissions for a batch/lesson.
2021-05-20 15:07:14 +05:30
Anand Chitipothu
34e993cf86 refactor: added lesson to exercise
usualy to know which lesson an exercise is part of by looking at the
exercise.
2021-05-20 13:27:30 +05:30
Anand Chitipothu
8c889ffb92 chore: switched to new build system for css.
- added community.bundle.less file to create css bundle
- removed the obsolete build.json in favor of new build system
- updated the paths in the books
- removed the imported urls from css files (the new build system doesn't support that)
- removed obsolete lms.css
2021-05-20 13:15:08 +05:30
Anand Chitipothu
a67ad67be1 feat: show image for the exercise
generate the image from the answer and display it along with
description. The image is geneated when the exercise is saved.
2021-05-20 12:09:12 +05:30
Anand Chitipothu
646a7b723f fix: fix broken pagination links 2021-05-19 20:12:35 +05:30
Anand Chitipothu
6f7011ca58 feat: integrated exercises into lessons
- an exercise can now be added to a lesson
- it is rendered using livecode editor with submit button
- remembers the submitted code and shows the submission time

Issue #90
2021-05-19 20:06:20 +05:30
Anand Chitipothu
d61acb552a feat: added Exercise and Exercise Submission doctypes
Also:
- added methods to submit an exercise and get the submission for a user
- added test cases

Issue #90
2021-05-19 20:01:17 +05:30
Jannat Patel
265c78e76e Merge pull request #88 from fossunited/minor-fixes
fix: removed slug field ref from courses page
2021-05-19 13:59:43 +05:30
pateljannat
7d180e141c fix: removed print statememt 2021-05-19 13:19:34 +05:30
pateljannat
29f9141ad8 fix: removed slug field ref from courses page 2021-05-19 13:16:46 +05:30
Anand Chitipothu
e6f58f56e0 Merge pull request #87 from fossunited/remove-branding
refactor: removed the branding and customization for mon school
2021-05-19 10:41:45 +05:30
Anand Chitipothu
9e0476fd00 chore: upgraded node to v14 in github actions
- the new changes to frappe required node v14
- also added a build setup before runing tests to make sure the assets are built
2021-05-19 10:05:59 +05:30
Anand Chitipothu
d9ea02667d refactor: removed the branding and customization for mon school
They have been moved to a new mon_school app
2021-05-18 21:25:29 +05:30
Anand Chitipothu
bdabf32124 Merge pull request #86 from fossunited/learn
Implemented learning section for batches
2021-05-14 15:36:44 +05:30
Anand Chitipothu
8b657f2f40 feat: added next/prev links to learn pages 2021-05-14 15:29:44 +05:30
Anand Chitipothu
49b41749e8 feat: added learn page
- added sections to the lesson to handle multiple sesions like examples and exercises
- added livecode integration to lesson pages
- autosave and submiting the answers is not done yet
2021-05-14 12:11:45 +05:30
Anand Chitipothu
1cf57c4823 feat: redirect the course page to learn page when the visitor is a student of a batch 2021-05-14 12:06:37 +05:30
Anand Chitipothu
5cfb72a731 style: tweaks
- made hero h1 black
- fixed the styles of lesson teasers
2021-05-08 13:44:34 +05:30
Anand Chitipothu
49d5ca4292 fix: added index to lesson doctype to fix the display order 2021-05-08 13:44:34 +05:30
Anand Chitipothu
a3e53efcc1 fix: fixed course description on the course page
The small intro was being shown in its place.
2021-05-08 13:44:34 +05:30
Anand Chitipothu
be7814b4fe Merge pull request #81 from fossunited/flow-fixes
fix: username and email validations
2021-05-07 18:53:58 +05:30
Anand Chitipothu
c40ab9a726 style: style tweaks 2021-05-07 18:32:35 +05:30
Anand Chitipothu
64cf14ed92 fix: fail gracefully when livecode_to_svg crashes
That seems to be happening in some cases and couldn't really figure out
the reason. Handling the error to gracefully to show an empty image in
those cases.
2021-05-07 18:32:34 +05:30
Anand Chitipothu
dbaa896fcc fix: fixed the issue of users unable to save sketches
Inserting new sketches is failing because the web user role doesn't have
permission to create sketches. Fixed it by adding
ignore_permission=True.
2021-05-07 18:32:34 +05:30
pateljannat
911c85bfc8 fix: redirect after login 2021-05-07 18:27:18 +05:30
pateljannat
5edceb2562 fix: photo from user 2021-05-07 17:14:33 +05:30
Anand Chitipothu
5d14dce320 Merge pull request #80 from fossunited/add-new-batch-form-enhancements
fix: Add new batch form enhancements
2021-05-07 16:53:21 +05:30
Anand Chitipothu
eec9e57dd2 fix: fixed thumbnail generation from livecode
Due to the recent changes to livecode, the code to generate svg from
code got broken. Fixed that now.
2021-05-07 16:48:52 +05:30
Anand Chitipothu
503b922074 style: improved the sketch page 2021-05-07 16:48:25 +05:30
pateljannat
d4c19932d5 fix: replaced slug with name and removed whitelist 2021-05-07 16:28:12 +05:30
Anand Chitipothu
3c8cffc5ad fix: fixed the issue of unable to create sketches.
The livecode API has been generalized and there was some
backwackward-incompatible changes in that proces. Added
livecode-canvas.js with the required options to fix the issue.
2021-05-07 13:59:38 +05:30
pateljannat
b3c67a3f34 fix: username and email validations 2021-05-07 13:47:33 +05:30
Anand Chitipothu
84b4833fed style: tweaked the styles of profile page 2021-05-07 12:33:43 +05:30
pateljannat
28ef7e5def fix: conflicts 2021-05-07 12:08:51 +05:30
pateljannat
9981baa13b fix: add new batch form enhancements 2021-05-07 12:04:11 +05:30
Anand Chitipothu
c764aa6c20 fix: fixed the error in saving a new course 2021-05-07 05:18:06 +05:30
Anand Chitipothu
bc11730697 style: showing the message as alert elements on the course page 2021-05-06 21:05:36 +05:30
Anand Chitipothu
92c4a86e8b refactor: fixed the accidentally removed code in RequestInvite 2021-05-06 21:05:08 +05:30
Anand Chitipothu
358724bf1c style: fixed the hero section on mobile
The email textbox was becoming too small.
2021-05-06 20:53:14 +05:30
Anand Chitipothu
bb80d988d7 refactor: using SketchTeaser widget to show sketch in the profile page 2021-05-06 20:43:04 +05:30
Anand Chitipothu
0ad03a3fb5 style: made the avatar and name of the person a link 2021-05-06 20:41:52 +05:30
Anand Chitipothu
3382de0ecb refactor: removed slug from course page. 2021-05-06 15:47:47 +05:30
Anand Chitipothu
08bb7b4490 Merge pull request #73 from fossunited/mentor-request-email-templates
fix: mentor request flow and emails #30, #69, #70
2021-05-06 15:39:58 +05:30
Anand Chitipothu
15203f6bcc Merge branch 'main' into mentor-request-email-templates 2021-05-06 15:38:53 +05:30
Anand Chitipothu
cbfb0d6761 Merge pull request #76 from fossunited/course-page
Refactored the course page
2021-05-06 13:55:42 +05:30
Anand Chitipothu
343aa50f78 Merge branch 'main' into course-page 2021-05-06 13:50:12 +05:30
Anand Chitipothu
5a70687067 refactor: removed the slug using the course name as part of url 2021-05-06 13:42:45 +05:30
Anand Chitipothu
a0921f7380 Merge pull request #77 from fossunited/widget-avatar
feat: Widget avatar
2021-05-06 13:26:49 +05:30
pateljannat
11cc03849d fix: displaying course name in mentor email 2021-05-06 13:23:22 +05:30
pateljannat
413aeaccb1 feat: avatar widget 2021-05-06 12:17:28 +05:30
Anand Chitipothu
88457a82ac refactor: learn page 2021-05-06 07:05:27 +05:30
Anand Chitipothu
761f36519e refactor: refactored the about page 2021-05-06 07:05:17 +05:30
Anand Chitipothu
dc5b637ada refactor: fixed the course page 2021-05-06 06:47:09 +05:30
pateljannat
5e5395658e Merge branch 'main' of https://github.com/frappe/community into mentor-request-email-templates 2021-05-05 16:32:37 +05:30
pateljannat
69b3f366f4 feat: widget file added 2021-05-05 16:32:21 +05:30
Anand Chitipothu
da902d23f7 Merge pull request #71 from fossunited/footer
Fix footer
2021-05-05 16:30:45 +05:30
Anand Chitipothu
c2be23a902 fix: fixed the pickle error on installing community 2021-05-05 15:58:28 +05:30
Anand Chitipothu
da771d7830 [actions] added action to ache bench 2021-05-05 15:57:41 +05:30
pateljannat
8a242a69fb fix: mentor request flow and emails #30, #69, #70 2021-05-05 15:45:20 +05:30
Anand Chitipothu
041bed7e9d Added sketches to the nav-bar on install 2021-05-05 12:56:27 +05:30
Anand Chitipothu
e330f45adc style: fixed the footer 2021-05-05 12:53:24 +05:30
Anand Chitipothu
370d3a321b Merge pull request #68 from fossunited/invite-flow-fixes
fix: invite flow issues
2021-05-04 23:23:40 +05:30
Anand Chitipothu
138fba66ae Merge branch 'main' of git://github.com/khalby786/community into khalby786-main 2021-05-04 23:21:21 +05:30
Anand Chitipothu
82faaed15d feat: set app name and logo on install and disable signup
- set app_name and app_logo_url on install
- disabled signup
2021-05-04 23:19:50 +05:30
Anand Chitipothu
b58a685e7a Merge pull request #64 from fossunited/miscellaneous-fixes
fix: Miscellaneous fixes
2021-05-04 19:18:17 +05:30
pateljannat
45ec16d9e4 fix: reverted error message 2021-05-04 17:43:09 +05:30
pateljannat
18c0fb0da5 fix: #65 and #66 2021-05-04 17:41:54 +05:30
pateljannat
b7d93c1b50 fix: get_mentors in batch 2021-05-04 16:50:39 +05:30
pateljannat
e931ead270 fix: miscellaneous 2021-05-04 12:47:45 +05:30
pateljannat
8933ca9ac9 Merge branch 'main' of https://github.com/frappe/community into miscellaneous-fixes 2021-05-03 16:57:58 +05:30
Anand Chitipothu
1a06e2c0aa Merge pull request #61 from fossunited/issue-56
doctypes for chapter and lesson
2021-05-03 16:51:01 +05:30
Anand Chitipothu
491b5c46ae Merge branch 'main' into issue-56 2021-05-03 16:03:30 +05:30
pateljannat
2139bddf01 fix: removed unused form add messages, changed url for new batch form in course.html, changed get_recent_sketch to have an owner filter 2021-05-03 15:57:00 +05:30
pateljannat
cf68d3127c fix: conflicts 2021-05-03 15:51:06 +05:30
pateljannat
f13bb494ef fix: converted tabs to spaces 2021-05-03 15:50:14 +05:30
Jannat Patel
5e18cd2ef4 Merge pull request #52 from fossunited/invite-flow
fix: invite flow and add new batch form enhancements
2021-05-03 15:47:09 +05:30
pateljannat
5fdecb708e fix: tabs to space, moved js to widget, removed unrelated changes 2021-05-03 15:14:11 +05:30
pateljannat
0144ab60de fix: logout issue, liscence.txt change 2021-05-03 15:05:23 +05:30
pateljannat
565787eeb6 feat: new-sign-up-form, request invite widget, request invite tests, get_sketches with owner 2021-05-03 12:33:31 +05:30
Anand Chitipothu
b9d94df4d8 refactor: refactored the course page
- simplified the portal page for course
- added mentods to LMS Course and Community Member to reduce custom code
  in portal pages
- included lessons in the ChapterTeaser
2021-05-03 12:05:17 +05:30
Anand Chitipothu
9e103af8b5 refactor: added auto name to chapter and lesson doctypes 2021-05-03 06:52:22 +05:30
Anand Chitipothu
5728714d71 feat: added lesson doctype 2021-05-03 06:50:23 +05:30
Anand Chitipothu
62cfc0fb24 feat: Added ChapterTeaser widget 2021-05-03 06:50:07 +05:30
Anand Chitipothu
a52a01ef7f feat: Added chapter doctype
Also linked it from the LMS Course doctype.

Issue #56
2021-05-03 06:06:35 +05:30
pateljannat
cd1d2067ad Merge branch 'main' of https://github.com/frappe/community into invite-flow 2021-05-02 11:05:35 +05:30
Khaleel Gibran
67d3ec75c8 feat: design homepage based on figma design 2021-05-01 18:51:44 +05:30
pateljannat
52f16131af fix: add new batch form enhancements (#43) invite request doctype and flow (#42) 2021-05-01 14:37:57 +05:30
Anand Chitipothu
59dba7730f refactor: switched to less for css (#49)
- Added build setup to include styles.less in building community.css
- The old styles are still in style.css. Those styles will be slowly moved to style.less.
- Move all the new styles to style.less
2021-04-29 16:53:16 +05:30
553 changed files with 20680 additions and 5003 deletions

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -36,25 +36,43 @@ jobs:
- name: setup node
uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '14'
check-latest: true
- name: setup cache for bench
uses: actions/cache@v2
with:
path: ~/bench-cache
key: ${{ runner.os }}
- name: install bench
run: pip3 install frappe-bench
run: |
pip3 install frappe-bench
which bench
- name: bench init
run: bench init ~/frappe-bench --skip-redis-config-generation
- name: add community app to bench
run: |
if [ -d ~/bench-cache/bench.tgz ]
then
(cd && tar xzf ~/bench-cache/bench.tgz)
else
bench init ~/frappe-bench --skip-redis-config-generation --skip-assets --python "$(which python)"
mkdir -p ~/bench-cache
(cd && tar czf ~/bench-cache/bench.tgz frappe-bench)
fi
- name: add school app to bench
working-directory: /home/runner/frappe-bench
run: bench get-app community $GITHUB_WORKSPACE
run: bench get-app school $GITHUB_WORKSPACE
- name: create bench site
working-directory: /home/runner/frappe-bench
run: bench new-site --mariadb-root-password root --admin-password admin frappe.local
- name: install community app
- name: install school app
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local install-app community
run: bench --verbose --site frappe.local install-app school
- name: allow tests
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local set-config allow_tests true
- name: bench build
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local build
- name: run tests
working-directory: /home/runner/frappe-bench
run: bench --site frappe.local run-tests --app community
run: bench --site frappe.local run-tests --app school

6
.gitignore vendored
View File

@@ -3,4 +3,8 @@
*.egg-info
*.swp
tags
community/docs/current
school/docs/current
school/public/dist
__pycache__/
*.py[cod]
*$py.class

View File

@@ -4,15 +4,15 @@ include *.json
include *.md
include *.py
include *.txt
recursive-include community *.css
recursive-include community *.csv
recursive-include community *.html
recursive-include community *.ico
recursive-include community *.js
recursive-include community *.json
recursive-include community *.md
recursive-include community *.png
recursive-include community *.py
recursive-include community *.svg
recursive-include community *.txt
recursive-exclude community *.pyc
recursive-include school *.css
recursive-include school *.csv
recursive-include school *.html
recursive-include school *.ico
recursive-include school *.js
recursive-include school *.json
recursive-include school *.md
recursive-include school *.png
recursive-include school *.py
recursive-include school *.svg
recursive-include school *.txt
recursive-exclude school *.pyc

View File

@@ -1,4 +1,4 @@
## Community
## School
This app helps people organize and manage their own communities.
@@ -7,16 +7,16 @@ The App has following components:
1. Hackathons
1. LMS
Community is built on the [Frappe Framework](https://github.com/frappe/frappe), a full-stack web app framework built with Python & JavaScript.
School is built on the [Frappe Framework](https://github.com/frappe/frappe), a full-stack web app framework built with Python & JavaScript.
## Development Setup
**Step 1:** Clone the repo
```
$ git clone https://github.com/fossunited/community.git
$ git clone https://github.com/frappe/school.git
$ cd community
$ cd school
```
**Step 2:** Run docker-compose
@@ -59,15 +59,15 @@ To setup the repository locally follow the steps mentioned below:
1. Install bench and setup a frappe-bench directory by following the [Installation Steps](https://frappeframework.com/docs/user/en/installation).
1. Start the server by running bench start.
1. In a separate terminal window, create a new site by running bench new-site community.test.
1. Run bench get-app https://github.com/fossunited/community.
1. Run bench --site community.test install-app community.
1. Map your site to localhost with the command ```bench --site community.test add-to-hosts```
1. Now open the URL http://community.test:8000/docs in your browser, you should see the app running.
1. In a separate terminal window, create a new site by running bench new-site school.test.
1. Run bench get-app https://github.com/frappe/school.
1. Run bench --site school.test install-app school.
1. Map your site to localhost with the command ```bench --site school.test add-to-hosts```
1. Now open the URL http://school.test:8000/ in your browser, you should see the app running.
### Contribution Guidelines (for The Hard Way)
1. Go to the apps/community directory of your installation and execute git pull --unshallow to ensure that you have the full git repository. Also fork the fossunited/community repository on GitHub.
1. Go to the apps/school directory of your installation and execute git pull --unshallow to ensure that you have the full git repository. Also fork the frappe/school repository on GitHub.
1. Check out a working branch in git (e.g. git checkout -b my-new-branch).
1. Make your proposed changes to the source
1. Run your local version (e.g. bench start in your bench installation). Make sure that your changes work the way you want them to.

View File

@@ -1,8 +0,0 @@
// Copyright (c) 2021, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on('Community Course Member', {
// refresh: function(frm) {
// }
});

View File

@@ -1,96 +0,0 @@
{
"actions": [],
"autoname": "field:user_name",
"creation": "2021-03-02 11:24:49.612530",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"enabled",
"full_name",
"user_name",
"email",
"short_intro",
"bio",
"photo",
"route"
],
"fields": [
{
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"fieldname": "full_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Full Name",
"reqd": 1
},
{
"fieldname": "user_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "User Name",
"reqd": 1,
"unique": 1
},
{
"fieldname": "email",
"fieldtype": "Data",
"label": "Email",
"options": "Email",
"reqd": 1
},
{
"fieldname": "short_intro",
"fieldtype": "Data",
"label": "Short Intro"
},
{
"fieldname": "bio",
"fieldtype": "Markdown Editor",
"label": "Bio"
},
{
"fieldname": "photo",
"fieldtype": "Attach Image",
"label": "Photo"
},
{
"fieldname": "route",
"fieldtype": "Data",
"label": "Route"
}
],
"has_web_view": 1,
"index_web_pages_for_search": 1,
"is_published_field": "enabled",
"links": [],
"modified": "2021-04-06 11:50:41.551665",
"modified_by": "Administrator",
"module": "Community",
"name": "Community Course Member",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"route": "community-course-member",
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@@ -1,67 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import re
from frappe.website.website_generator import WebsiteGenerator
from frappe import _
class CommunityCourseMember(WebsiteGenerator):
def get_context(self, context):
context.abbr = ("").join([ s[0] for s in self.full_name.split() ])
return context
def validate(self):
self.validate_user_name()
if not self.route:
self.route = self.user_name
def validate_user_name(self):
if len(self.user_name) < 4:
frappe.throw(_("Username must be atleast 4 characters long."))
if not re.match("^[A-Za-z0-9_]*$", self.user_name):
frappe.throw(_("Username can only contain alphabets, numbers, and underscore."))
self.user_name = self.user_name.lower()
def after_insert(self):
if frappe.db.exists("User", self.email):
user = frappe.get_doc("User", self.email)
else:
user, update_password_link = self.create_user()
self.send_email(update_password_link)
def send_email(self, update_password_link):
args = {
'update_password_link': update_password_link,
'full_name': self.full_name,
}
frappe.sendmail(
recipients=self.email,
sender="Administrator",
subject=_("Set your Password"),
template="community_course_membership",
reference_doctype=self.doctype,
reference_name=self.name,
send_priority=0,
queue_separately=True,
args=args)
def create_user(self):
user = frappe.get_doc({
"doctype": "User",
"email": self.email,
"first_name": self.full_name.split(" ")[0],
"full_name": self.full_name,
"username": self.user_name,
"send_welcome_email": 0,
"user_type": 'Website User',
"redirect_url": self.name
})
user.save(ignore_permissions=True)
update_password_link = user.reset_password()
return user, update_password_link

View File

@@ -1,25 +0,0 @@
{% extends "templates/web.html" %}
{% block page_content %}
<div class="py-20 row">
{% if photo %}
<div class="col-sm-2 border border-dark">
<img src="{{ photo }}" alt="{{ full_name }}">
</div>
{% else %}
<div class="col-sm-2">
<div class="standard-image" style="font-size: 30px;">{{ abbr }}</div>
</div>
{% endif %}
<div class="col">
<h1>{{ full_name }}</h1>
{% if short_intro %}
<p class="lead"> {{ short_intro }} </p>
{% endif %}
{% if bio %}
<p class="markdown-style"> {{ frappe.utils.md_to_html(bio) }} </p>
{% endif %}
</div>
</div>
{% endblock %}
<!-- this is a sample default web page template -->

View File

@@ -1,4 +0,0 @@
<div>
<a href="{{ doc.route }}">{{ doc.full_name }}</a>
</div>
<!-- this is a sample default list template -->

View File

@@ -1,10 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestCommunityCourseMember(unittest.TestCase):
pass

View File

@@ -1,8 +0,0 @@
// Copyright (c) 2021, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on('Community Member', {
// refresh: function(frm) {
// }
});

View File

@@ -1,155 +0,0 @@
{
"actions": [],
"allow_guest_to_view": 1,
"allow_rename": 1,
"creation": "2021-02-12 15:47:23.591567",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"full_name",
"email",
"enabled",
"column_break_4",
"username",
"email_preference",
"section_break_7",
"bio",
"section_break_9",
"role",
"photo",
"column_break_12",
"short_intro",
"route",
"abbr"
],
"fields": [
{
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"fieldname": "full_name",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Full Name",
"reqd": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "role",
"fieldtype": "Select",
"label": "Role",
"options": "\nBoard\nDirector\nVolunteer\nSpeaker"
},
{
"allow_in_quick_entry": 1,
"fieldname": "photo",
"fieldtype": "Attach Image",
"label": "Photo"
},
{
"fieldname": "short_intro",
"fieldtype": "Data",
"label": "Short Intro"
},
{
"allow_in_quick_entry": 1,
"fieldname": "bio",
"fieldtype": "Markdown Editor",
"label": "Bio"
},
{
"fieldname": "route",
"fieldtype": "Data",
"label": "Route"
},
{
"fieldname": "email",
"fieldtype": "Data",
"in_standard_filter": 1,
"label": "Email",
"options": "Email",
"reqd": 1,
"unique": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "username",
"fieldtype": "Data",
"in_list_view": 1,
"label": "User Name",
"unique": 1
},
{
"fieldname": "email_preference",
"fieldtype": "Select",
"label": "Email preference",
"options": "Email on every Message\nOne Digest Mail per day\nNever"
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break"
},
{
"fieldname": "section_break_9",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"fieldname": "abbr",
"fieldtype": "Data",
"label": "Abbr",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-04-28 11:22:35.402217",
"modified_by": "Administrator",
"module": "Community",
"name": "Community Member",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Website Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"search_fields": "full_name",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "full_name",
"track_changes": 1
}

View File

@@ -1,64 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import re
from frappe import _
from frappe.model.document import Document
import random
class CommunityMember(Document):
def validate(self):
self.validate_username()
self.abbr = ("").join([ s[0] for s in self.full_name.split() ])
if self.route != self.username:
self.route = self.username
def validate_username(self):
if not self.username:
self.username = create_username_from_email(self.email)
if self.username:
if len(self.username) < 4:
frappe.throw(_("Username must be atleast 4 characters long."))
if not re.match("^[A-Za-z0-9_]*$", self.username):
frappe.throw(_("Username can only contain alphabets, numbers and underscore."))
self.username = self.username.lower()
def __repr__(self):
return f"<CommunityMember: {self.email}>"
def create_member_from_user(doc, method):
username = doc.username
if ( doc.username and username_exists(doc.username)) or not doc.username:
username = create_username_from_email(doc.email)
elif len(doc.username) < 4:
username = adjust_username(doc.username)
if username_exists(username):
username = username + str(random.randint(0,9))
member = frappe.get_doc({
"doctype": "Community Member",
"full_name": doc.full_name,
"username": username,
"email": doc.email,
"route": doc.username,
"owner": doc.email
})
member.save(ignore_permissions=True)
def username_exists(username):
return frappe.db.exists("Community Member", dict(username=username))
def create_username_from_email(email):
string = email.split("@")[0]
return ''.join(e for e in string if e.isalnum())
def adjust_username(username):
return username.ljust(4, str(random.randint(0,9)))

View File

@@ -1,25 +0,0 @@
{% extends "templates/web.html" %}
{% block page_content %}
<div class="py-20 row">
{% if photo %}
<div class="col-sm-2 border border-dark">
<img src="{{ photo }}" alt="{{ full_name }}">
</div>
{% else %}
<div class="col-sm-2">
<div class="standard-image" style="font-size: 30px;">{{ abbr }}</div>
</div>
{% endif %}
<div class="col">
<h1>{{ full_name }}</h1>
{% if short_intro %}
<p class="lead"> {{ short_intro }} </p>
{% endif %}
{% if bio %}
<p class="markdown-style"> {{ frappe.utils.md_to_html(bio) }} </p>
{% endif %}
</div>
</div>
{% endblock %}
<!-- this is a sample default web page template -->

View File

@@ -1,4 +0,0 @@
<div>
<a href="{{ doc.route }}">{{ doc.title or doc.name }}</a>
</div>
<!-- this is a sample default list template -->

View File

@@ -1,92 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
from community.lms.doctype.lms_course.test_lms_course import new_user
import frappe
import unittest
class TestCommunityMember(unittest.TestCase):
@classmethod
def setUpClass(self):
users = ["test_user@example.com","test_user1@example.com"]
for user in users:
if not frappe.db.exists("User", user):
new_user("Test User", user)
def test_member_created_from_user(self):
user = frappe.db.get_value("User","test_user@example.com", ["full_name", "email", "username"], as_dict=True)
self.assertTrue(frappe.db.exists("Community Member", {"username":user.username}))
member = frappe.db.get_value("Community Member",
filters={"email": user.email},
fieldname=["full_name", "email", "owner", "username", "route"],
as_dict=True
)
self.assertEqual(user.full_name, member.full_name)
self.assertEqual(member.owner, user.email)
self.assertEqual(user.username, member.username)
self.assertEqual(member.username, member.route)
def test_members_with_same_name(self):
user1 = frappe.db.get_value("User","test_user@example.com", ["email"], as_dict=True)
user2 = frappe.get_doc("User","test_user1@example.com", ["email"], as_dict=True)
self.assertTrue(frappe.db.exists("Community Member", {"email": user1.email} ))
self.assertTrue(frappe.db.exists("Community Member", {"email": user2.email }))
member1 = frappe.db.get_value("Community Member",
filters={"email": user1.email},
fieldname=["full_name", "email", "owner", "username", "route"],
as_dict=True
)
member2 = frappe.db.get_value("Community Member",
filters={"email": user2.email},
fieldname=["full_name", "email", "owner", "username", "route"],
as_dict=True
)
self.assertEqual(member1.full_name, member2.full_name)
self.assertEqual(member1.email, user1.email)
self.assertEqual(member2.email, user2.email)
self.assertNotEqual(member1.username, member2.username)
def test_username_validations(self):
user = new_user("Tst", "tst@example.com")
self.assertTrue(frappe.db.exists("Community Member", {"email":user.email} ))
member = frappe.db.get_value("Community Member",
filters={"email": user.email},
fieldname=["username"],
as_dict=True
)
self.assertEqual(len(member.username), 4)
frappe.delete_doc("User", user.email)
def test_user_without_username(self):
user = new_user("Test User", "test_user2@example.com")
self.assertTrue(frappe.db.exists("Community Member", {"email":user.email} ))
member = frappe.db.get_value("Community Member",
filters={"email": user.email},
fieldname=["username"],
as_dict=True
)
self.assertTrue(member.username)
frappe.delete_doc("User", user.email)
@classmethod
def tearDownClass(self):
users = ["test_user@example.com","test_user1@example.com"]
for user in users:
if frappe.db.exists("User", user):
frappe.delete_doc("User", user)
if frappe.db.exists("Community Member", {"email": user}):
frappe.delete_doc("Community Member", {"email": user})

View File

@@ -1,16 +0,0 @@
import frappe
def create_members_from_users():
users = frappe.get_all("User", {"enabled": 1}, ["email"])
for user in users:
if not frappe.db.get_value("Community Member", {"email": user.email}, "name"):
doc = frappe.get_doc("User", {"email": user.email})
username = doc.username if doc.username and len(doc.username) > 3 else ("").join([ s for s in doc.full_name.split() ])
if not frappe.db.exists("Community Member", username):
member = frappe.new_doc("Community Member")
member.full_name = doc.full_name
member.username = username
member.email = doc.email
member.route = username
member.owner = doc.email
member.insert(ignore_permissions=True)

View File

@@ -1,5 +0,0 @@
frappe.ready(function() {
frappe.web_form.after_save = () => {
window.location.href = frappe.web_form.get_value("username")
}
})

View File

@@ -1,177 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "community"
app_title = "Community"
app_publisher = "FOSS United"
app_description = "Community App"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "jannat@erpnext.com"
app_license = "AGPL"
# Includes in <head>
# ------------------
# include js, css files in header of desk.html
app_include_css = "/assets/community/css/community.css"
app_include_js = "/assets/community/js/community.js"
# include js, css files in header of web template
web_include_css = "/assets/css/community.css"
# web_include_css = "/assets/community/css/community.css"
# web_include_js = "/assets/community/js/community.js"
# include custom scss in every website theme (without file extension ".scss")
# website_theme_scss = "community/public/scss/website"
# include js, css files in header of web form
# webform_include_js = {"doctype": "public/js/doctype.js"}
# webform_include_css = {"doctype": "public/css/doctype.css"}
# include js in page
# page_js = {"page" : "public/js/file.js"}
# include js in doctype views
# doctype_js = {"doctype" : "public/js/doctype.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
# Home Pages
# ----------
# application home page (will override Website Settings)
# home_page = "login"
# website user home page (by Role)
# role_home_page = {
# "Role": "home_page"
# }
# Generators
# ----------
# automatically create page for each record of this doctype
# website_generators = ["Web Page"]
# Installation
# ------------
# before_install = "community.install.before_install"
# after_install = "community.install.after_install"
# Desk Notifications
# ------------------
# See frappe.core.notifications.get_notification_config
# notification_config = "community.notifications.get_notification_config"
# Permissions
# -----------
# Permissions evaluated in scripted ways
# permission_query_conditions = {
# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# }
#
# has_permission = {
# "Event": "frappe.desk.doctype.event.event.has_permission",
# }
# DocType Class
# ---------------
# Override standard doctype classes
# override_doctype_class = {
# "ToDo": "custom_app.overrides.CustomToDo"
# }
# Document Events
# ---------------
# Hook on document methods and events
doc_events = {
"User": {
"after_insert": "community.community.doctype.community_member.community_member.create_member_from_user"
},
"LMS Message": {
"after_insert": "community.lms.doctype.lms_message.lms_message.publish_message"
}
}
# Scheduled Tasks
# ---------------
#scheduler_events = {
# "daily": [
# "erpnext.stock.reorder_item.reorder_item"
# ]
#}
# Testing
# -------
# before_tests = "community.install.before_tests"
# Overriding Methods
# ------------------------------
#
# override_whitelisted_methods = {
# "frappe.desk.doctype.event.event.get_events": "community.event.get_events"
# }
#
# each overriding function accepts a `data` argument;
# generated from the base implementation of the doctype dashboard,
# along with any modifications made in other Frappe apps
# override_doctype_dashboards = {
# "Task": "community.task.get_dashboard_data"
# }
# exempt linked doctypes from being automatically cancelled
#
# auto_cancel_exempted_doctypes = ["Auto Repeat"]
# Add all simple route rules here
primary_rules = [
{"from_route": "/sketches/<sketch>", "to_route": "sketches/sketch"},
{"from_route": "/courses/<course>", "to_route": "courses/course"},
{"from_route": "/courses/<course>/<topic>", "to_route": "courses/topic"},
{"from_route": "/hackathons", "to_route": "hackathons"},
{"from_route": "/hackathons/<hackathon>", "to_route": "hackathons/hackathon"},
{"from_route": "/hackathons/<hackathon>/<project>", "to_route": "hackathons/project"},
{"from_route": "/dashboard", "to_route": ""},
{"from_route": "/add-a-new-batch", "to_route": "add-a-new-batch"},
{"from_route": "/courses/<course>/<batch>/learn", "to_route": "courses/learn"},
{"from_route": "/courses/<course>/<batch>/schedule", "to_route": "courses/schedule"},
{"from_route": "/courses/<course>/<batch>/members", "to_route": "courses/members"},
{"from_route": "/courses/<course>/<batch>/discuss", "to_route": "courses/discuss"},
{"from_route": "/courses/<course>/<batch>/about", "to_route": "courses/about"}
]
# Any frappe default URL is blocked by profile-rules, add it here to unblock it
whitelist = [
"/home",
"/login",
"/update-password",
"/update-profile",
"/third-party-apps",
"/website_script.js",
"/courses",
"/sketches",
"/admin",
"/socket.io",
"/hackathons",
"/dashboard",
"/join-request"
"/add-a-new-batch"
]
whitelist_rules = [{"from_route": p, "to_route": p[1:]} for p in whitelist]
# regex rule to match all profiles
profile_rules = [
{"from_route": "/<string(minlength=4):username>", "to_route": "profiles/profile"},
]
website_route_rules = primary_rules + whitelist_rules + profile_rules
update_website_context = 'community.widgets.update_website_context'

View File

@@ -1,23 +0,0 @@
"""API methods for the LMS.
"""
import frappe
@frappe.whitelist()
def autosave_section(section, code):
"""Saves the code edited in one of the sections.
"""
doc = frappe.get_doc(
doctype="Code Revision",
section=section,
code=code,
author=frappe.session.user)
doc.insert()
return {"name": doc.name}
@frappe.whitelist()
def get_section(name):
"""Saves the code edited in one of the sections.
"""
doc = frappe.get_doc("LMS Section", name)
return doc and doc.as_dict()

View File

@@ -1,39 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from community.www.courses.utils import get_member_with_email
class LMSBatch(Document):
def validate(self):
if not self.code:
self.generate_code()
def generate_code(self):
short_code = frappe.db.get_value("LMS Course", self.course, "short_code")
course_batches = frappe.get_all("LMS Batch",{"course":self.course})
self.code = short_code + str(len(course_batches) + 1)
@frappe.whitelist()
def get_messages(batch):
messages = frappe.get_all("LMS Message", {"batch": batch}, ["*"], order_by="creation")
for message in messages:
message.message = frappe.utils.md_to_html(message.message)
member_email = frappe.db.get_value("Community Member", message.author, ["email"])
if member_email == frappe.session.user:
message.author_name = "You"
message.is_author = True
return messages
@frappe.whitelist()
def save_message(message, batch):
doc = frappe.get_doc({
"doctype": "LMS Message",
"batch": batch,
"author": get_member_with_email(),
"message": message
})
doc.save(ignore_permissions=True)

View File

@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class LMSBatchMembership(Document):
def validate(self):
self.validate_membership_in_same_batch()
self.validate_membership_in_different_batch_same_course()
def validate_membership_in_same_batch(self):
previous_membership = frappe.db.get_value("LMS Batch Membership", {"member": self.member, "batch": self.batch}, ["member_type","member"], as_dict=1)
if previous_membership:
member_name = frappe.db.get_value("Community Member", self.member, "full_name")
frappe.throw(_("{0} is already a {1} of {2}").format(member_name, previous_membership.member_type, self.batch))
def validate_membership_in_different_batch_same_course(self):
course = frappe.db.get_value("LMS Batch", self.batch, "course")
previous_membership = frappe.get_all("LMS Batch Membership", {"member": self.member}, ["batch", "member_type"])
for membership in previous_membership:
batch_course = frappe.db.get_value("LMS Batch", membership.batch, "course")
if batch_course == course and (membership.member_type == "Student" or self.member_type == "Student"):
member_name = frappe.db.get_value("Community Member", self.member, "full_name")
frappe.throw(_("{0} is already a {1} of {2} course through {3} batch").format(member_name, membership.member_type, course, membership.batch))
@frappe.whitelist()
def create_membership(batch, member=None, member_type="Student", role="Member"):
if not member:
member = frappe.db.get_value("Community Member", {"email": frappe.session.user}, "name")
frappe.get_doc({
"doctype": "LMS Batch Membership",
"batch": batch,
"role": role,
"member_type": member_type,
"member": member
}).save(ignore_permissions=True)
return "OK"

View File

@@ -1,10 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestLMSBatchMembership(unittest.TestCase):
pass

View File

@@ -1,117 +0,0 @@
{
"actions": [],
"allow_guest_to_view": 1,
"allow_rename": 1,
"autoname": "field:title",
"creation": "2021-03-01 16:49:33.622422",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"title",
"slug",
"is_published",
"column_break_3",
"short_code",
"video_link",
"section_break_5",
"short_introduction",
"description"
],
"fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Title",
"reqd": 1,
"unique": 1
},
{
"fieldname": "description",
"fieldtype": "Markdown Editor",
"label": "Description"
},
{
"default": "0",
"fieldname": "is_published",
"fieldtype": "Check",
"label": "Published"
},
{
"fieldname": "short_code",
"fieldtype": "Data",
"label": "Short Code"
},
{
"description": "The slug of the course. Autogenerated from the title if not specified.",
"fieldname": "slug",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Slug",
"unique": 1
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "video_link",
"fieldtype": "Data",
"label": "Video Embed Link"
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break"
},
{
"fieldname": "short_introduction",
"fieldtype": "Small Text",
"label": "Short Introduction"
}
],
"index_web_pages_for_search": 1,
"is_published_field": "is_published",
"links": [
{
"group": "Topics",
"link_doctype": "LMS Topic",
"link_fieldname": "course"
},
{
"group": "Batches",
"link_doctype": "LMS Batch",
"link_fieldname": "course"
},
{
"group": "Mentors",
"link_doctype": "LMS Course Mentor Mapping",
"link_fieldname": "course"
}
],
"modified": "2021-04-21 14:45:41.658056",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"search_fields": "slug",
"sort_field": "creation",
"sort_order": "DESC",
"title_field": "title",
"track_changes": 1,
"track_views": 1
}

View File

@@ -1,102 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from ...utils import slugify
class LMSCourse(Document):
def before_save(self):
if not self.slug:
self.slug = self.generate_slug(title=self.title)
def generate_slug(self, title):
result = frappe.get_all(
'LMS Course',
fields=['slug'])
slugs = set([row['slug'] for row in result])
return slugify(title, used_slugs=slugs)
def __repr__(self):
return f"<Course#{self.name} {self.slug}>"
def get_topic(self, slug):
"""Returns the topic with given slug in this course as a Document.
"""
result = frappe.get_all(
"LMS Topic",
filters={"course": self.name, "slug": slug})
if result:
row = result[0]
return frappe.get_doc('LMS Topic', row['name'])
def has_mentor(self, email):
"""Checks if this course has a mentor with given email.
"""
if not email or email == "Guest":
return False
member = self.get_community_member(email)
if not member:
return False
mapping = frappe.get_all("LMS Course Mentor Mapping", {"course": self.name, "mentor": member})
return mapping != []
def get_community_member(self, email):
"""Returns the name of Community Member document for a give user.
"""
try:
return frappe.db.get_value("Community Member", {"email": email}, ["name"])
except frappe.DoesNotExistError:
return None
def add_mentor(self, email):
"""Adds a new mentor to the course.
"""
if not email:
raise ValueError("Invalid email")
if email == "Guest":
raise ValueError("Guest user can not be added as a mentor")
# given user is already a mentor
if self.has_mentor(email):
return
member = self.get_community_member(email)
if not member:
return False
doc = frappe.get_doc({
"doctype": "LMS Course Mentor Mapping",
"course": self.name,
"mentor": member
})
doc.insert()
def get_mentors(self):
"""Returns the list of all mentors for this course.
"""
course_mentors = []
mentors = frappe.get_all("LMS Course Mentor Mapping", {"course": self.name}, ["mentor"])
for mentor in mentors:
member = frappe.get_doc("Community Member", mentor.mentor)
# TODO: change this to count query
member.batch_count = len(frappe.get_all("LMS Batch Membership", {"member": member.name, "member_type": "Mentor"}))
course_mentors.append(member)
return course_mentors
def get_instructor(self):
return frappe.get_doc("User", self.owner)
@staticmethod
def find_all():
"""Returns all published courses.
"""
rows = frappe.db.get_all("LMS Course",
filters={"is_published": True},
fields='*')
return [frappe.get_doc(dict(row, doctype='LMS Course')) for row in rows]

View File

@@ -1,91 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class LMSMentorRequest(Document):
def on_update(self):
if self.has_value_changed('status'):
template = frappe.db.get_single_value('LMS Settings', 'mentor_request_status_update')
if not template:
return
email_template = frappe.get_doc('Email Template', template)
message = frappe.render_template(email_template.response, {'member_name': self.member_name, 'status': self.status})
subject = _('The status of your application has changed.')
member_email = frappe.db.get_value("Community Member", self.member, "email")
if self.status == 'Approved' or self.status == 'Rejected':
reviewed_by = frappe.db.get_value('Community Member', self.reviewed_by, 'email')
send_email(member_email, [get_course_author(self.course), reviewed_by], subject, message)
elif self.status == 'Withdrawn':
send_email([member_email, get_course_author(self.course)], None, subject, message)
@frappe.whitelist()
def has_requested(course):
return len(frappe.get_all('LMS Mentor Request',
filters = {
'member': get_member().name,
'course': course,
'status': ['in', ('Pending', 'Approved')]
}
)
)
@frappe.whitelist()
def create_request(course):
if not has_requested(course):
member = get_member()
frappe.get_doc({
'doctype': 'LMS Mentor Request',
'member': member.name,
'course': course,
'status': 'Pending'
}).save(ignore_permissions=True)
send_creation_email(course, member)
return 'OK'
else:
return 'Already Applied'
@frappe.whitelist()
def cancel_request(course):
request = frappe.get_doc('LMS Mentor Request', {'member': get_member().name, 'course': course, 'status': ['in', ('Pending', 'Approved')]})
request.status = 'Withdrawn'
request.save(ignore_permissions=True)
return 'OK'
def get_member():
try:
return frappe.get_doc('Community Member', {'email': frappe.session.user})
except frappe.DoesNotExistError:
return
def get_course_author(course):
return frappe.db.get_value('LMS Course', course, 'owner')
def send_creation_email(course, member):
template = frappe.db.get_single_value('LMS Settings', 'mentor_request_creation')
if not template:
return
email_template = frappe.get_doc('Email Template', template)
member_name = member.full_name
message = frappe.render_template(email_template.response, {'member_name': member_name})
subject = _('Request for Mentorship')
send_email([frappe.session.user, get_course_author(course)], None, subject, message)
def send_email(recipients, cc, subject, message):
frappe.sendmail(
recipients = recipients,
cc = cc,
sender = frappe.db.get_single_value('LMS Settings', 'email_sender'),
subject = subject,
send_priority = 0,
queue_separately = True,
message = message
)

View File

@@ -1,104 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
from frappe.utils import add_days, nowdate
from community.www.courses.utils import get_batch_members
class LMSMessage(Document):
""" def after_insert(self):
self.send_email() """
def send_email(self):
membership = frappe.get_all("LMS Batch Membership", {"batch": self.batch}, ["member"])
for entry in membership:
member = frappe.get_doc("Community Member", entry.member)
if member.name != self.author and member.email_preference == "Email on every Message":
frappe.sendmail(
recipients = member.email,
subject = _("New Message on ") + self.batch,
header = _("New Message on ") + self.batch,
template = "lms_message",
args = {
"author": self.author,
"message": frappe.utils.md_to_html(self.message),
"creation": frappe.utils.format_datetime(self.creation, "medium"),
"course": frappe.db.get_value("LMS Batch", self.batch, ["course"])
}
)
def send_daily_digest():
emails = frappe._dict()
messages = frappe.get_all("LMS Message", {"creation": [">=", add_days(nowdate(), -1)]}, ["message", "batch", "author", "creation"])
for message in messages:
membership = frappe.get_all("LMS Batch Membership", {"batch": message.batch}, ["member"])
for entry in membership:
member = frappe.db.get_value("Community Member", entry.member, ["name", "email_preference", "email"], as_dict=1)
if member.name != message.author and member.email_preference == "One Digest Mail per day":
if member.name in emails.keys():
emails[member.name]["messages"].append(message)
else:
emails[member.name] = frappe._dict({
"email": member.email,
"messages": [message]
})
for email in emails:
group_by_batch = frappe._dict()
for message in emails[email]["messages"]:
if message.batch in group_by_batch.keys():
group_by_batch[message.batch].append(message)
else:
group_by_batch[message.batch] = [message]
frappe.sendmail(
recipients = frappe.db.get_value("Community Member", email, "email"),
subject = _("Message Digest"),
header = _("Message Digest"),
template = "lms_daily_digest",
args = {
"batches": group_by_batch
},
delayed = False
)
def publish_message(doc, method):
email = frappe.db.get_value("Community Member", doc.author, "email")
template = get_message_template()
message = frappe._dict()
message.author_name = doc.author_name
message.message_time = frappe.utils.pretty_date(doc.creation)
message.message = frappe.utils.md_to_html(doc.message)
js = """
$(".msger-input").val("");
var template = `{0}`;
var message = {1};
var session_user = ("{2}" == frappe.session.user) ? true : false;
message.author_name = session_user ? "You" : message.author_name
message.is_author = session_user;
template = frappe.render_template(template, {{
"message": message
}})
$(".message-section").append(template);
""".format(template, message, email)
frappe.publish_realtime(event="eval_js", message=js, after_commit=True)
def get_message_template():
return """
<div class="discussion {% if message.is_author %} is-author {% endif %}">
<div class="d-flex justify-content-between">
<div class="font-weight-bold">
{{ message.author_name }}
</div>
<div class="text-muted">
{{ message.message_time }}
</div>
</div>
<div class="mt-5">
{{ message.message }}
</div>
</div>
"""

View File

@@ -1,60 +0,0 @@
{
"actions": [],
"creation": "2021-03-05 15:10:53.906006",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"label",
"type",
"contents",
"code",
"attrs",
"index"
],
"fields": [
{
"fieldname": "label",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Label"
},
{
"fieldname": "type",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Type"
},
{
"fieldname": "contents",
"fieldtype": "Markdown Editor",
"label": "Contents"
},
{
"fieldname": "code",
"fieldtype": "Code",
"label": "Code"
},
{
"fieldname": "attrs",
"fieldtype": "Long Text",
"label": "attrs"
},
{
"fieldname": "index",
"fieldtype": "Int",
"label": "Index"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-03-12 17:56:23.118854",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Section",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@@ -1,48 +0,0 @@
"""Utilities to work with livecode service.
"""
import websocket
import json
from .svg import SVG
def livecode_to_svg(livecode_ws_url, code, *, timeout=1):
"""Renders the code as svg.
"""
print("livecode_to_svg")
ws = websocket.WebSocket()
ws.settimeout(timeout)
ws.connect(livecode_ws_url)
msg = {
"msgtype": "exec",
"runtime": "python-canvas",
"code": code
}
ws.send(json.dumps(msg))
messages = _read_messages(ws)
commands = [m['cmd'] for m in messages if m['msgtype'] == 'draw']
img = draw_image(commands)
return img.tostring()
def _read_messages(ws):
messages = []
try:
while True:
msg = ws.recv()
if not msg:
break
messages.append(json.loads(msg))
except websocket.WebSocketTimeoutException:
pass
return messages
def draw_image(commands):
img = SVG(width=300, height=300, viewBox="0 0 300 300", fill='none', stroke='black')
for c in commands:
if c['function'] == 'circle':
img.circle(cx=c['x'], cy=c['y'], r=c['d']/2)
elif c['function'] == 'line':
img.line(x1=c['x1'], y1=c['y1'], x2=c['x2'], y2=c['y2'])
elif c['function'] == 'rect':
img.rect(x=c['x'], y=c['y'], width=c['w'], height=c['h'])
return img

View File

@@ -1,95 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import hashlib
from urllib.parse import urlparse
import frappe
from frappe.model.document import Document
from . import livecode
class LMSSketch(Document):
@property
def sketch_id(self):
"""Returns the numeric part of the name.
For example, the skech_id will be "123" for sketch with name "SKETCH-123".
"""
return self.name.replace("SKETCH-", "")
def get_owner(self):
"""Returns the owner of this sketch as a document.
"""
return frappe.get_doc("User", self.owner)
def get_owner_name(self):
return self.get_owner().full_name
def get_livecode_url(self):
doc = frappe.get_cached_doc("LMS Settings")
return doc.livecode_url
def get_livecode_ws_url(self):
url = urlparse(self.get_livecode_url())
protocol = "wss" if url.scheme == "https" else "ws"
return protocol + "://" + url.netloc + "/livecode"
def to_svg(self):
return self.svg or self.render_svg()
def render_svg(self):
h = hashlib.md5(self.code.encode('utf-8')).hexdigest()
cache = frappe.cache()
key = "sketch-" + h
value = cache.get(key)
if value:
value = value.decode('utf-8')
else:
ws_url = self.get_livecode_ws_url()
value = livecode.livecode_to_svg(ws_url, self.code)
cache.set(key, value)
return value
@staticmethod
def get_recent_sketches(limit=100):
"""Returns the recent sketches.
"""
sketches = frappe.get_all(
"LMS Sketch",
fields='*',
order_by='modified desc',
page_length=limit
)
return [frappe.get_doc(doctype='LMS Sketch', **doc) for doc in sketches]
def __repr__(self):
return f"<LMSSketch {self.name}>"
@frappe.whitelist()
def save_sketch(name, title, code):
if not name or name == "new":
doc = frappe.new_doc('LMS Sketch')
doc.title = title
doc.code = code
doc.runtime = 'python-canvas'
doc.insert()
status = "created"
else:
doc = frappe.get_doc("LMS Sketch", name)
if doc.owner != frappe.session.user:
return {
"ok": False,
"error": "Permission Denied"
}
doc.title = title
doc.code = code
doc.svg = ''
doc.save()
status = "updated"
return {
"ok": True,
"status": status,
"name": doc.name,
}

View File

@@ -1,143 +0,0 @@
"""SVG rendering library.
USAGE:
from svg import SVG
svg = SVG(width=200, height=200)
svg.circle(cx=100, cy=200, r=50)
print(svg.tostring())
"""
from xml.etree import ElementTree
TAGNAMES = set([
"circle", "ellipse",
"line", "path", "rect", "polygon", "polyline",
"text", "textPath", "title",
"marker", "defs",
"g"
])
class Node:
"""SVG Node"""
def __init__(self, tag, **attrs):
self.tag = tag
self.attrs = dict((k.replace('_', '-'), str(v)) for k, v in attrs.items())
self.children = []
def node(self, tag, **attrs):
n = Node(tag, **attrs)
self.children.append(n)
return n
def apply(self, func):
"""Applies a function to this node and
all the children recursively.
"""
func(self)
for n in self.children:
n.apply(func)
def clone(self):
node = Node(self.tag, **self.attrs)
node.children = [n.clone() for n in self.children]
return node
def add_node(self, node):
if not isinstance(node, Node):
node = Text(node)
self.children.append(node)
def __getattr__(self, tag):
if tag not in TAGNAMES:
raise AttributeError(tag)
return lambda **attrs: self.node(tag, **attrs)
def translate(self, x, y):
return self.g(transform="translate(%s, %s)" % (x, y))
def scale(self, *args):
return self.g(transform="scale(%s)" % ", ".join(str(a) for a in args))
def __repr__(self):
return "<%s .../>" % self.tag
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
pass
def build_tree(self, builder):
builder.start(self.tag, self.attrs)
for node in self.children:
node.build_tree(builder)
return builder.end(self.tag)
def _indent(self, elem, level=0):
"""Indent etree node for prettyprinting."""
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
self._indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i
def save(self, filename, encoding='utf-8'):
f = open(filename, 'w')
f.write(self.tostring())
f.close()
def tostring(self, encoding='utf-8'):
builder = ElementTree.TreeBuilder()
self.build_tree(builder)
e = builder.close()
self._indent(e)
return ElementTree.tostring(e, encoding).decode(encoding)
class Text(Node):
"""Text Node
>>> p = Node("p")
>>> p.add_node("hello, world!")
>>> p.tostring()
'<p>hello, world!</p>'
"""
def __init__(self, text):
Node.__init__(self, "__text__")
self._text = text
def build_tree(self, builder):
builder.data(str(self._text))
class SVG(Node):
"""
>>> svg = SVG(width=200, height=200)
>>> svg.rect(x=0, y=0, width=200, height=200, fill="blue")
<rect .../>
>>> with svg.translate(-50, -50) as g:
... g.rect(x=0, y=0, width=50, height=100, fill="red")
... g.rect(x=50, y=0, width=50, height=100, fill="green")
<rect .../>
<rect .../>
>>> print(svg.tostring())
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="200" height="200" fill="blue" />
<g transform="translate(-50, -50)">
<rect x="0" y="0" width="50" height="100" fill="red" />
<rect x="50" y="0" width="50" height="100" fill="green" />
</g>
</svg>
"""
def __init__(self, **attrs):
attrs['xmlns'] = "http://www.w3.org/2000/svg"
Node.__init__(self, 'svg', **attrs)

View File

@@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021, FOSS United and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from .section_parser import SectionParser
from ...utils import slugify
class LMSTopic(Document):
def before_save(self):
course = self.get_course()
if not self.slug:
self.slug = self.generate_slug(title=self.title)
sections = SectionParser().parse(self.description or "")
self.sections = [self.make_lms_section(i, s) for i, s in enumerate(sections)]
def get_course(self):
return frappe.get_doc("LMS Course", self.course)
def generate_slug(self, title):
result = frappe.get_all(
'LMS Topic',
filters={'course': self.course},
fields=['slug'])
slugs = set([row['slug'] for row in result])
return slugify(title, used_slugs=slugs)
def get_sections(self):
return sorted(self.sections, key=lambda s: s.index)
def make_lms_section(self, index, section):
s = frappe.new_doc('LMS Section', parent_doc=self, parentfield='sections')
s.type = section.type
s.label = section.label
s.contents = section.contents
s.index = index
return s

View File

@@ -1,79 +0,0 @@
"""Utility to split the text in the topic into multiple sections.
"""
from __future__ import annotations
from dataclasses import dataclass
import re
from typing import List, Tuple, Dict, Iterator
RE_SECTION = re.compile(r"^\{\{\s(\w+)\s*(?:\((.*)\))?\s*\}\}\s*")
class SectionParser:
def parse(self, text: str) -> Iterator[Section]:
"""Parses given text into sections and return an iterator over sections.
"""
lines = text.splitlines()
marked_lines = self.parse_lines(lines)
return self.group_sections(marked_lines)
def parse_lines(self, lines: List[str]) -> List[Tuple[str, str, str]]:
for line in lines:
m = RE_SECTION.match(line)
if m:
yield m.group(1), self.parse_attrs(m.group(2)), None
else:
yield None, None, line
def parse_attrs(self, attrs_str: str) -> Dict[str, str]:
# XXX-Anand: Hack
code = "dict({})".format(attrs_str or "")
return eval(code)
def group_sections(self, marked_lines) -> Iterator[Section]:
index = 0
def make_section(type='text', id=None, label=None, **attrs):
nonlocal index
index += 1
id = id or f"section-{index}"
label = label or id
return Section(
type=type,
id=id,
label=label,
attrs=attrs)
section = make_section("text")
for mark, attrs, line in marked_lines:
if not mark:
section.append(line)
continue
yield section
if mark == 'end':
section = make_section(type='text')
else:
section = make_section(**attrs)
yield section
@dataclass
class Section:
"""One section of the Topic.
"""
type: str
id: str
label: str
contents: str = ""
attrs: dict = None
def append(self, line):
if not line.endswith("\n"):
line = line + "\n"
self.contents += line
def __repr__(self):
attrs = dict(type=self.type, id=self.id, label=self.label, **self.attrs)
attrs_str = ", ".join(f'{k}="{v}"' for k, v in attrs.items())
return f'<Section({attrs_str})>'

View File

@@ -1,35 +0,0 @@
frappe.ready(function () {
frappe.web_form.after_save = () => {
let data = frappe.web_form.get_values();
frappe.call({
"method": "community.lms.doctype.lms_batch_membership.lms_batch_membership.create_membership",
"args": {
"batch": data.title,
"member_type": "Mentor"
},
"callback": (data) => {
if (data.message == "OK") {
window.location.href = "/courses"
}
}
})
}
frappe.web_form.validate = () => {
let data = frappe.web_form.get_values();
if (!frappe.datetime.validate(data.start_time) || !frappe.datetime.validate(data.end_time)) {
frappe.msgprint(__('Invalid Start or End Time.'));
return false;
}
if (data.start_time > data.end_time) {
frappe.msgprint(__('Start Time should be less than End Time.'));
return false;
}
console.log(data.start_date, date.nowdate())
if (data.start_date < date.nowdate()) {
frappe.msgprint(__('Start date cannot be a past date.'))
return false;
}
return true;
};
})

View File

@@ -1,12 +0,0 @@
frappe.ready(function() {
// bind events here
frappe.web_form.after_load = () => {
frappe.web_form.set_value(["batch"], [frappe.utils.get_url_arg('batch')]);
frappe.web_form.set_value(["author"], [frappe.utils.get_url_arg('author')]);
}
frappe.web_form.success_url = `courses/course?course=${frappe.utils.get_url_arg('course')}`;
$('.breadcrumb-container')
.html(`<a href="${frappe.web_form.success_url}">Back to my course</a>`)
.addClass('py-4');
})

View File

@@ -1,3 +0,0 @@
frappe.ready(function() {
// bind events here
})

View File

@@ -1,48 +0,0 @@
{
"accept_payment": 0,
"allow_comments": 0,
"allow_delete": 0,
"allow_edit": 0,
"allow_incomplete": 0,
"allow_multiple": 0,
"allow_print": 0,
"amount": 0.0,
"amount_based_on_field": 0,
"apply_document_permissions": 0,
"button_label": "Save",
"creation": "2021-04-15 13:32:14.171328",
"doc_type": "LMS Batch Membership",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2021-04-15 13:32:14.171328",
"modified_by": "Administrator",
"module": "LMS",
"name": "join-a-batch",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 1,
"route": "join-a-batch",
"route_to_success_link": 0,
"show_attachments": 0,
"show_in_grid": 0,
"show_sidebar": 0,
"sidebar_items": [],
"success_url": "/join-a-batch",
"title": "Join a Batch",
"web_form_fields": [
{
"allow_read_on_all_link_options": 0,
"fieldtype": "Attach",
"hidden": 0,
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
}
]
}

View File

@@ -1,13 +0,0 @@
<div class="course-teaser">
<div class="course-body">
<h3 class="course-title"><a href="/courses/{{ course.slug }}">{{ course.title }}</a></h3>
<div class="course-intro">
{{ course.short_introduction or "" }}
</div>
</div>
<div class="course-footer">
<div class="course-author">
{{ course.get_instructor().full_name }}
</div>
</div>
</div>

View File

@@ -1,15 +0,0 @@
<div class="sketch-teaser">
<div class="sketch-image">
<a href="/sketches/{{sketch.sketch_id}}">
{{ sketch.to_svg() }}
</a>
</div>
<div class="sketch-footer">
<div class="sketch-title">
<a href="sketches/{{sketch.sketch_id}}">{{sketch.title}}</a>
</div>
<div class="sketch-author">
by {{sketch.get_owner().full_name}}
</div>
</div>
</div>

View File

@@ -1,4 +0,0 @@
Community
Hackathon
LMS
Conference

View File

@@ -1,3 +0,0 @@
community.patches.set_email_preferences
community.patches.change_name_for_community_members
community.patches.save_abbr_for_community_members

View File

@@ -1,8 +0,0 @@
{
"css/lms.css": [
"public/css/lms.css"
],
"css/community.css": [
"public/css/style.css"
]
}

View File

@@ -1,136 +0,0 @@
.livecode-editor-large .canvas-wrapper {
position: relative;
padding: 10px;
}
.livecode-editor-large canvas {
position: relative;
z-index: 0;
border: 1px solid #ddd;
height: 300px;
width: 300px;
}
.livecode-editor-large .code {
width: 100%;
padding: 5px;
min-height: 330px;
resize: none;
}
.livecode-editor-large .output {
padding: 5px;
}
.livecode-editor-large .CodeMirror {
height: 320px;
}
.canvas-editor canvas {
position: relative;
z-index: 0;
border: 1px solid #ddd;
}
.canvas-wrapper .output {
position: absolute;
z-index: 1;
width: 100%;
left: 0px;
top: 0px;
background-color: rgba(255, 255, 255, 0);
margin: 15px;
max-height: 200px;
}
.canvas-editor .code {
width: 100%;
padding: 5px;
/* min-height: 330px; */
resize: none;
}
/* .canvas-editor .output {
padding: 5px;
} */
.heading {
background: #eee;
padding: 10px;
clear: both;
color: #212529;
border: 1px solid #ddd;
}
.livecode-editor-large h2 {
font-size: 1.2em;
text-transform: uppercase;
margin: 0px;
font-weight: normal;
}
.livecode-editor-large .run {
float: right;
}
.livecode-editor-large .col-sm {
border: 1px solid #ddd;
}
.sketch-header h1 {
font-size: 1.5em;
margin-bottom: 0px;
}
.sketch-header {
margin-bottom: 1em;
}
.sketch-card .sketch-title a {
font-weight: bold;
color: inherit;
}
.canvas-editor .CodeMirror {
background: #ffe;
border: 1px solid #eed;
margin-bottom: 10px;
border-radius: 10px;
height: 100%;
}
canvas {
border: 2px solid #eee;
}
@media (min-width: 768px) {
.canvas-wrapper {
margin-bottom: -200px;
}
}
@media (max-width: 768px) {
.canvas-wrapper {
padding-top: 20px;
margin-left: 2em;
}
.canvas-wrapper .output {
left: 2em;
}
}
.hidden {
display: none;
}
.livecode-controls {
margin-left: 2em;
}
.livecode-controls a {
margin-left: 10px;
color: #666;
}
.canvas-editor {
margin: 10px 0px;
}

View File

@@ -1,359 +0,0 @@
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css");
@import url("https://use.fontawesome.com/releases/v5.13.0/css/all.css");
:root {
--c1: #fefae0;
--c2: #264653;
--c3: #e9c46a;
--c4: #2a9d8f;
--c5: #f4a261;
--c6: #e76f51;
--c7: #ccd5ae;
--c8: #EEEEEE;
--bg: var(--c1);
--header-bg: var(--c2);
--header-color: var(--c3);
--tag-color: var(--c7);
--sidebar-bg: var(--c7);
--h-color: var(--c2);
--text-color: #333;
--text-color-light: #ccc;
--cta-color: var(--c4);
--send-message: var(--c7);
--received-message: var(--c8);
--primary-color: #08B74F;
}
body {
padding: 0px;
margin: 0px;
background: white;
}
.course-header {
margin-top: 20px;
padding: 20px;
background: var(--header-bg);
color: var(--header-color);
border-radius: 10px;
}
.course-header h1 {
color: inherit;
}
.course-type {
text-transform: uppercase;
font-size: 1.0em;
color: var(--tag-color);
}
.sidebar {
background: var(--sidebar-bg);
margin: 20px 0px;
border-radius: 10px;
padding: 1px 20px 20px 20px;
color: var(--text-color);
}
.sidebar h3 {
margin-top: 20px;
color: var(--c2);
}
.sidebar-batch {
background: var(--sidebar-bg);
color: var(--text-color);
position: fixed;
left: 0;
height: 100%;
}
.sidebar-batch a {
padding: 16px 8px 8px 16px;
display: block;
}
.instructor {
padding: 10px;
}
.instructor-title {
font-weight: bold;
}
.instructor-subtitle {
font-size: 0.8em;
color: var(--text-color);
}
.sidebar .notice {
padding: 10px;
border-radius: 10px;
border: 1px dashed var(--text-color);
}
.sidebar .notice a {
color: inherit;
text-decoration: underline;
}
.course-details {
margin: 20px 0px;
}
.course-details h2 {
color: var(--h-color);
font-size: 1.4em;
font-weight: bold;
margin: 20px 0px 10px 0px;
}
.chapter-plan {
border-radius: 10px;
margin: 20px 0px;
padding: 20px;
border: 1px solid #ddc;
background: white;
}
.chapter-plan h3 {
font-size: 1.1em;
font-weight: bold;
}
.chapter-number {
background: var(--text-color);
color: white;
border-radius: 50%;
height: 24px;
min-width: 24px;
align-items: center;
padding: 2px 8px 2px 8px;
margin-right: 5px;
}
.chapter-description {
margin: 20px 0px;
}
.lessons {
padding-left: 20px;
}
.lesson {
margin: 5px 0px;
font-weight: bold;
}
.batch {
border-radius: 10px;
margin: 10px 0px;
background: white;
border: 1px solid #ddc;
}
.batch-details {
padding: 20px;
}
.batch .cta {
margin-top: 10px;
padding: 10px;
min-height: 28px;
text-align: right;
border-top: 1px solid #ddc;
}
.batch .cta button {
background: var(--cta-color);
color: white;
border: none;
border-radius: 5px;
padding: 5px 10px;
}
.batch .right {
float: right;
}
img.profile-photo {
width: 24px;
height: 24px;
border-radius: 50%;
}
.lesson-type {
padding-right: 5px;
}
.preview-video {
margin: 20px 0px;
}
.preview-video iframe {
max-width: 100%
}
/* override style of base */
.message {
border: 1px dashed var(--text-color);
padding: 20px;
border-radius: 10px;
}
.dashboard__profile {
width: 150px;
height: 155px;
border-radius: 50%;
}
.dashboard__profileSmall {
width: 59px;
height: 57px;
border-radius: 50%;
}
.dashboard__abbr {
font-size: 50px;
width: 155px;
height: 155px;
border-radius: 50%;
}
.dashboard__abbrSmall {
font-size: 20px;
width: 59px;
height: 57px;
border-radius: 50%;
}
.msger-inputarea {
position: fixed;
bottom: 0;
width: 100%;
display: flex;
padding: 10px;
border-top: 2px solid #ddd;
background: #eee;
z-index: 1;
}
.msger-inputarea * {
padding: 10px;
border: none;
border-radius: 3px;
font-size: 1em;
}
.msger-input {
flex: 1;
background: #ddd;
}
.msger-send-btn {
margin-left: 10px;
background: var(--cta-color);
color: #fff;
font-weight: bold;
cursor: pointer;
transition: background 0.23s;
}
.discussion {
border: 1px solid var(--text-color);
padding: 10px;
margin: 10px;
border-radius: 10px;
background: var(--received-message);
width: 50%;
display: flex;
flex-direction: column;
}
.is-author {
float: right;
background: var(--send-message);
}
.batch-header {
position: fixed;
top: 0;
background: var(--bg);
width: 100%;
}
.message-section {
margin-left: 5%;
display: inline-block;
}
.sketch-teaser {
background: white;
border-radius: 10px;
border: 1px solid #ddd;
width: 220px;
}
.sketch-teaser svg {
width: 200px;
height: 200px;
}
.sketch-image {
padding: 10px;
}
.sketch-footer {
padding: 10px;
background: #eee;
border-radius: 0px 0px 10px 10px;
}
.course-teaser {
background: white;
border-radius: 10px;
border: 1px solid #ddd;
color: #444;
}
.course-teaser h3, .course-teaser h4 {
color: black;
font-weight: bold;;
}
.course-teaser .course-body, .course-teaser .course-footer {
padding: 20px;
}
.course-body {
min-height: 8em;
}
.course-footer {
border-top: 1px solid #ddd;
}
.course-teaser a, .course-teaser a:hover {
color: inherit;
text-decoration: none;
}
section {
padding: 60px 0px;
}
section h2 {
margin-bottom: 40px;
}
section.lightgray {
background: #f8f8f8;
}
#hero .jumbotron {
background: inherit;
}

View File

@@ -1,46 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %}
{% block title %}About{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
{% endblock %}
{% block content %}
{{ Sidebar(course_slug, batch_code) }}
<div class="container">
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(instructor) }}
{% if batch.description %}
{{ BatchDetails(batch.description) }}
{% endif %}
{{ MentorsSection(mentors, True) }}
</div>
{% endblock %}
{% macro CourseBasicDetail(course) %}
<h2>{{course.name}}</h2>
<div class="course-description">
{{course.short_introduction}}
</div>
{% if course.video_link %}
<div class="preview-video">
<iframe width="560" height="315" src="{{course.video_link}}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
{% endif %}
<h2>About the Course</h2>
<div>{{frappe.utils.md_to_html(course.description)}}</div>
{% endmacro %}
{% macro BatchDetails(description) %}
<div class="mt-5">
<h3>About the Batch</h3>
<div>
{{ frappe.utils.md_to_html(description) }}
</div>
</div>
{% endmacro %}

View File

@@ -1,23 +0,0 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member, get_course, get_instructor, get_batch
def get_context(context):
context.no_cache = 1
context.course_slug = frappe.form_dict["course"]
context.course = get_course(context.course_slug)
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course_slug, context.batch_code)
context.instructor = get_instructor(context.course.owner)
context.batch = get_batch(context.batch_code)
context.mentors = get_mentors(context.batch.name)
print(context.mentors)
def get_mentors(batch):
mentors = []
memberships = frappe.get_all("LMS Batch Membership", {"batch": batch, "member_type": "Mentor"}, ["member"])
for membership in memberships:
member = frappe.db.get_value("Community Member", membership.member, ["name","full_name"], as_dict=True)
member.batch_count = len(frappe.get_all("LMS Batch Membership", {"member": member.name, "member_type": "Mentor"}))
mentors.append(member)
return mentors

View File

@@ -1,155 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %}
{% block title %}{{ course.title }}{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="Courses {{course.title}}" />
{% endblock %}
{% block content %}
<div class="container">
<div class="course-header">
<div class="course-type">course</div>
<h1>{{course.title}}</h1>
</div>
<div class="row">
<div class="col-lg-9 col-md-12">
<div class="course-details">
{{ CourseDescription(course) }}
{{ BatchSection(course, is_mentor, upcoming_batches, mentor_batches) }}
{{ CourseOutline(course) }}
</div>
</div>
<div class="col-lg-3 col-md-12">
<div class="sidebar">
{{ InstructorsSection(instructor) }}
</div>
<div class="sidebar">
{{ MentorsSection(mentors, is_mentor) }}
</div>
</div>
</div>
</div>
{% endblock %}
{% macro CourseDescription(course) %}
<h2>Course Description</h2>
<div class="course-description">
{{ course.short_introduction }}
</div>
{% if course.video_link %}
<div class="preview-video">
<iframe
width="560"
height="315"
src="{{course.video_link}}"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
{% endif %}
{% endmacro %}
{% macro BatchSection(course, is_mentor, upcoming_batches, mentor_batches) %}
{% if is_mentor %}
{{ BatchSectionForMentors(course, mentor_batches) }}
{% else %}
{{ BatchSectionForStudents(course, upcoming_batches) }}
{% endif %}
{% endmacro %}
{% macro RenderBatch(batch, can_manage=False) %}
<div class="batch">
<div class="batch-details">
<div>Session every {{batch.sessions_on}}</div>
<div>{{frappe.utils.format_time(batch.start_time, "short")}} -
{{frappe.utils.format_time(batch.end_time, "short")}}</div>
<div>Starting {{frappe.utils.format_date(batch.start_date, "medium")}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
{% for m in batch.mentors %}
<div>
{% if m.photo_url %}
<img class="profile-photo" src="{{m.photo_url}}">
{% endif %}
<span class="instructor-title">{{m.full_name}}</span>
</div>
{% endfor %}
</div>
<div class="cta">
<div class="">
{% if can_manage %}
<button type="button">Manage</button>
{% else %}
<button type="button">Join this Batch</button>
{% endif %}
</div>
</div>
</div>
{% endmacro %}
{% macro BatchSectionForMentors(course, mentor_batches) %}
<h2>Your Batches</h2>
{% if mentor_batches %}
<div class="message">
You are a mentor for this course. Manage your batches or create a new batch from here.
</div>
<div class="row">
{% for batch in mentor_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(batch, can_manage=True) }}
</div>
{% endfor %}
</div>
<a class="btn btn-primary add-batch margin-bottom" href="/add-a-new-batch?new=1&course={{course.name}}">Add a new batch</a>
{% else %}
<div class="mentor_message">
<p> You are a mentor for this course. </p>
<a class="btn btn-primary" href="/add-a-new-batch?new=1&course={{course.name}}" >Create your first batch</a>
</div>
{% endif %}
{% endmacro %}
{% macro BatchSectionForStudents(course, upcoming_batches) %}
<h2>Upcoming Batches</h2>
{% for batch in upcoming_batches %}
<div class="col-lg-4 col-md-6">
{{ RenderBatch(batch, can_manage=False) }}
</div>
{% endfor %}
{% endmacro %}
{% macro CourseOutline(course) %}
<h2>Course Outline</h2>
{% for chapter in course.topics %}
<div class="chapter-plan">
<h3><span class="chapter-number">{{loop.index}}</span> {{chapter.title}}</h3>
<div class="chapter-description">
{{chapter.preview | markdown}}
</div>
{#
<div class="lessons">
{% for lesson in chapter.lessons %}
<div class="lesson">
<span class="lesson-type"><i class="{{lesson.icon}}"></i></span>
<span class="lesson-title">{{lesson.title}}</span>
</div>
{% endfor %}
</div>
#}
</div>
{% endfor %}
{% endmacro %}

View File

@@ -1,71 +0,0 @@
frappe.ready(() => {
if (frappe.session.user != "Guest") {
frappe.call({
'method': 'community.lms.doctype.lms_mentor_request.lms_mentor_request.has_requested',
'args': {
course: decodeURIComponent($(".course-title").attr("data-course")),
},
'callback': (data) => {
if (data.message) {
$(".mentor-request").addClass("hide");
$(".already-applied").removeClass("hide")
}
}
})
}
$(".apply-now").click((e) => {
if (frappe.session.user == "Guest") {
window.location.href = "/login";
return;
}
frappe.call({
"method": "community.lms.doctype.lms_mentor_request.lms_mentor_request.create_request",
"args": {
"course": decodeURIComponent($(e.currentTarget).attr("data-course"))
},
"callback": (data) => {
if (data.message == "OK") {
$(".mentor-request").addClass("hide");
$(".already-applied").removeClass("hide")
}
}
})
})
$(".cancel-request").click((e) => {
frappe.call({
"method": "community.lms.doctype.lms_mentor_request.lms_mentor_request.cancel_request",
"args": {
"course": decodeURIComponent($(e.currentTarget).attr("data-course"))
},
"callback": (data) => {
if (data.message == "OK") {
$(".mentor-request").removeClass("hide");
$(".already-applied").addClass("hide")
}
}
})
})
$(".join-batch").click((e) => {
if (frappe.session.user == "Guest") {
window.location.href = "/login";
return;
}
batch = decodeURIComponent($(e.currentTarget).attr("data-batch"))
frappe.call({
"method": "community.lms.doctype.lms_batch_membership.lms_batch_membership.create_membership",
"args": {
"batch": batch
},
"callback": (data) => {
if (data.message == "OK") {
frappe.msgprint(__("You are now a student of this course."))
$(".upcoming-batches").addClass("hide")
}
}
})
})
})

View File

@@ -1,101 +0,0 @@
import frappe
from community.www.courses.utils import get_instructor
from frappe.utils import nowdate, getdate
def get_context(context):
context.no_cache = 1
try:
course_id = frappe.form_dict["course"]
except KeyError:
frappe.local.flags.redirect_location = "/courses"
raise frappe.Redirect
context.course = get_course(course_id)
context.batches = get_course_batches(context.course.name)
context.is_mentor = is_mentor(context.course.name)
context.memberships = get_membership(context.batches)
if len(context.memberships) and not context.is_mentor:
frappe.local.flags.redirect_location = "/courses/" + course_id + "/" + context.memberships[0].code + "/learn"
raise frappe.Redirect
context.upcoming_batches = get_upcoming_batches(context.course.name)
context.instructor = get_instructor(context.course.owner)
context.mentors = get_mentors(context.course.name)
if context.is_mentor:
context.mentor_batches = get_mentor_batches(context.memberships) # Your Bacthes for mentor
def get_course(slug):
course = frappe.db.get_value("LMS Course", {"slug": slug},
["name", "slug", "title", "description", "short_introduction", "video_link", "owner"], as_dict=1)
course["topics"] = frappe.db.get_all("LMS Topic",
filters={
"course": course["name"]
},
fields=["name", "slug", "title", "preview"],
order_by="creation"
)
return course
def get_upcoming_batches(course):
batches = frappe.get_all("LMS Batch", {"course": course, "start_date": [">", nowdate()]}, ["start_date", "start_time", "end_time", "sessions_on", "name"])
batches = get_batch_mentors(batches)
return batches
def get_batch_mentors(batches):
for batch in batches:
batch.mentors = []
mentors = frappe.get_all("LMS Batch Membership", {"batch": batch.name, "member_type": "Mentor"}, ["member"])
for mentor in mentors:
member = frappe.db.get_value("Community Member", mentor.member, ["full_name", "photo", "abbr"], as_dict=1)
batch.mentors.append(member)
return batches
def get_membership(batches):
memberships = []
member = frappe.db.get_value("Community Member", {"email": frappe.session.user}, "name")
for batch in batches:
membership = frappe.db.get_value("LMS Batch Membership", {"member": member, "batch": batch.name}, ["batch", "member", "member_type"], as_dict=1)
if membership:
membership.code = batch.code
memberships.append(membership)
return memberships
def get_mentors(course):
course_mentors = []
mentors = frappe.get_all("LMS Course Mentor Mapping", {"course": course}, ["mentor"])
for mentor in mentors:
member = frappe.get_doc("Community Member", mentor.mentor)
member.batch_count = len(frappe.get_all("LMS Batch Membership", {"member": member.name, "member_type": "Mentor"}))
course_mentors.append(member)
return course_mentors
def get_course_batches(course):
return frappe.get_all("LMS Batch", {"course": course}, ["name", "code"])
def get_mentor_batches(memberships):
mentor_batches = []
memberships_as_mentor = list(filter(lambda x: x.member_type == "Mentor", memberships))
for membership in memberships_as_mentor:
batch = frappe.get_doc("LMS Batch", membership.batch)
mentor_batches.append(batch)
for batch in mentor_batches:
if getdate(batch.start_date) < getdate():
batch.status = "active"
batch.badge_class = "green_badge"
else:
batch.status = "scheduled"
batch.badge_class = "yellow_badge"
mentor_batches = get_batch_mentors(mentor_batches)
return mentor_batches
def is_mentor(course):
try:
member = frappe.db.get_value("Community Member", {"email": frappe.session.user}, ["name"])
except frappe.DoesNotExistError:
return False
mapping = frappe.get_all("LMS Course Mentor Mapping", {"course": course, "mentor": member})
if len(mapping):
return True

View File

@@ -1,47 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/common_macro.html" import BatchHearder %}
{% block title %}Discuss{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
{% endblock %}
{% block content %}
{{ Sidebar(course_slug, batch_code) }}
<div class="">
<div class="batch-header">
{{ BatchHearder(course.name, member_count) }}
</div>
<div class="message-section">
{{ Messages(messages) }}
</div>
{{ TextArea() }}
</div>
{% endblock %}
{% macro Messages(messages) %}
{% for message in messages %}
<div class="discussion {% if message.is_author %} is-author {% endif %}">
<div class="d-flex justify-content-between">
<div class="font-weight-bold">
{{ message.author_name }}
</div>
<div class="text-muted">
{{ frappe.utils.pretty_date(message.creation) }}
</div>
</div>
<div class="mt-5">
{{ message.message }}
</div>
</div>
{% endfor %}
{% endmacro %}
{% macro TextArea() %}
<form class="msger-inputarea">
<input type="text" class="msger-input" placeholder="Write your message...">
<button type="submit" class="msger-send-btn" data-batch="{{batch.name | urlencode }}">Send</button>
</form>
{% endmacro %}

View File

@@ -1,33 +0,0 @@
frappe.ready(() => {
const assets = [
"/assets/frappe/js/lib/socket.io.min.js",
"/assets/frappe/js/frappe/socketio_client.js",
]
frappe.require(assets, () => {
if (window.dev_server) {
frappe.boot.socketio_port = "9000" //use socketio port shown when bench starts
}
frappe.socketio.init(9000);
})
setTimeout(() => {
window.scrollTo(0, document.body.scrollHeight);
}, 300);
$(".msger-send-btn").click((e) => {
e.preventDefault();
var message = $(".msger-input").val().trim();
if (message) {
frappe.call({
"method": "community.lms.doctype.lms_batch.lms_batch.save_message",
"args": {
"batch": decodeURIComponent($(e.target).attr("data-batch")),
"message": message
}
})
}
else {
$(".msger-input").val("");
}
})
})

View File

@@ -1,15 +0,0 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member, get_course, get_batch_members, get_batch
from community.lms.doctype.lms_batch.lms_batch import get_messages
def get_context(context):
context.no_cache = 1
context.course_slug = frappe.form_dict["course"]
context.course = get_course(context.course_slug)
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course_slug, context.batch_code)
context.batch = get_batch(context.batch_code)
context.members = get_batch_members(context.batch.name)
context.member_count = len(context.members)
context.messages = get_messages(context.batch.name)

View File

@@ -1,36 +0,0 @@
{% extends "templates/base.html" %}
{% block title %}{{ 'Courses' }}{% endblock %}
{% block head_include %}
<meta name="description" content="{{ 'Courses' }}" />
<meta name="keywords" content="Courses" />
<style>
</style>
{% endblock %}
{% block content %}
<section class="top-section" style="padding: 1rem 0rem;">
<div class='container pb-5'>
<h1>{{ 'Courses' }}</h1>
</div>
<div class='container'>
<div class="row mt-5">
{% for course in courses %}
{{ course_card(course) }}
{% endfor %}
</div>
</div>
</section>
{% endblock %}
{% macro course_card(course) %}
<div class="card mb-5 w-100">
<div class="card-body">
<h5 class="card-title"><a href="/courses/{{course.slug}}">{{course.title}}</a></h5>
{% if course.description %}
<p class="card-text">{{ frappe.utils.md_to_html(course.description[:250]) }}</p>
{% endif %}
<a href="/courses/{{course.slug}}" class="card-link">See more &rarr;</a>
</div>
</div>
{% endmacro %}

View File

@@ -1,12 +0,0 @@
import frappe
def get_context(context):
context.no_cache = 1
context.courses = get_courses()
def get_courses():
courses = frappe.get_all(
"LMS Course",
fields=['name', 'slug', 'title', 'description']
)
return courses

View File

@@ -1,13 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% block title %}Learn{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
{% endblock %}
{% block content %}
{{ Sidebar(course, batch_code) }}
<div class="container">
</div>
{% endblock %}

View File

@@ -1,3 +0,0 @@
frappe.ready(() => {
})

View File

@@ -1,10 +0,0 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member
def get_context(context):
context.no_cache = 1
context.course = frappe.form_dict["course"]
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course, context.batch_code)
print(context)

View File

@@ -1,38 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% from "www/macros/profile.html" import Profile %}
{% from "www/macros/common_macro.html" import BatchHearder %}
{% block title %}Members{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
{% endblock %}
{% block content %}
{{ Sidebar(course_slug, batch_code) }}
<div class="container">
{{ BatchHearder(course.name, member_count)}}
{{ MembersList(members)}}
</div>
{% endblock %}
{% macro MembersList(members) %}
<div class="mt-5">
{% for member in members %}
<div class="d-flex align-items-center">
<div>
{{ Profile(member.photo, member.full_name, member.abbr, "small") }}
</div>
<div class="mr-5">
{{member.full_name}}
</div>
{% if member.is_mentor %}
<div class="badge badge-success">Mentor</div>
{% endif %}
</div>
<hr>
{% endfor %}
</div>
{% endmacro %}

View File

@@ -1,12 +0,0 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member, get_batch, get_member_with_name, get_course, get_batch_members
def get_context(context):
context.no_cache = 1
context.course_slug = frappe.form_dict["course"]
context.course = get_course(context.course_slug)
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course_slug, context.batch_code)
context.batch = get_batch(context.batch_code)
context.members = get_batch_members(context.batch.name)
context.member_count = len(context.members)

View File

@@ -1,13 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/sidebar.html" import Sidebar %}
{% block title %}Schedule{% endblock %}
{% block head_include %}
<meta name="description" content="Courses" />
<meta name="keywords" content="" />
{% endblock %}
{% block content %}
{{ Sidebar(course, batch_code) }}
<div class="container">
</div>
{% endblock %}

View File

@@ -1,8 +0,0 @@
import frappe
from community.www.courses.utils import redirect_if_not_a_member
def get_context(context):
context.no_cache = 1
context.course = frappe.form_dict["course"]
context.batch_code = frappe.form_dict["batch"]
redirect_if_not_a_member(context.course, context.batch_code)

View File

@@ -1,108 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/livecode.html" import LiveCodeEditor with context %}
{% block title %}{{topic.title}} ({{course.title}}){% endblock %}
{% block head_include %}
<meta name="description" content="Topic {{topic.title}} of the course {{course.title}}" />
<meta name="keywords" content="course {{course.title}} {{topic.title}}" />
<style>
</style>
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/assets/css/lms.css">
<script src="{{ livecode_url }}/static/codemirror/lib/codemirror.js"></script>
<script src="{{ livecode_url }}/static/codemirror/mode/python/python.js"></script>
<script src="{{ livecode_url }}/static/codemirror/keymap/sublime.js"></script>
<script src="{{ livecode_url }}/static/codemirror/addon/edit/matchbrackets.js"></script>
<script src="{{ livecode_url }}/static/codemirror/addon/comment/comment.js"></script>
{% endblock %}
{% block content %}
<section class="top-section" style="padding: 1rem 0rem;">
<div class='container pb-5'>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item" aria-current="page"><a href="/courses">Courses</a></li>
<li class="breadcrumb-item" aria-current="page"><a href="/courses/{{course.slug}}">{{course.title}}</a></li>
</ol>
</nav>
<h1>{{ topic.title }}</h1>
{% for s in topic.get_sections() %}
<div class="section section-{{ s.type }}">
{{ render_section(s) }}
</div>
{% endfor %}
</div>
</section>
{% endblock %}
{% macro render_section(s) %}
{% if s.type == "text" %}
{{ render_section_text(s) }}
{% elif s.type == "example" or s.type == "code" %}
{{ LiveCodeEditor(s.name, s.get_latest_code_for_user()) }}
{% else %}
<div>Unknown section type: {{s.type}}</div>
{% endif %}
{% endmacro %}
{% macro render_section_text(s) %}
<div class="row">
<div class="col-md-9">
{{ frappe.utils.md_to_html(s.contents) }}
</div>
</div>
{% endmacro %}
{%- block script %}
{{ super() }}
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
<script type="text/javascript">
$(function() {
var editorLookup = {};
$(".canvas-editor").each((i, e) => {
var data = $(e).data();
var editor = new LiveCodeEditor(e, {
runtime: "python-canvas",
base_url: "{{ livecode_url }}",
codemirror: true,
userdata: data,
autosave: function(editor, code) {
// can't autosave when user is Guest
if (frappe.session.user == "Guest") {
return;
}
var data = editor.options.userdata;
var code = editor.codemirror.doc.getValue();
// console.log("autosaving...")
frappe.call("community.lms.api.autosave_section", {
section: data.section,
code: code
}).then((r) => {
// TODO: verify
})
}
})
editorLookup[data.section] = editor;
})
$(".canvas-editor .reset").each((i, e) => {
$(e).on("click", function(event) {
var data = $(this).parents(".canvas-editor").data();
var section = data.section;
frappe.call("community.lms.api.get_section", {
name: section
}).then(r => {
var editor = editorLookup[data.section];
editor.codemirror.doc.setValue(r.message.contents);
})
})
})
})
</script>
{%- endblock %}

View File

@@ -1,33 +0,0 @@
import frappe
def get_context(context):
context.no_cache = 1
try:
course_slug = frappe.form_dict['course']
topic_slug = frappe.form_dict['topic']
except KeyError:
context.template = 'www/404.html'
return
course = get_course(course_slug)
topic = course and course.get_topic(topic_slug)
if not topic:
context.template = 'www/404.html'
return
context.course = course
context.topic = topic
context.livecode_url = get_livecode_url()
def notfound(context):
context.template = 'www/404.html'
def get_livecode_url():
doc = frappe.get_doc("LMS Settings")
return doc.livecode_url
def get_course(slug):
course = frappe.db.get_value('LMS Course', {"slug": slug}, ["name"], as_dict=1)
return course and frappe.get_doc('LMS Course', course['name'])

View File

@@ -1,57 +0,0 @@
import frappe
def get_member_with_email():
try:
return frappe.db.get_value("Community Member", {"email": frappe.session.user}, "name")
except frappe.DoesNotExistError:
return
def get_member_with_name(name):
try:
return frappe.get_doc("Community Member", name)
except frappe.DoesNotExistError:
return
def get_batch(code):
try:
return frappe.db.get_value("LMS Batch", {"code": code}, ["name", "description"], as_dict=True)
except frappe.DoesNotExistError:
return
def is_member_of_batch(batch_code):
membership = frappe.get_all("LMS Batch Membership", {"batch": get_batch(batch_code).name, "member": get_member_with_email()})
if len(membership):
return True
return False
def redirect_if_not_a_member(course,batch_code):
if not is_member_of_batch(batch_code):
frappe.local.flags.redirect_location = "/courses/" + course
raise frappe.Redirect
def get_course(slug):
try:
return frappe.get_doc("LMS Course", {"slug": slug})
except frappe.DoesNotExistError:
return
def get_instructor(owner):
instructor = frappe._dict()
try:
instructor = frappe.get_doc("Community Member", {"email": owner})
except frappe.DoesNotExistError:
instructor.full_name = owner
instructor.abbr = ("").join([ s[0] for s in owner.split() ])
instructor.course_count = len(frappe.get_all("LMS Course", {"owner": owner}))
return instructor
def get_batch_members(batch):
members = []
memberships = frappe.get_all("LMS Batch Membership", {"batch": batch}, ["member", "member_type"])
for membership in memberships:
member = get_member_with_name(membership.member)
if membership.member_type == "Mentor":
member.is_mentor = True
members.append(member)
return members

View File

@@ -1,212 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/profile.html" import Profile %}
{% block title %}{{ _("Community") }}{% endblock %}
{% block head_include %}
<meta name="description" content="{{ 'Community' }}" />
<meta name="keywords" content="An app that supports Communities." />
<style>
section {
padding: 2rem;
color: #000000;
}
svg {
width: 200px;
height: 200px;
}
.dashboard__profile {
width: 150px;
height: 155px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__profileSmall {
width: 59px;
height: 57px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__abbr {
font-size: 50px;
width: 155px;
height: 155px;
border-radius: 50%;
}
.dashboard__abbrSmall {
font-size: 20px;
width: 59px;
height: 57px;
border-radius: 50%;
}
.dashboard__parent {
display: flex;
}
.dashboard__name {
font-weight: normal;
font-style: normal;
font-size: 36px;
line-height: 42px;
}
.dashboard__details {
padding-top: 2rem;
width: 80%;
}
.dashboard__course {
border: 1px solid black;
padding: 1rem;
margin: 0.5rem;
width: 48%;
}
.dashboard__courseHeader {
display: flex;
justify-content: space-between;
height: 50px;
margin-bottom: 3px;
}
.dashboard__badge {
background: #D6D6FF;
border-radius: 20px;
color: #1712FE;
padding: 0.5rem;
height: fit-content;
}
.dashboard__description {
height: 100px;
}
</style>
{% endblock %}
{% block content %}
<section>
<div class="dashboard__parent">
<div>
{{ Profile(member.photo, member.full_name, member.abbr, "large")}}
</div>
<div class="dashboard__details">
<div class="dashboard__name">
{{member.full_name}}
</div>
<div>
<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
aria-controls="home" aria-selected="true">Activity</a>
</li>
<li class="nav-item">
<a class="nav-link" id="sketches-tab" data-toggle="tab" href="#sketches" role="tab"
aria-controls="sketches" aria-selected="false">Sketches</a>
</li>
<li class="nav-item">
<a class="nav-link" id="courses-tab" data-toggle="tab" href="#courses" role="tab"
aria-controls="courses" aria-selected="false">Courses</a>
</li>
</ul>
</div>
<div>
<div class="tab-content">
<div class="tab-pane fade py-4 show active" role="tabpanel" id="home">
<div class='container'>
{% if activity %}
{% for message in activity %}
<div class="dashboard__message border m-5 p-3">
<div class="text-muted float-right">
{{ message.course }} ({{message.batch}})
</div>
<div class="d-flex align-items-center w-100">
<div>
{{ Profile(message.profile, message.full_name, message.abbr, "small")}}
</div>
<div class="ml-5 mt-5">{{ frappe.utils.md_to_html(message.message) }}</div>
</div>
<div class="d-flex justify-content-between">
<div class="">
{{message.full_name}}
</div>
<div class="text-muted">
{{ frappe.utils.pretty_date(message.creation) }}
</div>
</div>
</div>
{% endfor %}
{% else %}
<p class="text-center">You have not received any messages yet.</p>
{% endif %}
</div>
</div>
<div class="tab-pane fade py-4" role="tabpanel" id="sketches">
<div class="container">
<a href="/sketches/new">Create a New Sketch</a>
<div class="row row-cols-1 row-cols-xl-5 row-cols-lg-4 row-cols-md-3 row-cols-sm-2">
{% if sketches %}
{% for sketch in sketches %}
<div class="col mb-4">
<div class="card sketch-card" style="width: 200px;">
<div class="card-img-top">
<a href="/sketches/{{sketch.sketch_id}}">
{{ sketch.to_svg() }}
</a>
</div>
<div class="card-footer">
<div class="sketch-title">
<a href="sketches/{{sketch.sketch_id}}">{{sketch.title}}</a>
</div>
<div class="sketch-author">
by {{sketch.get_owner_name()}}
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% if not sketches %}
<p class="text-center">You have not created any sketches.</p>
{% endif %}
</div>
</div>
<div class="tab-pane fade py-4" role="tabpanel" id="courses">
{% if courses %}
<p class="ml-3">Your Courses</p>
<div class="d-flex flex-wrap">
{% for course in courses %}
<div class="dashboard__course">
<div class="dashboard__courseHeader">
<a class="text-decoration-none" target="_blank" href="/courses/{{course.slug}}">
<h5 class="w-75">{{ course.name }}</h5>
</a>
{% if course.member_type %}
<div class="dashboard__badge">
{{ course.member_type }}
</div>
{% endif %}
</div>
<div class="dashboard__description">
{{ frappe.utils.md_to_html(course.description) }}
</div>
<div class="text-muted"> Joined {{ frappe.utils.pretty_date(course.joining) }} </div>
</div>
{% endfor %}
{% else %}
<p class="text-center">You are not a member of any course yet. Checkout our <a
href="/courses" target="_blank">Courses</a>.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}

View File

@@ -1,38 +0,0 @@
import frappe
from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches
def get_context(context):
context.no_cache = 1
context.member = frappe.get_all("Community Member", {"email": frappe.session.user}, ["name", "email", "photo", "full_name", "abbr"])[0]
context.memberships = get_memberships(context.member.name)
context.courses = get_courses(context.memberships)
context.activity = get_activity(context.memberships)
context.sketches = list(filter(lambda x: x.owner == frappe.session.user, get_recent_sketches()))
def get_memberships(member):
return frappe.get_all("LMS Batch Membership", {"member": member}, ["batch", "member_type", "creation"])
def get_courses(memberships):
courses = []
for membership in memberships:
course = frappe.db.get_value("LMS Batch", membership.batch, "course")
course_details = frappe.get_doc("LMS Course", course)
course_in_list = list(filter(lambda x: x.name == course_details.name, courses))
if not len(course_in_list):
course_details.description = course_details.description[0:100] + "..."
course_details.joining = membership.creation
if membership.member_type != "Student":
course_details.member_type = membership.member_type
courses.append(course_details)
return courses
def get_activity(memberships):
messages, courses = [], {}
batches = [x.batch for x in memberships]
for batch in batches:
courses[batch] = frappe.db.get_value("LMS Batch", batch, "course")
messages = frappe.get_all("LMS Message", {"batch": ["in", ",".join(batches)]}, ["message", "author", "creation", "batch"], order_by='creation desc')
for message in messages:
message.course = courses[message.batch]
message.profile, message.full_name, message.abbr = frappe.db.get_value("Community Member", message.author, ["photo", "full_name", "abbr"])
return messages

View File

@@ -1,51 +0,0 @@
{% extends "templates/base.html" %}
{% block content %}
{{ HeroSection() }}
{{ ExploreCourses(courses) }}
{{ RecentSketches(recent_sketches) }}
{% endblock %}
{% macro HeroSection() %}
<section id="hero">
<div class="container">
<div class="jumbotron">
<h1 class="display-4">Guided online courses, with a mentor at your back.</h1>
<p class="lead">Hands-on online courses designed by experts, delivered by passionate mentors.</p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="#" role="button">Request Invite</a>
</p>
</div>
</div>
</section>
{% endmacro %}
{% macro ExploreCourses(courses) %}
<section id="explore-courses" class="lightgray">
<div class="container lightgray">
<h2>Explore Courses</h2>
<div class="row">
{% for course in courses %}
<div class="col-md-6">
{{ widgets.CourseTeaser(course=course) }}
</div>
{% endfor %}
</div>
</div>
</section>
{% endmacro %}
{% macro RecentSketches(sketches) %}
<section id="recet-sketches">
<div class="container">
<h2>Recent Sketches</h2>
<div class="row">
{% for sketch in sketches %}
<div class="col-md-3">
{{ widgets.SketchTeaser(sketch=sketch) }}
</div>
{% endfor %}
</div>
</div>
</section>
{% endmacro %}

View File

@@ -1,7 +0,0 @@
import frappe
from community.lms.models import Course, Sketch
def get_context(context):
context.no_cache = 1
context.courses = Course.find_all()
context.recent_sketches = Sketch.get_recent_sketches(limit=8)

View File

@@ -1,32 +0,0 @@
{% macro InstructorsSection(instructor) %}
<h3>Instructor</h3>
<div class="instructor">
<div class="instructor-title">{{instructor.full_name}}</div>
<div class="instructor-subtitle">Created {{instructor.course_count}} courses</div>
</div>
{% endmacro %}
{% macro MentorsSection(mentors, is_mentor) %}
<h3>Mentors</h3>
{% for m in mentors %}
<div class="instructor">
<div class="instructor-title">{{m.full_name}}</div>
<div class="instructor-subtitle">Mentored {{m.batch_count}} batches</div>
</div>
{% endfor %}
{% if not is_mentor %}
<div class="notice">
Interested to become a mentor?
<div><a href="#">Apply Now!</a></div>
</div>
{% endif %}
{% endmacro %}
{% macro BatchHearder(course_name, member_count) %}
<div class="border p-3">
<h3>{{course_name}}</h3>
<div class="text-muted">{{member_count}} members</div>
</div>
{% endmacro %}

View File

@@ -1,66 +0,0 @@
{% macro LiveCodeEditorLarge(name, code) %}
<div class="livecode-editor livecode-editor-large row no-gutters" id="editor-{{name}}">
<div class="col-sm">
<div class="heading">
<button class="run">Run</button>
<h2>Editor</h2>
</div>
<textarea class="code">{{code}}</textarea>
</div>
<div class="col-sm">
<div class="heading">
<h2>Output</h2>
</div>
<div class="canvas-wrapper">
<canvas class="canvas" width="300" height="300"></canvas>
<pre class="output"></pre>
</div>
</div>
</div>
{% endmacro %}
{% macro LiveCodeEditor(name, code) %}
<div class="livecode-editor canvas-editor" id="editor-{{name}}"
data-section="{{name}}">
<div class="row">
<div class="col-md-9">
<div>
<textarea class="code">{{code}}</textarea>
<div class="livecode-controls">
<button type="button" class="run">Run</button>
<a href="javascript:;" class="reset">Reset</a>
<a href="javascript:;" class="clear">Clear</a>
</div>
</div>
</div>
<div class="col-md-3">
<div class="canvas-wrapper">
<canvas class="canvas" width="150" height="150"></canvas>
<pre class="output"></pre>
</div>
</div>
</div>
</div>
{% endmacro %}
{% macro LiveCodeEditorJS(name, code) %}
<script type="text/javascript" src="{{ livecode_url }}/static/livecode.js"></script>
<script type="text/javascript">
var livecodeEditors = [];
$(function() {
$(".livecode-editor").each((i, e) => {
var editor = new LiveCodeEditor(e, {
runtime: "python-canvas",
base_url: "{{ livecode_url }}",
codemirror: true
})
livecodeEditors.push(editor);
})
})
</script>
{% endmacro %}

View File

@@ -1,10 +0,0 @@
{% macro Profile(photo, full_name, abbr, icon) %}
{% if photo %}
<img class="avatar rounded-circle img-fluid mr-5{% if icon == 'large' %} dashboard__profile {% else %} dashboard__profileSmall {% endif %}"
src="{{ photo }}" alt="{{ full_name }}">
{% else %}
<div class="standard-image mr-5 {% if icon == 'large' %} dashboard__abbr {% else %} dashboard__abbrSmall {% endif %}">
{{ abbr }}
</div>
{% endif %}
{% endmacro %}

View File

@@ -1,12 +0,0 @@
{% macro Sidebar(course, batch_code) %}
<div class="sidebar-batch">
<a href=""><i class="fas fa-bars fa-lg"></i></a>
<br>
<a href="/courses/{{course}}/{{batch_code}}/learn"><i class="fas fa-book fa-lg"></i></a>
<a href="/courses/{{course}}/{{batch_code}}/schedule"><i class="fas fa-calendar-alt fa-lg"></i></a>
<a href="/courses/{{course}}/{{batch_code}}/members"><i class="fas fa-users fa-lg"></i></a>
<a href="/courses/{{course}}/{{batch_code}}/discuss"><i class="fas fa-comments fa-lg"></i></a>
<a href="/courses/{{course}}/{{batch_code}}/about"><i class="fas fa-info-circle fa-lg"></i></a>
<!-- <a href="#contact"><i class="fas fa-home fa-lg"></i></a> -->
</div>
{% endmacro %}

View File

@@ -1,82 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/hackathons/macros/card.html" import null_card %}
{% block title %}{{ 'My Courses' }}{% endblock %}
{% block head_include %}
<meta name="description" content="My Courses" />
<meta name="keywords" content="" />
<style>
div.card-hero-img {
height: 220px;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-color: rgb(250, 251, 252);
}
.card-image-wrapper {
display: flex;
overflow: hidden;
height: 220px;
background-color: rgb(250, 251, 252);
justify-content: center;
}
.image-body {
align-self: center;
color: #d1d8dd;
font-size: 24px;
font-weight: 600;
line-height: 1;
padding: 20px;
}
.no-courses {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
section {
padding: 5rem 0 5rem 0;
}
</style>
{% endblock %}
{% macro card(course) %}
<div class="col-sm-4 mb-4 text-left">
<a href="//courses/course?course={{course.name}}" class="no-decoration no-underline">
<div class="card h-100">
<div class='card-body'>
<h5 class='card-title'>{{ course.title }}</h5>
</div>
</div>
</a>
</div>
{% endmacro %}
{% block content %}
<section class="section">
<div class='container'>
{% if frappe.session.user != "Guest" %}
{% for course in my_courses %}
{{ card(course) }}
{% endfor %}
{% if my_courses %}
{% for n in range( (3 - (my_courses|length)) %3) %}
{{ null_card() }}
{% endfor %}
{% else %}
<div class="no-courses">You haven't enrolled in any Course yet. <a href="/courses">Check out the availabe
courses.</a></div>
{% endif %}
{% else %}
<div class="no-courses">
<p>Please sign up to access this page.</p>
<a id="signup" class="btn btn-primary btn-lg" href="/login#signup">{{_('Sign Up')}}</a>
</div>
{% endif %}
</div>
</section>
{% endblock %}

View File

@@ -1,15 +0,0 @@
import frappe
def get_context(context):
context.no_cache = 1
context.my_courses = get_my_courses()
def get_my_courses():
my_courses = []
courses = frappe.get_all("LMS Course Enrollment", {"owner": frappe.session.user}, ["course"])
for course in courses:
my_courses.append({
"name": course.course,
"title": frappe.db.get_value("LMS Course", course.course, ["title"])
})
return my_courses

View File

@@ -1,145 +0,0 @@
{% extends "templates/web.html" %}
{% from "www/macros/profile.html" import Profile %}
{% block head_include %}
<meta name="description" content="{{ 'Community' }}" />
<meta name="keywords" content="An app that supports Communities." />
<style>
section {
padding: 2rem;
color: #000000;
}
svg {
width: 200px;
height: 200px;
}
.dashboard__profile {
width: 150px;
height: 155px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__profileSmall {
width: 59px;
height: 57px;
border-radius: 50%;
object-fit: contain;
}
.dashboard__abbr {
font-size: 50px;
width: 155px;
height: 155px;
border-radius: 50%;
}
.dashboard__abbrSmall {
font-size: 20px;
width: 59px;
height: 57px;
border-radius: 50%;
}
.dashboard__parent {
display: flex;
}
.dashboard__name {
font-weight: normal;
font-style: normal;
font-size: 36px;
line-height: 42px;
}
.dashboard__details {
padding-top: 2rem;
width: 80%;
}
.dashboard__course {
border: 1px solid black;
padding: 1rem;
margin: 0.5rem;
width: 48%;
}
.dashboard__courseHeader {
display: flex;
justify-content: space-between;
height: 50px;
margin-bottom: 3px;
}
.dashboard__badge {
background: #D6D6FF;
border-radius: 20px;
color: #1712FE;
padding: 0.5rem;
height: fit-content;
}
.dashboard__description {
height: 100px;
}
</style>
{% endblock %}
{% block page_content %}
<section>
<div class="dashboard__parent">
<div>
{{ Profile(member.photo, member.full_name, member.abbr, "large")}}
</div>
<div class="dashboard__details">
<div class="dashboard__name">
{{member.full_name}}
</div>
<div>
<ul class="nav nav-tabs mt-4" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
aria-controls="home" aria-selected="true">Sketches</a>
</li>
</ul>
</div>
<div>
<div class="tab-content">
<div class="tab-pane fade py-4 show active" role="tabpanel" id="home">
<div class='container'>
<div class="row row-cols-1 row-cols-xl-5 row-cols-lg-4 row-cols-md-3 row-cols-sm-2">
{% if sketches %}
{% for sketch in sketches %}
<div class="col m-4">
<div class="card sketch-card" style="width: 200px;">
<div class="card-img-top">
<a href="/sketches/{{sketch.sketch_id}}">
{{ sketch.to_svg() }}
</a>
</div>
<div class="card-footer">
<div class="sketch-title">
<a href="sketches/{{sketch.sketch_id}}">{{sketch.title}}</a>
</div>
<div class="sketch-author">
by {{sketch.get_owner_name()}}
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% if not sketches %}
<p class="text-center">{{member.full_name}} has not created any skecth yet.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
<!-- this is a sample default web page template -->

View File

@@ -1,17 +0,0 @@
import frappe
from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches
def get_context(context):
context.no_cache = 1
context.username = frappe.form_dict["username"]
context.member = get_member(context.username)
if not context.member:
context.template = "www/404.html"
else:
context.sketches = list(filter(lambda x: x.owner == context.member.email, get_recent_sketches()))
def get_member(username):
try:
return frappe.get_doc("Community Member", {"username":username})
except frappe.DoesNotExistError:
return

View File

@@ -1,28 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/livecode.html" import LiveCodeEditor, LiveCodeEditorJS %}
{% block title %}Sketches{% endblock %}
{% block head_include %}
<meta name="description" content="Sketches" />
<meta name="keywords" content="sketches" />
<link rel="stylesheet" href="/assets/css/lms.css">
{% endblock %}
{% block content %}
<section class="top-section" style="padding: 1rem 0rem;">
<div class='container pb-5'>
<h1>Recent Sketches</h1>
<a href="/sketches/new">Create a New Sketch</a>
</div>
<div class='container'>
<div class="row">
{% for sketch in sketches %}
<div class="col-md-3">
{{ widgets.SketchTeaser(sketch=sketch) }}
</div>
{% endfor %}
</div>
</div>
</section>
{% endblock %}

View File

@@ -1,7 +0,0 @@
import frappe
from community.lms.models import Sketch
def get_context(context):
context.no_cache = 1
context.sketches = Sketch.get_recent_sketches()

View File

@@ -1,109 +0,0 @@
{% extends "templates/base.html" %}
{% from "www/macros/livecode.html" import LiveCodeEditorLarge, LiveCodeEditorJS with context %}
{% block title %}{{sketch.title}}{% endblock %}
{% block head_include %}
<meta name="description" content="Sketch {{sketch.title}}" />
<meta name="keywords" content="sketch {{sketch.title}}" />
<style>
</style>
<link rel="stylesheet" href="{{ livecode_url }}/static/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/assets/css/lms.css">
<script src="{{ livecode_url }}/static/codemirror/lib/codemirror.js"></script>
<script src="{{ livecode_url }}/static/codemirror/mode/python/python.js"></script>
<script src="{{ livecode_url }}/static/codemirror/keymap/sublime.js"></script>
<script src="{{ livecode_url }}/static/codemirror/addon/edit/matchbrackets.js"></script>
<script src="{{ livecode_url }}/static/codemirror/addon/comment/comment.js"></script>
{% endblock %}
{% block content %}
<section class="top-section" style="padding: 1rem 0rem;">
<div class='container pb-5'>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item" aria-current="page"><a href="/sketches">Sketches</a></li>
</ol>
</nav>
<div class="sketch-header">
{% if editable %}
<input type="button" class="pull-right" id="sketch-save" value="Save"/>
<h1 class="sketch-title">
<input type="text" name="title" id="sketch-title" value="{{ sketch.title }}" />
</h1>
{% else %}
<h1 class="sketch-title">{{sketch.title}}</h1>
{% endif %}
<div class="sketch-owner-wrapper">By <span class="sketch-owner">{{sketch.get_owner_name()}}</span></div>
</div>
{% if sketch.is_new() and not editable %}
<div class="alert alert-warning">
Please login to save this sketch.
</div>
{% endif %}
<div class="sketch-editor">
{{LiveCodeEditorLarge(sketch.name, sketch.code) }}
</div>
</section>
{% endblock %}
{%- block script %}
{{ super() }}
{{ LiveCodeEditorJS() }}
<script type="text/javascript">
var sketch_name = {{ sketch.name | tojson }};
function saveSketch() {
var title = $("#sketch-title").val()
var code = livecodeEditors[0].codemirror.doc.getValue()
frappe.call('community.lms.doctype.lms_sketch.lms_sketch.save_sketch', {
name: sketch_name,
title: title,
code: code
})
.then(r => {
var msg = r.message;
if (!msg.ok) {
var error = msg.error || "Save failed."
frappe.msgprint({
"title": "Error",
"indicator": "red",
"message": error
});
}
else if (msg.status == "created") {
var path = "/sketches/sketch?sketch=" + msg.name;
var url = window.location.protocol + "//" + window.location.host + path
window.history.pushState({path: url}, '', url);
sketch_name = name;
frappe.msgprint({
"title": "Notification",
"indicator": "green",
"message": "New sketch has been saved!"
});
}
else if (msg.status == "updated") {
frappe.msgprint({
"title": "Notification",
"indicator": "green",
"message": "The sketch has been saved!"
});
}
})
}
$(function() {
$("#sketch-save").click(function() {
saveSketch();
});
})
</script>
{%- endblock %}

View File

@@ -1,46 +0,0 @@
import frappe
def get_context(context):
context.no_cache = 1
try:
sketch_id = frappe.form_dict["sketch"]
except KeyError:
context.template = "www/404.html"
return
sketch = get_sketch(sketch_id)
if not sketch:
context.template = "www/404.html"
return
context.sketch = sketch
context.livecode_url = get_livecode_url()
context.editable = is_editable(context.sketch, frappe.session.user)
def is_editable(sketch, user):
if sketch.is_new():
# new sketches can be editable by any logged in user
return user != "Guest"
else:
# existing sketches are editable by the owner
return sketch.owner == user
def get_livecode_url():
doc = frappe.get_doc("LMS Settings")
return doc.livecode_url
def get_sketch(sketch_id):
if sketch_id == 'new':
sketch = frappe.new_doc('LMS Sketch')
sketch.name = "new"
sketch.title = "New Sketch"
sketch.code = "circle(100, 100, 50)"
return sketch
try:
name = "SKETCH-" + sketch_id
return frappe.get_doc('LMS Sketch', name)
except frappe.exceptions.DoesNotExistError:
return

View File

@@ -17,9 +17,9 @@ services:
bench:
image: anandology/frappe-bench
volumes:
- .:/home/bench/frappe-bench/apps/community
- .:/home/bench/frappe-bench/apps/school
environment:
- FRAPPE_APPS=community
- FRAPPE_APPS=school
- FRAPPE_ALLOW_TESTS=true
- FRAPPE_SITE_NAME=frappe.localhost
depends_on:

View File

@@ -1 +1 @@
License: MIT
License: AGPL

View File

@@ -1,39 +0,0 @@
# Mockups
HTML Mockups using [Mockdown][].
[Mockdown]: https://github.com/anandology/mockdown
## How to use
**Step 1:** Get into `mockups` directory
```
$ cd mockups
```
**Step 2:** Instal `mockdown`
```
$ pip install mockdown
```
**Step 3:** Start mockdown server
```
$ mockdown
...
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
...
```
**Step 4:** See the mockups at <http://localhost:5000/>.
## How does it work?
Mockdown uses [Jinja][] templates for writing HTML.
[Jinja]: https://jinja.palletsprojects.com/
To make is easy to provide test data, Mockdown looks for YAML file with the same name as the template. For example, `home.html` template uses the data from `home.yml`.

View File

@@ -1,42 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link href="/static/style.css" rel="stylesheet">
<title>{% block title %}FOSS United{% endblock %}</title>
</head>
<body>
<nav class="navbar navbar-light navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="/"><span>Home</span></a>
<button aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarSupportedContent" data-toggle="collapse" type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="mr-auto navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/sketches.html">
Sketches
</a>
</li>
</ul>
<ul class="ml-auto navbar-nav">
<!-- post login tools -->
<li class="nav-item">
<a class="nav-link btn-login-area" href="/login.html">Login</a>
</li>
</ul>
</div>
</div>
</nav>
{% block content %}
<h1>Lorem ipsum...</h1>
{% endblock %}
</body>
</html>

View File

@@ -1,114 +0,0 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
<div class="course-header">
<div class="course-type">course</div>
<h1>{{title}}</h1>
</div>
<div class="row">
<div class="col-lg-9 col-md-12">
<div class="course-details">
<h2>Course Description</h2>
<div class="course-description">
{{ description }}
</div>
<div class="preview-video">
<iframe
width="560"
height="315"
src="{{youtube_embed_url}}"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
<h2>Upcoming Batches</h2>
<div class="row">
{% for batch in batches %}
<div class="col-lg-4 col-md-6">
<div class="batch">
<div class="batch-details">
<div>Session every {{batch.weekdays}}</div>
<div>{{batch.timeslot}}</div>
<div>Starting from {{batch.start_date}}</div>
<div class="course-type" style="color: #888; padding: 10px 0px;">mentors</div>
{% for m in batch.mentors %}
<div>
<img class="profile-photo" src="{{m.photo_url}}">
<span class="instructor-title">{{m.name}}</span>
</div>
{% endfor %}
</div>
<div class="cta">
<div class="">
<button type="button">Join this Batch</button>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<h2>Course Outline</h2>
{% for chapter in chapters %}
<div class="chapter-plan">
<h3><span class="chapter-number">{{loop.index}}</span> {{chapter.title}}</h3>
<div class="chapter-description">
{{chapter.description}}
</div>
<div class="lessons">
{% for lesson in chapter.lessons %}
<div class="lesson">
<span class="lesson-type"><i class="{{lesson.icon}}"></i></span>
<span class="lesson-title">{{lesson.title}}</span>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-3 col-md-12">
<div class="sidebar">
<h3>Instructor</h3>
<div class="instructor">
<div class="instructor-title">{{instructor.name}}</div>
<div class="instructor-subtitle">Created {{instructor.num_courses}} courses</div>
</div>
</div>
<div class="sidebar">
<h3>Mentors</h3>
{% for m in mentors %}
<div class="instructor">
<div class="instructor-title">{{m.name}}</div>
<div class="instructor-subtitle">Mentored {{m.num_courses}} batches</div>
</div>
{% endfor %}
<div class="notice">
Interested to become a mentor?
<div><a href="#">Apply Now!</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,89 +0,0 @@
title: The Joy of Programming
description: |
Learn the joy of programming by turning the computer into a canvas.
youtube_embed_url: "https://www.youtube.com/embed/IFWAYnUeHR8?start=149"
stats:
chapters: 4
lessons: 25
videos: 6
completed: 287
instructor:
name: Anand Chitipothu
num_courses: 4
mentors:
- name: Anand Chitipothu
num_courses: 4
- name: Rushabh Mehta
num_courses: 3
- name: Jannat Patel
num_courses: 3
batches:
- id: jp01
status: scheduled
mentors:
- name: Anand Chitipothu
photo_url: https://pbs.twimg.com/profile_images/2599066714/igu5hx4wlg3mxucodinl.jpeg
num_batches: 4
start_date: May 3, 2021
weekdays: Mon, Thu
timeslot: 5:00-6:00 PM
- id: jp02
status: scheduled
mentors:
- name: Anand Chitipothu
photo_url: https://pbs.twimg.com/profile_images/2599066714/igu5hx4wlg3mxucodinl.jpeg
num_batches: 4
start_date: May 4, 2021
weekdays: Tue, Fri
timeslot: 5:00-6:00 PM
- id: jp03
status: scheduled
mentors:
- name: Rusbhabh Mehta
photo_url: https://pbs.twimg.com/profile_images/2599066714/igu5hx4wlg3mxucodinl.jpeg
num_batches: 4
start_date: May 15, 2021
weekdays: Sat
timeslot: 5:00-6:00 PM
chapters:
- title: Getting Started
description: |
Getting started with programming by turning the computer into a canvas.
lessons:
- index: 1
type: video
icon: bi bi-play-circle
title: Introduction to Programming
- index: 2
type: practice
icon: bi bi-code-square
title: Drawing Shapes
- title: Repeating Things
description: |
Isn't it very boring to do the same thing again and again?
Well, that is for humans. Computers love to do the same thing again and again.
Learn how to tell the computer to repeat multiple times the same task, or
with slight change every time.
lessons:
- index: 1
type: video
icon: bi bi-play-circle
title: Rinse and Repeat
- index: 2
type: practice
title: many circles
icon: bi bi-check2-circle
- index: 3
type: practice
icon: bi bi-code-square
title: print, print, print!

View File

@@ -1,33 +0,0 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
<div class="course-header">
<h1>Sketches</h1>
</div>
<div class="row sketches-gallery">
{% for s in sketches %}
<div class="col-md-3">
<div class="sketch-card">
<div class="sketch-image">
<a href="#">
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" stroke="black" xmlns="http://www.w3.org/2000/svg">
<circle cx="150" cy="150" r="150.0"></circle>
</svg>
</a>
</div>
<div class="sketch-footer">
<div class="sketch-title">
<a href="#">{{s.title}}</a>
</div>
<div class="sketch-author">
by {{s.author}}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -1,38 +0,0 @@
sketches:
- id: 20
title: Big Circle
author: Anand Chitipothu
- id: 19
title: Small Circle
author: Anand Chitipothu
- id: 18
title: Circles in Queue
author: Chaitanya
- id: 17
title: Random Bottom Circles
author: Anand Chitipothu
- id: 16
title: Pipes
author: Vishal
- id: 15
title: New Sketch
author: Malleshwari
- id: 20
title: Big Circle
author: Anand Chitipothu
- id: 19
title: Small Circle
author: Anand Chitipothu
- id: 18
title: Circles in Queue
author: Chaitanya
- id: 17
title: Random Bottom Circles
author: Anand Chitipothu
- id: 16
title: Pipes
author: Vishal
- id: 15
title: New Sketch
author: Malleshwari

View File

@@ -1,221 +0,0 @@
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css");
:root {
--c1: #fefae0;
--c2: #264653;
--c3: #e9c46a;
--c4: #2a9d8f;
--c5: #f4a261;
--c6: #e76f51;
--c7: #ccd5ae;
--bg: var(--c1);
--header-bg: var(--c2);
--header-color: var(--c3);
--tag-color: var(--c7);
--sidebar-bg: var(--c7);
--h-color: var(--c2);
--text-color: #333;
--text-color-light: #ccc;
--cta-color: var(--c4);
}
body {
padding: 0px;
margin: 0px;
background: var(--bg);
}
.navbar-light {
border-bottom: 1px solid #E2E6E9;
}
.page-header {
margin-top: 20px;
padding: 20px;
border-radius: 10px;
}
.page-header .page-header{
margin-top: 20px;
padding: 20px;
border-radius: 10px;
}
.course-header {
margin-top: 20px;
padding: 20px;
background: var(--header-bg);
color: var(--header-color);
border-radius: 10px;
}
.course-header h1 {
color: inherit;
}
.course-type {
text-transform: uppercase;
font-size: 1.0em;
color: var(--tag-color);
}
.sidebar {
background: var(--sidebar-bg);
margin: 20px 0px;
border-radius: 10px;
padding: 1px 20px 20px 20px;
color: var(--text-color);
}
.sidebar h3 {
margin-top: 20px;
color: var(--c2);
}
.instructor {
padding: 10px;
}
.instructor-title {
font-weight: bold;
}
.instructor-subtitle {
font-size: 0.8em;
color: var(--text-color);
}
.sidebar .notice {
padding: 10px;
border-radius: 10px;
border: 1px dashed var(--text-color);
}
.sidebar .notice a {
color: inherit;
text-decoration: underline;
}
.course-details {
margin: 20px 0px;
}
.course-details h2 {
color: var(--h-color);
font-size: 1.4em;
font-weight: bold;
margin: 20px 0px 10px 0px;
}
.chapter-plan {
border-radius: 10px;
margin: 20px 0px;
padding: 20px;
border: 1px solid #ddc;
background: white;
}
.chapter-plan h3 {
font-size: 1.1em;
font-weight: bold;
}
.chapter-number {
background: var(--text-color);
color: white;
border-radius: 50%;
height: 24px;
min-width: 24px;
align-items: center;
padding: 2px 8px 2px 8px;
margin-right: 5px;
}
.chapter-description {
margin: 20px 0px;
}
.lessons {
padding-left: 20px;
}
.lesson {
margin: 5px 0px;
font-weight: bold;
}
.batch {
border-radius: 10px;
margin: 10px 0px;
background: white;
border: 1px solid #ddc;
}
.batch-details {
padding: 20px;
}
.batch .cta {
margin-top: 10px;
padding: 10px;
min-height: 28px;
text-align: right;
border-top: 1px solid #ddc;
}
.batch .cta button {
background: var(--cta-color);
color: white;
border: none;
border-radius: 5px;
padding: 5px 10px;
}
.batch .right {
float: right;
}
img.profile-photo {
width: 24px;
height: 24px;
border-radius: 50%;
}
.lesson-type {
padding-right: 5px;
}
.preview-video {
text-align: center;
margin: 20px 0px;
}
.preview-video iframe {
max-width: 100%
}
.sketches-gallery svg {
width: 200px;
height: 200px;
}
.sketch-card {
background: white;
border-radius: 10px;
border: 1px solid #ddd;
margin: 10px;
}
.sketch-card .sketch-image {
padding: 10px;
}
.sketch-footer {
padding: 10px;
background: #eee;
}

View File

@@ -1,2 +1,5 @@
frappe
websocket_client
markdown
beautifulsoup4
lxml

Some files were not shown because too many files have changed in this diff Show More