refactor: seperate module for hackathon
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"course"
|
"course",
|
||||||
|
"user"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -13,11 +14,17 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Course",
|
"label": "Course",
|
||||||
"options": "Community Course"
|
"options": "Community Course"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "user",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "User",
|
||||||
|
"options": "Email"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-03-03 11:44:32.011805",
|
"modified": "2021-03-04 18:24:22.654503",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Community",
|
||||||
"name": "Community Course Enrollment",
|
"name": "Community Course Enrollment",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Hackathon', {
|
frappe.ui.form.on('Community Hackathon', {
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-17 12:44:25.198010",
|
"modified": "2021-03-04 19:57:22.618153",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Hackathon",
|
"name": "Community Hackathon",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Project', {
|
frappe.ui.form.on('Community Project', {
|
||||||
@@ -59,6 +59,12 @@
|
|||||||
"fieldtype": "Markdown Editor",
|
"fieldtype": "Markdown Editor",
|
||||||
"label": "Project Description"
|
"label": "Project Description"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "hackathon",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Hackathon",
|
||||||
|
"options": "Community Hackathon"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "accepting_members",
|
"fieldname": "accepting_members",
|
||||||
@@ -76,19 +82,13 @@
|
|||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"label": "Project Search"
|
"label": "Project Search"
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "hackathon",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Hackathon",
|
|
||||||
"options": "Community Hackathon"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-24 15:52:56.588565",
|
"modified": "2021-03-04 19:59:33.450666",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Project",
|
"name": "Community Project",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Project Evaluation', {
|
frappe.ui.form.on('Community Project Evaluation', {
|
||||||
@@ -123,9 +123,9 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-12 19:44:57.467599",
|
"modified": "2021-03-04 19:56:53.757808",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Project Evaluation",
|
"name": "Community Project Evaluation",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Project Like', {
|
frappe.ui.form.on('Community Project Like', {
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-12 18:43:24.206708",
|
"modified": "2021-03-04 18:55:51.877522",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Project Like",
|
"name": "Community Project Like",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Project Member', {
|
frappe.ui.form.on('Community Project Member', {
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-16 19:27:30.842282",
|
"modified": "2021-03-04 19:44:09.832170",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Project Member",
|
"name": "Community Project Member",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
# import frappe
|
||||||
from frappe import _
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class CommunityProjectMember(Document):
|
class CommunityProjectMember(Document):
|
||||||
|
def validate(self):
|
||||||
def validate(self):
|
|
||||||
self.validate_if_already_member()
|
self.validate_if_already_member()
|
||||||
|
|
||||||
def validate_if_already_member(self):
|
def validate_if_already_member(self):
|
||||||
if frappe.get_all("Community Project Member", {"owner": self.owner}):
|
if frappe.get_all("Community Project Member", {"owner": self.owner}):
|
||||||
frappe.throw(_("You have already applied for the membership of this project."))
|
frappe.throw(_("You have already applied for the membership of this project."))
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2021, Frappe and contributors
|
// Copyright (c) 2021, FOSS United and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Community Project Update', {
|
frappe.ui.form.on('Community Project Update', {
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-02-12 18:45:56.750969",
|
"modified": "2021-03-04 19:43:10.886773",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Community",
|
"module": "Hackathon",
|
||||||
"name": "Community Project Update",
|
"name": "Community Project Update",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, FOSS United and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (c) 2021, Frappe and Contributors
|
# Copyright (c) 2021, FOSS United and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
0
community/hackathon/web_form/__init__.py
Normal file
0
community/hackathon/web_form/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
frappe.ready(function() {
|
||||||
|
// bind events here
|
||||||
|
})
|
||||||
64
community/hackathon/web_form/join_request/join_request.json
Normal file
64
community/hackathon/web_form/join_request/join_request.json
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
# do your magic here
|
||||||
|
pass
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
frappe.ready(function() {
|
||||||
|
// bind events here
|
||||||
|
})
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
# do your magic here
|
||||||
|
pass
|
||||||
0
community/lms/__init__.py
Normal file
0
community/lms/__init__.py
Normal file
@@ -1 +1,3 @@
|
|||||||
Community
|
Community
|
||||||
|
Hackathon
|
||||||
|
LMS
|
||||||
@@ -16,13 +16,9 @@
|
|||||||
<li class="breadcrumb-item" aria-current="page"><a href="/courses">Courses</a></li>
|
<li class="breadcrumb-item" aria-current="page"><a href="/courses">Courses</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
{% if course_enrolled %}
|
<div class="badge badge-info enrollment-badge hide">Enrolled</div>
|
||||||
<p>
|
|
||||||
<div class="badge badge-info">Enrolled</div>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
<div>
|
<div>
|
||||||
{% if not course_enrolled %}
|
{% if not course_enrolled and frappe.session.user != "Guest" %}
|
||||||
<button class="btn btn-dark btn-enroll float-right" data-course={{course.name}}>Enroll</button>
|
<button class="btn btn-dark btn-enroll float-right" data-course={{course.name}}>Enroll</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h1>{{ course.title }}</h1>
|
<h1>{{ course.title }}</h1>
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
/* frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
var url_params = new URLSearchParams(window.location.search);
|
if(frappe.session.user != "Guest"){
|
||||||
frappe.call('community.www.courses.course.has_enrolled', { course: url_params.get("course") }, (data) => {
|
var url_params = new URLSearchParams(window.location.search);
|
||||||
if (data.message) {
|
frappe.call('community.www.courses.course.has_enrolled', { course: url_params.get("course") }, (data) => {
|
||||||
$(".btn-enroll").addClass("hide");
|
if (data.message) {
|
||||||
$(".enrollment-details").removeClass("hide");
|
show_enrollment_badge()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}) */
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
var show_enrollment_badge = () => {
|
||||||
|
$(".btn-enroll").addClass("hide");
|
||||||
|
$(".enrollment-badge").removeClass("hide");
|
||||||
|
}
|
||||||
|
|
||||||
$('.btn-enroll').on('click', (e) => {
|
$('.btn-enroll').on('click', (e) => {
|
||||||
frappe.call('community.www.courses.course.enroll', { course: $(e.target).attr("data-course") }, (data) => {
|
frappe.call('community.www.courses.course.enroll', { course: $(e.target).attr("data-course") }, (data) => {
|
||||||
$(".btn-enroll").addClass("hide");
|
show_enrollment_badge()
|
||||||
$(".enrollment-details").removeClass("hide");
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ def get_course(name):
|
|||||||
)
|
)
|
||||||
return course
|
return course
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
def has_enrolled(course):
|
def has_enrolled(course):
|
||||||
return frappe.db.get_value("Community Course Enrollment", {"course": course, "owner": frappe.session.user})
|
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):
|
def enroll(course):
|
||||||
return frappe.get_doc({
|
return frappe.get_doc({
|
||||||
"doctype": "Community Course Enrollment",
|
"doctype": "Community Course Enrollment",
|
||||||
"course": course
|
"course": course,
|
||||||
|
"user": frappe.session.user
|
||||||
}).save()
|
}).save()
|
||||||
|
|
||||||
|
|
||||||
@@ -9,5 +9,4 @@ def get_courses():
|
|||||||
"Community Course",
|
"Community Course",
|
||||||
fields=['name', 'title', 'description']
|
fields=['name', 'title', 'description']
|
||||||
)
|
)
|
||||||
print(courses)
|
|
||||||
return courses
|
return courses
|
||||||
@@ -8,8 +8,6 @@ def get_context(context):
|
|||||||
topic_name = get_queryparam("topic", '/courses?course=' + course_name)
|
topic_name = get_queryparam("topic", '/courses?course=' + course_name)
|
||||||
context.topic = get_topic(course_name, topic_name)
|
context.topic = get_topic(course_name, topic_name)
|
||||||
|
|
||||||
print("topic", context.topic)
|
|
||||||
|
|
||||||
def get_queryparam(name, redirect_when_not_found):
|
def get_queryparam(name, redirect_when_not_found):
|
||||||
try:
|
try:
|
||||||
return frappe.form_dict[name]
|
return frappe.form_dict[name]
|
||||||
|
|||||||
@@ -31,6 +31,13 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-courses {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
padding: 5rem 0 5rem 0;
|
padding: 5rem 0 5rem 0;
|
||||||
}
|
}
|
||||||
@@ -40,11 +47,11 @@
|
|||||||
{% macro card(course) %}
|
{% macro card(course) %}
|
||||||
<div class="col-sm-4 mb-4 text-left">
|
<div class="col-sm-4 mb-4 text-left">
|
||||||
<a href="//courses/course?course={{course.name}}" class="no-decoration no-underline">
|
<a href="//courses/course?course={{course.name}}" class="no-decoration no-underline">
|
||||||
<div class="card h-100">
|
<div class="card h-100">
|
||||||
<div class='card-body'>
|
<div class='card-body'>
|
||||||
<h5 class='card-title'>{{ course.title }}</h5>
|
<h5 class='card-title'>{{ course.title }}</h5>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
@@ -52,16 +59,24 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class="row mt-5">
|
{% if frappe.session.user != "Guest" %}
|
||||||
{% for course in my_courses %}
|
{% for course in my_courses %}
|
||||||
{{ card(course) }}
|
{{ card(course) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if my_courses %}
|
{% if my_courses %}
|
||||||
{% for n in range( (3 - (my_courses|length)) %3) %}
|
{% for n in range( (3 - (my_courses|length)) %3) %}
|
||||||
{{ null_card() }}
|
{{ null_card() }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% 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>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user