feat: new fields in user doctype and new web form

This commit is contained in:
pateljannat
2021-06-30 16:16:22 +05:30
parent 60c1449f40
commit ee8273fd30
9 changed files with 262 additions and 26 deletions

View File

@@ -0,0 +1,108 @@
[
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "User",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "linkedin",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "mobile_no",
"label": "LinkedIn ID",
"length": 0,
"mandatory_depends_on": null,
"modified": "2021-06-30 14:46:55.834145",
"name": "User-linkedin",
"no_copy": 0,
"non_negative": 0,
"options": null,
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"doctype": "Custom Field",
"dt": "User",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "github",
"fieldtype": "Data",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "linkedin",
"label": "Github ID",
"length": 0,
"mandatory_depends_on": null,
"modified": "2021-06-30 14:46:55.834145",
"name": "User-github",
"no_copy": 0,
"non_negative": 0,
"options": null,
"parent": null,
"parentfield": null,
"parenttype": null,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
}
]

View File

@@ -104,6 +104,8 @@ doc_events = {
# ]
#}
fixtures = ["Custom Field"]
# Testing
# -------
@@ -166,7 +168,7 @@ whitelist = [
"/new-sign-up",
"/message",
"/about",
"/lms-course-review"
"/review"
]
whitelist_rules = [{"from_route": p, "to_route": p[1:]} for p in whitelist]

View File

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

View File

@@ -0,0 +1,125 @@
{
"accept_payment": 0,
"allow_comments": 0,
"allow_delete": 0,
"allow_edit": 1,
"allow_incomplete": 0,
"allow_multiple": 0,
"allow_print": 0,
"amount": 0.0,
"amount_based_on_field": 0,
"apply_document_permissions": 0,
"breadcrumbs": "",
"button_label": "Save",
"creation": "2021-06-30 13:48:13.682851",
"doc_type": "User",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2021-06-30 15:53:20.967466",
"modified_by": "Administrator",
"module": "LMS",
"name": "profile",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 1,
"route": "profile",
"route_to_success_link": 0,
"show_attachments": 0,
"show_in_grid": 0,
"show_sidebar": 0,
"sidebar_items": [],
"success_url": "/profile",
"title": "Profile",
"web_form_fields": [
{
"allow_read_on_all_link_options": 0,
"fieldname": "first_name",
"fieldtype": "Data",
"hidden": 0,
"label": "First Name",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "middle_name",
"fieldtype": "Data",
"hidden": 0,
"label": "Middle Name (Optional)",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "last_name",
"fieldtype": "Data",
"hidden": 0,
"label": "Last Name",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"description": "Get your globally recognized avatar from Gravatar.com",
"fieldname": "user_image",
"fieldtype": "Attach Image",
"hidden": 0,
"label": "User Image",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "username",
"fieldtype": "Data",
"hidden": 0,
"label": "Username",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "mobile_no",
"fieldtype": "Data",
"hidden": 0,
"label": "Mobile No",
"max_length": 0,
"max_value": 0,
"options": "Phone",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "bio",
"fieldtype": "Small Text",
"hidden": 0,
"label": "Bio",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
}
]
}

View File

@@ -0,0 +1,5 @@
import frappe
def get_context(context):
# do your magic here
pass

View File

@@ -7,7 +7,7 @@
</a>
{% endif %}
</div>
<div>
<div class="cards-parent">
{% for review in course.get_reviews() %}
<div class="common-card-style review-card">
<div class="review-content"> {{ review.review }} </div>
@@ -19,7 +19,7 @@
{{ course.get_instructor().full_name }}
</span>
</div>
<div class="rating pull-right">
<div class="rating">
{% for i in [1, 2, 3, 4, 5] %}
<svg class="icon icon-md {% if i <= review.rating %} star-click {% endif %}" data-rating="{{ i }}">
<use href="#icon-star"></use>

View File

@@ -297,6 +297,7 @@ input[type=checkbox] {
background: #FFFFFF;
border-radius: 8px;
box-shadow: 0px 5px 10px rgb(0 0 0 / 10%);
position: relative;
}
.course-card {
@@ -375,7 +376,7 @@ input[type=checkbox] {
color: var(--text-color);
}
.course-cards-parent {
.cards-parent {
display: flex;
flex-wrap: wrap;
}
@@ -386,13 +387,8 @@ input[type=checkbox] {
}
}
.course-divider {
border: 1px solid #E2E6E9;
margin: 16px 0px 30px;
}
.courses-header {
padding: 50px 0px 20px;
padding: 50px 30px 20px;
color: var(--text-color);
font-weight: 600;
font-size: 22px;
@@ -448,8 +444,8 @@ input[type=checkbox] {
}
.review-card {
width: 300px;
height: 200px;
width: 100%;
height: fit-content;
margin: 0px 16px 32px;
padding: 16px;
}
@@ -457,7 +453,6 @@ input[type=checkbox] {
.review-card-footer {
width: 100%;
display: flex;
justify-content: space-between;
}
.review-content {

View File

@@ -15,8 +15,7 @@
<div class="courses-header">
{{ 'All Courses' }}
</div>
<div class="course-divider"></div>
<div class="course-cards-parent">
<div class="cards-parent">
{% for course in courses %}
{{ course_card(course) }}
{% endfor %}
@@ -66,18 +65,17 @@
</span>
{% endif %}
</div>
<a class="button-links" href="/courses/{{ course.name }}">
{% if course.get_membership(frappe.session.user) %}
<div class="view-course-link is-primary">
Continue Course <img class="ml-3" src="/assets/community/icons/white-arrow.svg" />
</div>
{% else %}
<div class="view-course-link">
View Course <img class="ml-3" src="/assets/community/icons/black-arrow.svg" />
</div>
{% endif %}
</a>
{% if course.get_membership(frappe.session.user) %}
<div class="view-course-link is-primary">
Continue Course <img class="ml-3" src="/assets/community/icons/white-arrow.svg" />
</div>
{% else %}
<div class="view-course-link">
View Course <img class="ml-3" src="/assets/community/icons/black-arrow.svg" />
</div>
{% endif %}
</div>
<a class="stretched-link" href="/courses/{{ course.name }}"></a>
</div>
{% endmacro %}