feat: new-sign-up-form, request invite widget, request invite tests, get_sketches with owner

This commit is contained in:
pateljannat
2021-05-03 12:33:31 +05:30
parent cd1d2067ad
commit 565787eeb6
11 changed files with 124 additions and 38 deletions

View File

@@ -12,9 +12,7 @@
<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>
{{ widgets.RequestInvite() }}
</div>
</div>
</section>

View File

@@ -0,0 +1,19 @@
frappe.ready(() => {
$("#submit").click(function () {
frappe.call({
method: "community.lms.doctype.invite_request.invite_request.create_invite_request",
args: {
invite_email: $("#invite_email").val()
},
callback: (data) => {
if (data.message == "OK") {
$("#invite-request-form").hide();
var message = `<div>
<p class="lead">Thanks for your interest in Mon School. We have recorded your interest and we will get back to you shortly.</p>
</div>`;
$(".jumbotron").append(message);
}
}
})
})
})

View File

@@ -4,24 +4,29 @@
{% block page_content %}
<form id="reset-password">
<form id="new-sign-up">
<div class="form-group">
<input id="full_name" type="text" class="form-control" placeholder="{{ _('Full Name') }}" required>
<label for="full_name">Full Name:</label>
<input id="full_name" type="text" class="form-control" required>
</div>
<div class="form-group">
<input id="signup_email" type="email" class="form-control" placeholder="{{ _('Email') }}" required>
<label for="signup_email">Email:</label>
<input id="signup_email" type="email" class="form-control" required>
</div>
<div class="form-group">
<input id="username" type="text" class="form-control" placeholder="{{ _('Username') }}" required>
<label for="username">Username:</label>
<input id="username" type="text" class="form-control" required>
</div>
<div class="form-group">
<input id="password" type="password" class="form-control" placeholder="{{ _('Password') }}" required>
<label for="password">Password:</label>
<input id="password" type="password" class="form-control" required>
<span class="password-strength-indicator indicator"></span>
</div>
<p class='password-strength-message text-muted small hidden'></p>
<div class="form-group">
<input id="invite_code" type="text" class="form-control" placeholder="{{ _('Invite Code') }}" readonly required
<label for="invite_code">Invite Code:</label>
<input id="invite_code" type="text" class="form-control" readonly required
value="{{ frappe.form_dict['invite_code'] }}">
</div>
<button type="submit" id="submit" class="btn btn-primary">{{_("Submit")}}</button>

View File

@@ -4,13 +4,11 @@ from community.lms.models import Sketch
def get_context(context):
context.no_cache = 1
context.username = frappe.form_dict["username"]
print(frappe.form_dict["username"])
context.member = get_member(context.username)
print(context.member)
if not context.member:
context.template = "www/404.html"
else:
context.sketches = list(filter(lambda x: x.owner == context.member.email, Sketch.get_recent_sketches()))
context.sketches = Sketch.get_recent_sketches(context.member.email)
def get_member(username):
try: