diff --git a/community/hooks.py b/community/hooks.py index dff32fe2..7669e2fe 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -132,7 +132,9 @@ install_regex_converter() # Add all simple route rules here primary_rules = [ + {"from_route": "/sketches", "to_route": "sketches"}, {"from_route": "/sketches/", "to_route": "sketches/sketch"}, + {"from_route": "/courses", "to_route": "courses"}, {"from_route": "/courses/", "to_route": "courses/course"}, {"from_route": "/courses//", "to_route": "courses/topic"}, {"from_route": "/courses//", "to_route": "courses/topic"} diff --git a/community/lms/doctype/lms_sketch/lms_sketch.py b/community/lms/doctype/lms_sketch/lms_sketch.py index 21257e49..2f0120fe 100644 --- a/community/lms/doctype/lms_sketch/lms_sketch.py +++ b/community/lms/doctype/lms_sketch/lms_sketch.py @@ -13,6 +13,14 @@ class LMSSketch(Document): def get_owner_name(self): return get_userinfo(self.owner)['full_name'] + @property + def sketch_id(self): + """Returns the numeric part of the name. + + For example, the skech_id will be "123" for sketch with name "SKETCH-123". + """ + return self.name.replace("SKETCH-", "") + def get_livecode_url(self): doc = frappe.get_cached_doc("LMS Settings") return doc.livecode_url diff --git a/community/www/sketches/index.html b/community/www/sketches/index.html index 2a6381f0..dd1a61de 100644 --- a/community/www/sketches/index.html +++ b/community/www/sketches/index.html @@ -21,13 +21,13 @@