fix: removed unused form add messages, changed url for new batch form in course.html, changed get_recent_sketch to have an owner filter

This commit is contained in:
pateljannat
2021-05-03 15:57:00 +05:30
parent cf68d3127c
commit 2139bddf01
6 changed files with 4 additions and 100 deletions

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,77 +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": "Send",
"client_script": "",
"creation": "2021-03-23 13:10:16.814983",
"doc_type": "LMS Message",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2021-03-23 19:25:54.984968",
"modified_by": "Administrator",
"module": "LMS",
"name": "add-messages",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 0,
"route": "add-messages",
"route_to_success_link": 0,
"show_attachments": 0,
"show_in_grid": 0,
"show_sidebar": 0,
"sidebar_items": [],
"success_url": "",
"title": "Add Messages",
"web_form_fields": [
{
"allow_read_on_all_link_options": 0,
"fieldname": "batch",
"fieldtype": "Link",
"hidden": 0,
"label": "Batch",
"max_length": 0,
"max_value": 0,
"options": "LMS Batch",
"read_only": 1,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "message",
"fieldtype": "Data",
"hidden": 0,
"label": "Message",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "author",
"fieldtype": "Link",
"hidden": 1,
"label": "Author",
"max_length": 0,
"max_value": 0,
"options": "Community Member",
"read_only": 1,
"reqd": 0,
"show_in_filter": 0
}
]
}

View File

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

View File

@@ -111,11 +111,11 @@
{% 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>
<a class="btn btn-primary add-batch margin-bottom" href="/add-a-new-batch?new=1&course={{course.title}}">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>
<a class="btn btn-primary" href="/add-a-new-batch?new=1&course={{course.title}}" >Create your first batch</a>
</div>
{% endif %}
{% endmacro %}

View File

@@ -1,5 +1,5 @@
import frappe
from ...lms.doctype.lms_sketch.lms_sketch import get_recent_sketches
from community.lms.models import Sketch
def get_context(context):
context.no_cache = 1
@@ -8,7 +8,7 @@ def get_context(context):
if not context.member:
context.template = "www/404.html"
else:
context.sketches = list(filter(lambda x: x.owner == context.member.email, get_recent_sketches()))
context.sketches = Sketch.get_recent_sketches(context.member.email)
def get_member(username):
try: