diff --git a/community/community/doctype/community_course_enrollment/community_course_enrollment.json b/community/community/doctype/community_course_enrollment/community_course_enrollment.json index c0b8cb21..bd4e583d 100644 --- a/community/community/doctype/community_course_enrollment/community_course_enrollment.json +++ b/community/community/doctype/community_course_enrollment/community_course_enrollment.json @@ -5,7 +5,8 @@ "editable_grid": 1, "engine": "InnoDB", "field_order": [ - "course" + "course", + "user" ], "fields": [ { @@ -13,11 +14,17 @@ "fieldtype": "Link", "label": "Course", "options": "Community Course" + }, + { + "fieldname": "user", + "fieldtype": "Data", + "label": "User", + "options": "Email" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-03-03 11:44:32.011805", + "modified": "2021-03-04 18:24:22.654503", "modified_by": "Administrator", "module": "Community", "name": "Community Course Enrollment", diff --git a/community/community/doctype/community_hackathon/__init__.py b/community/hackathon/__init__.py similarity index 100% rename from community/community/doctype/community_hackathon/__init__.py rename to community/hackathon/__init__.py diff --git a/community/community/doctype/community_project/__init__.py b/community/hackathon/doctype/__init__.py similarity index 100% rename from community/community/doctype/community_project/__init__.py rename to community/hackathon/doctype/__init__.py diff --git a/community/community/doctype/community_project_evaluation/__init__.py b/community/hackathon/doctype/community_hackathon/__init__.py similarity index 100% rename from community/community/doctype/community_project_evaluation/__init__.py rename to community/hackathon/doctype/community_hackathon/__init__.py diff --git a/community/community/doctype/community_hackathon/community_hackathon.js b/community/hackathon/doctype/community_hackathon/community_hackathon.js similarity index 72% rename from community/community/doctype/community_hackathon/community_hackathon.js rename to community/hackathon/doctype/community_hackathon/community_hackathon.js index 91812b8a..5cfa6fd2 100644 --- a/community/community/doctype/community_hackathon/community_hackathon.js +++ b/community/hackathon/doctype/community_hackathon/community_hackathon.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Hackathon', { diff --git a/community/community/doctype/community_hackathon/community_hackathon.json b/community/hackathon/doctype/community_hackathon/community_hackathon.json similarity index 94% rename from community/community/doctype/community_hackathon/community_hackathon.json rename to community/hackathon/doctype/community_hackathon/community_hackathon.json index cd6749e8..c9b70e00 100644 --- a/community/community/doctype/community_hackathon/community_hackathon.json +++ b/community/hackathon/doctype/community_hackathon/community_hackathon.json @@ -34,9 +34,9 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-17 12:44:25.198010", + "modified": "2021-03-04 19:57:22.618153", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Hackathon", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_hackathon/community_hackathon.py b/community/hackathon/doctype/community_hackathon/community_hackathon.py similarity index 80% rename from community/community/doctype/community_hackathon/community_hackathon.py rename to community/hackathon/doctype/community_hackathon/community_hackathon.py index 88e85e5e..8432cb71 100644 --- a/community/community/doctype/community_hackathon/community_hackathon.py +++ b/community/hackathon/doctype/community_hackathon/community_hackathon.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_hackathon/test_community_hackathon.py b/community/hackathon/doctype/community_hackathon/test_community_hackathon.py similarity index 77% rename from community/community/doctype/community_hackathon/test_community_hackathon.py rename to community/hackathon/doctype/community_hackathon/test_community_hackathon.py index 1850b9ec..e38b48d9 100644 --- a/community/community/doctype/community_hackathon/test_community_hackathon.py +++ b/community/hackathon/doctype/community_hackathon/test_community_hackathon.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_like/__init__.py b/community/hackathon/doctype/community_project/__init__.py similarity index 100% rename from community/community/doctype/community_project_like/__init__.py rename to community/hackathon/doctype/community_project/__init__.py diff --git a/community/community/doctype/community_project/community_project.js b/community/hackathon/doctype/community_project/community_project.js similarity index 71% rename from community/community/doctype/community_project/community_project.js rename to community/hackathon/doctype/community_project/community_project.js index 970031f6..95c396ea 100644 --- a/community/community/doctype/community_project/community_project.js +++ b/community/hackathon/doctype/community_project/community_project.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Project', { diff --git a/community/community/doctype/community_project/community_project.json b/community/hackathon/doctype/community_project/community_project.json similarity index 97% rename from community/community/doctype/community_project/community_project.json rename to community/hackathon/doctype/community_project/community_project.json index a3e52305..472bcb21 100644 --- a/community/community/doctype/community_project/community_project.json +++ b/community/hackathon/doctype/community_project/community_project.json @@ -59,6 +59,12 @@ "fieldtype": "Markdown Editor", "label": "Project Description" }, + { + "fieldname": "hackathon", + "fieldtype": "Link", + "label": "Hackathon", + "options": "Community Hackathon" + }, { "default": "0", "fieldname": "accepting_members", @@ -76,19 +82,13 @@ "fieldtype": "Small Text", "hidden": 1, "label": "Project Search" - }, - { - "fieldname": "hackathon", - "fieldtype": "Link", - "label": "Hackathon", - "options": "Community Hackathon" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-24 15:52:56.588565", + "modified": "2021-03-04 19:59:33.450666", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Project", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_project/community_project.py b/community/hackathon/doctype/community_project/community_project.py similarity index 80% rename from community/community/doctype/community_project/community_project.py rename to community/hackathon/doctype/community_project/community_project.py index 09c07cf5..b0d1f231 100644 --- a/community/community/doctype/community_project/community_project.py +++ b/community/hackathon/doctype/community_project/community_project.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project/test_community_project.py b/community/hackathon/doctype/community_project/test_community_project.py similarity index 76% rename from community/community/doctype/community_project/test_community_project.py rename to community/hackathon/doctype/community_project/test_community_project.py index d0199e4c..0525d34e 100644 --- a/community/community/doctype/community_project/test_community_project.py +++ b/community/hackathon/doctype/community_project/test_community_project.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_member/__init__.py b/community/hackathon/doctype/community_project_evaluation/__init__.py similarity index 100% rename from community/community/doctype/community_project_member/__init__.py rename to community/hackathon/doctype/community_project_evaluation/__init__.py diff --git a/community/community/doctype/community_project_evaluation/community_project_evaluation.js b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.js similarity index 73% rename from community/community/doctype/community_project_evaluation/community_project_evaluation.js rename to community/hackathon/doctype/community_project_evaluation/community_project_evaluation.js index 4713db7d..0b7edf19 100644 --- a/community/community/doctype/community_project_evaluation/community_project_evaluation.js +++ b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Project Evaluation', { diff --git a/community/community/doctype/community_project_evaluation/community_project_evaluation.json b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.json similarity index 97% rename from community/community/doctype/community_project_evaluation/community_project_evaluation.json rename to community/hackathon/doctype/community_project_evaluation/community_project_evaluation.json index ba9c2cfc..868b961b 100644 --- a/community/community/doctype/community_project_evaluation/community_project_evaluation.json +++ b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.json @@ -123,9 +123,9 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-12 19:44:57.467599", + "modified": "2021-03-04 19:56:53.757808", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Project Evaluation", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_project_evaluation/community_project_evaluation.py b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.py similarity index 81% rename from community/community/doctype/community_project_evaluation/community_project_evaluation.py rename to community/hackathon/doctype/community_project_evaluation/community_project_evaluation.py index 653d8fc7..bdf5e2ab 100644 --- a/community/community/doctype/community_project_evaluation/community_project_evaluation.py +++ b/community/hackathon/doctype/community_project_evaluation/community_project_evaluation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_evaluation/test_community_project_evaluation.py b/community/hackathon/doctype/community_project_evaluation/test_community_project_evaluation.py similarity index 77% rename from community/community/doctype/community_project_evaluation/test_community_project_evaluation.py rename to community/hackathon/doctype/community_project_evaluation/test_community_project_evaluation.py index 624c3bd3..f900a766 100644 --- a/community/community/doctype/community_project_evaluation/test_community_project_evaluation.py +++ b/community/hackathon/doctype/community_project_evaluation/test_community_project_evaluation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_update/__init__.py b/community/hackathon/doctype/community_project_like/__init__.py similarity index 100% rename from community/community/doctype/community_project_update/__init__.py rename to community/hackathon/doctype/community_project_like/__init__.py diff --git a/community/community/doctype/community_project_like/community_project_like.js b/community/hackathon/doctype/community_project_like/community_project_like.js similarity index 72% rename from community/community/doctype/community_project_like/community_project_like.js rename to community/hackathon/doctype/community_project_like/community_project_like.js index 835d7843..d35c22f0 100644 --- a/community/community/doctype/community_project_like/community_project_like.js +++ b/community/hackathon/doctype/community_project_like/community_project_like.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Project Like', { diff --git a/community/community/doctype/community_project_like/community_project_like.json b/community/hackathon/doctype/community_project_like/community_project_like.json similarity index 91% rename from community/community/doctype/community_project_like/community_project_like.json rename to community/hackathon/doctype/community_project_like/community_project_like.json index 7144bb0a..0c0af277 100644 --- a/community/community/doctype/community_project_like/community_project_like.json +++ b/community/hackathon/doctype/community_project_like/community_project_like.json @@ -17,9 +17,9 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-12 18:43:24.206708", + "modified": "2021-03-04 18:55:51.877522", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Project Like", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_project_like/community_project_like.py b/community/hackathon/doctype/community_project_like/community_project_like.py similarity index 81% rename from community/community/doctype/community_project_like/community_project_like.py rename to community/hackathon/doctype/community_project_like/community_project_like.py index 7eaec684..aa91d1f6 100644 --- a/community/community/doctype/community_project_like/community_project_like.py +++ b/community/hackathon/doctype/community_project_like/community_project_like.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_like/test_community_project_like.py b/community/hackathon/doctype/community_project_like/test_community_project_like.py similarity index 77% rename from community/community/doctype/community_project_like/test_community_project_like.py rename to community/hackathon/doctype/community_project_like/test_community_project_like.py index bca9c608..c055ab4a 100644 --- a/community/community/doctype/community_project_like/test_community_project_like.py +++ b/community/hackathon/doctype/community_project_like/test_community_project_like.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/hackathon/doctype/community_project_member/__init__.py b/community/hackathon/doctype/community_project_member/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/community/doctype/community_project_member/community_project_member.js b/community/hackathon/doctype/community_project_member/community_project_member.js similarity index 72% rename from community/community/doctype/community_project_member/community_project_member.js rename to community/hackathon/doctype/community_project_member/community_project_member.js index 0b691bb1..1249caa9 100644 --- a/community/community/doctype/community_project_member/community_project_member.js +++ b/community/hackathon/doctype/community_project_member/community_project_member.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Project Member', { diff --git a/community/community/doctype/community_project_member/community_project_member.json b/community/hackathon/doctype/community_project_member/community_project_member.json similarity index 95% rename from community/community/doctype/community_project_member/community_project_member.json rename to community/hackathon/doctype/community_project_member/community_project_member.json index 9a978409..739900c8 100644 --- a/community/community/doctype/community_project_member/community_project_member.json +++ b/community/hackathon/doctype/community_project_member/community_project_member.json @@ -42,9 +42,9 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-16 19:27:30.842282", + "modified": "2021-03-04 19:44:09.832170", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Project Member", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_project_member/community_project_member.py b/community/hackathon/doctype/community_project_member/community_project_member.py similarity index 80% rename from community/community/doctype/community_project_member/community_project_member.py rename to community/hackathon/doctype/community_project_member/community_project_member.py index 3e14fd09..a0842b2d 100644 --- a/community/community/doctype/community_project_member/community_project_member.py +++ b/community/hackathon/doctype/community_project_member/community_project_member.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +# import frappe from frappe.model.document import Document class CommunityProjectMember(Document): - - def validate(self): + def validate(self): self.validate_if_already_member() def validate_if_already_member(self): if frappe.get_all("Community Project Member", {"owner": self.owner}): frappe.throw(_("You have already applied for the membership of this project.")) + diff --git a/community/community/doctype/community_project_member/test_community_project_member.py b/community/hackathon/doctype/community_project_member/test_community_project_member.py similarity index 77% rename from community/community/doctype/community_project_member/test_community_project_member.py rename to community/hackathon/doctype/community_project_member/test_community_project_member.py index 9e03a93c..456c6c9a 100644 --- a/community/community/doctype/community_project_member/test_community_project_member.py +++ b/community/hackathon/doctype/community_project_member/test_community_project_member.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/hackathon/doctype/community_project_update/__init__.py b/community/hackathon/doctype/community_project_update/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/community/doctype/community_project_update/community_project_update.js b/community/hackathon/doctype/community_project_update/community_project_update.js similarity index 72% rename from community/community/doctype/community_project_update/community_project_update.js rename to community/hackathon/doctype/community_project_update/community_project_update.js index d76e297a..e50788a4 100644 --- a/community/community/doctype/community_project_update/community_project_update.js +++ b/community/hackathon/doctype/community_project_update/community_project_update.js @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Frappe and contributors +// Copyright (c) 2021, FOSS United and contributors // For license information, please see license.txt frappe.ui.form.on('Community Project Update', { diff --git a/community/community/doctype/community_project_update/community_project_update.json b/community/hackathon/doctype/community_project_update/community_project_update.json similarity index 93% rename from community/community/doctype/community_project_update/community_project_update.json rename to community/hackathon/doctype/community_project_update/community_project_update.json index 695f4df9..fc9fc50c 100644 --- a/community/community/doctype/community_project_update/community_project_update.json +++ b/community/hackathon/doctype/community_project_update/community_project_update.json @@ -27,9 +27,9 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-12 18:45:56.750969", + "modified": "2021-03-04 19:43:10.886773", "modified_by": "Administrator", - "module": "Community", + "module": "Hackathon", "name": "Community Project Update", "owner": "Administrator", "permissions": [ diff --git a/community/community/doctype/community_project_update/community_project_update.py b/community/hackathon/doctype/community_project_update/community_project_update.py similarity index 81% rename from community/community/doctype/community_project_update/community_project_update.py rename to community/hackathon/doctype/community_project_update/community_project_update.py index 253d79be..6830688d 100644 --- a/community/community/doctype/community_project_update/community_project_update.py +++ b/community/hackathon/doctype/community_project_update/community_project_update.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors +# Copyright (c) 2021, FOSS United and contributors # For license information, please see license.txt from __future__ import unicode_literals diff --git a/community/community/doctype/community_project_update/test_community_project_update.py b/community/hackathon/doctype/community_project_update/test_community_project_update.py similarity index 77% rename from community/community/doctype/community_project_update/test_community_project_update.py rename to community/hackathon/doctype/community_project_update/test_community_project_update.py index e8f09356..465ee136 100644 --- a/community/community/doctype/community_project_update/test_community_project_update.py +++ b/community/hackathon/doctype/community_project_update/test_community_project_update.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors +# Copyright (c) 2021, FOSS United and Contributors # See license.txt from __future__ import unicode_literals diff --git a/community/hackathon/web_form/__init__.py b/community/hackathon/web_form/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/hackathon/web_form/join_request/__init__.py b/community/hackathon/web_form/join_request/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/hackathon/web_form/join_request/join_request.js b/community/hackathon/web_form/join_request/join_request.js new file mode 100644 index 00000000..699703c5 --- /dev/null +++ b/community/hackathon/web_form/join_request/join_request.js @@ -0,0 +1,3 @@ +frappe.ready(function() { + // bind events here +}) \ No newline at end of file diff --git a/community/hackathon/web_form/join_request/join_request.json b/community/hackathon/web_form/join_request/join_request.json new file mode 100644 index 00000000..2d2d916f --- /dev/null +++ b/community/hackathon/web_form/join_request/join_request.json @@ -0,0 +1,64 @@ +{ + "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": "Send Request", + "client_script": "$('.page-header h2').html(`Request to Join \"${frappe.utils.get_url_arg('project_name')}\"`);", + "creation": "2021-02-17 13:20:08.548735", + "doc_type": "Community Project Member", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "is_standard": 1, + "login_required": 0, + "max_attachment_size": 0, + "modified": "2021-03-04 19:43:53.697037", + "modified_by": "Administrator", + "module": "Hackathon", + "name": "join-request", + "owner": "Administrator", + "payment_button_label": "Buy Now", + "published": 1, + "route": "join-request", + "route_to_success_link": 0, + "show_attachments": 0, + "show_in_grid": 0, + "show_sidebar": 0, + "sidebar_items": [], + "success_url": "/join-request", + "title": "Join Request", + "web_form_fields": [ + { + "allow_read_on_all_link_options": 0, + "fieldname": "project", + "fieldtype": "Link", + "hidden": 0, + "label": "Project", + "max_length": 0, + "max_value": 0, + "options": "Community Project", + "read_only": 0, + "reqd": 1, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "intro", + "fieldtype": "Small Text", + "hidden": 0, + "label": "Intro", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 1, + "show_in_filter": 0 + } + ] +} \ No newline at end of file diff --git a/community/hackathon/web_form/join_request/join_request.py b/community/hackathon/web_form/join_request/join_request.py new file mode 100644 index 00000000..2334f8b2 --- /dev/null +++ b/community/hackathon/web_form/join_request/join_request.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +import frappe + +def get_context(context): + # do your magic here + pass diff --git a/community/hackathon/web_form/project_update/__init__.py b/community/hackathon/web_form/project_update/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/hackathon/web_form/project_update/project_update.js b/community/hackathon/web_form/project_update/project_update.js new file mode 100644 index 00000000..699703c5 --- /dev/null +++ b/community/hackathon/web_form/project_update/project_update.js @@ -0,0 +1,3 @@ +frappe.ready(function() { + // bind events here +}) \ No newline at end of file diff --git a/community/hackathon/web_form/project_update/project_update.json b/community/hackathon/web_form/project_update/project_update.json new file mode 100644 index 00000000..10d97a9b --- /dev/null +++ b/community/hackathon/web_form/project_update/project_update.json @@ -0,0 +1,63 @@ +{ + "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": "Submit", + "creation": "2021-02-18 13:15:09.464515", + "doc_type": "Community Project Update", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "is_standard": 1, + "login_required": 1, + "max_attachment_size": 0, + "modified": "2021-03-04 19:43:28.957577", + "modified_by": "Administrator", + "module": "Hackathon", + "name": "project-update", + "owner": "Administrator", + "payment_button_label": "Buy Now", + "published": 1, + "route": "project-update", + "route_to_success_link": 0, + "show_attachments": 0, + "show_in_grid": 0, + "show_sidebar": 0, + "sidebar_items": [], + "success_url": "/project-update", + "title": "Project Update", + "web_form_fields": [ + { + "allow_read_on_all_link_options": 0, + "fieldname": "project", + "fieldtype": "Link", + "hidden": 0, + "label": "Project", + "max_length": 0, + "max_value": 0, + "options": "Community Project", + "read_only": 0, + "reqd": 1, + "show_in_filter": 0 + }, + { + "allow_read_on_all_link_options": 0, + "fieldname": "update", + "fieldtype": "Data", + "hidden": 0, + "label": "Update", + "max_length": 0, + "max_value": 0, + "read_only": 0, + "reqd": 1, + "show_in_filter": 0 + } + ] +} \ No newline at end of file diff --git a/community/hackathon/web_form/project_update/project_update.py b/community/hackathon/web_form/project_update/project_update.py new file mode 100644 index 00000000..2334f8b2 --- /dev/null +++ b/community/hackathon/web_form/project_update/project_update.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +import frappe + +def get_context(context): + # do your magic here + pass diff --git a/community/lms/__init__.py b/community/lms/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/modules.txt b/community/modules.txt index c0afad86..dc1f411f 100644 --- a/community/modules.txt +++ b/community/modules.txt @@ -1 +1,3 @@ -Community \ No newline at end of file +Community +Hackathon +LMS \ No newline at end of file diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 56965fa8..644e2f41 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -16,13 +16,9 @@ - {% if course_enrolled %} -

-

Enrolled
-

- {% endif %} +
Enrolled
- {% if not course_enrolled %} + {% if not course_enrolled and frappe.session.user != "Guest" %} {% endif %}

{{ course.title }}

diff --git a/community/www/courses/course.js b/community/www/courses/course.js index 87c7c869..9a3923b7 100644 --- a/community/www/courses/course.js +++ b/community/www/courses/course.js @@ -1,17 +1,22 @@ -/* frappe.ready(() => { - var url_params = new URLSearchParams(window.location.search); - frappe.call('community.www.courses.course.has_enrolled', { course: url_params.get("course") }, (data) => { - if (data.message) { - $(".btn-enroll").addClass("hide"); - $(".enrollment-details").removeClass("hide"); - } - }) -}) */ +frappe.ready(() => { + if(frappe.session.user != "Guest"){ + var url_params = new URLSearchParams(window.location.search); + frappe.call('community.www.courses.course.has_enrolled', { course: url_params.get("course") }, (data) => { + if (data.message) { + show_enrollment_badge() + } + }) + } +}) + +var show_enrollment_badge = () => { + $(".btn-enroll").addClass("hide"); + $(".enrollment-badge").removeClass("hide"); +} $('.btn-enroll').on('click', (e) => { - frappe.call('community.www.courses.course.enroll', { course: $(e.target).attr("data-course") }, (data) => { - $(".btn-enroll").addClass("hide"); - $(".enrollment-details").removeClass("hide"); - }); + frappe.call('community.www.courses.course.enroll', { course: $(e.target).attr("data-course") }, (data) => { + show_enrollment_badge() + }); }); diff --git a/community/www/courses/course.py b/community/www/courses/course.py index 6c470002..3a2a19df 100644 --- a/community/www/courses/course.py +++ b/community/www/courses/course.py @@ -22,6 +22,7 @@ def get_course(name): ) return course +@frappe.whitelist() def has_enrolled(course): return frappe.db.get_value("Community Course Enrollment", {"course": course, "owner": frappe.session.user}) @@ -29,7 +30,8 @@ def has_enrolled(course): def enroll(course): return frappe.get_doc({ "doctype": "Community Course Enrollment", - "course": course + "course": course, + "user": frappe.session.user }).save() \ No newline at end of file diff --git a/community/www/courses/index.py b/community/www/courses/index.py index 487b8f60..4ab1e92f 100644 --- a/community/www/courses/index.py +++ b/community/www/courses/index.py @@ -9,5 +9,4 @@ def get_courses(): "Community Course", fields=['name', 'title', 'description'] ) - print(courses) return courses \ No newline at end of file diff --git a/community/www/courses/topic.py b/community/www/courses/topic.py index 3ae6a6c7..7b2b6cd4 100644 --- a/community/www/courses/topic.py +++ b/community/www/courses/topic.py @@ -8,8 +8,6 @@ def get_context(context): topic_name = get_queryparam("topic", '/courses?course=' + course_name) context.topic = get_topic(course_name, topic_name) - print("topic", context.topic) - def get_queryparam(name, redirect_when_not_found): try: return frappe.form_dict[name] diff --git a/community/www/my-courses/index.html b/community/www/my-courses/index.html index 22f194d2..24db031a 100644 --- a/community/www/my-courses/index.html +++ b/community/www/my-courses/index.html @@ -31,6 +31,13 @@ padding: 20px; } + .no-courses { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + } + section { padding: 5rem 0 5rem 0; } @@ -40,11 +47,11 @@ {% macro card(course) %}
- {% endmacro %} @@ -52,16 +59,24 @@ {% block content %}
-
- {% for course in my_courses %} - {{ card(course) }} - {% endfor %} - {% if my_courses %} - {% for n in range( (3 - (my_courses|length)) %3) %} - {{ null_card() }} - {% endfor %} - {% endif %} + {% 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 %} +
You haven't enrolled in any Course yet. Check out the availabe + courses.
+ {% endif %} + {% else %} +
+

Please sign up to access this page.

+ {{_('Sign Up')}}
+ {% endif %}
{% endblock %} \ No newline at end of file