From a52a01ef7fd8cfd9f08fe635fb49663a2013802b Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Mon, 3 May 2021 06:06:35 +0530 Subject: [PATCH] feat: Added chapter doctype Also linked it from the LMS Course doctype. Issue #56 --- community/lms/doctype/chapter/__init__.py | 0 community/lms/doctype/chapter/chapter.js | 8 +++ community/lms/doctype/chapter/chapter.json | 65 +++++++++++++++++++ community/lms/doctype/chapter/chapter.py | 10 +++ community/lms/doctype/chapter/test_chapter.py | 10 +++ .../lms/doctype/lms_course/lms_course.json | 6 +- 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 community/lms/doctype/chapter/__init__.py create mode 100644 community/lms/doctype/chapter/chapter.js create mode 100644 community/lms/doctype/chapter/chapter.json create mode 100644 community/lms/doctype/chapter/chapter.py create mode 100644 community/lms/doctype/chapter/test_chapter.py diff --git a/community/lms/doctype/chapter/__init__.py b/community/lms/doctype/chapter/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/community/lms/doctype/chapter/chapter.js b/community/lms/doctype/chapter/chapter.js new file mode 100644 index 00000000..9380a622 --- /dev/null +++ b/community/lms/doctype/chapter/chapter.js @@ -0,0 +1,8 @@ +// Copyright (c) 2021, FOSS United and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Chapter', { + // refresh: function(frm) { + + // } +}); diff --git a/community/lms/doctype/chapter/chapter.json b/community/lms/doctype/chapter/chapter.json new file mode 100644 index 00000000..2744ca48 --- /dev/null +++ b/community/lms/doctype/chapter/chapter.json @@ -0,0 +1,65 @@ +{ + "actions": [], + "creation": "2021-05-03 05:49:08.383057", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "course", + "title", + "description", + "locked" + ], + "fields": [ + { + "fieldname": "title", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Title" + }, + { + "fieldname": "description", + "fieldtype": "Markdown Editor", + "label": "Description" + }, + { + "default": "0", + "fieldname": "locked", + "fieldtype": "Check", + "label": "Locked" + }, + { + "fieldname": "course", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Course", + "options": "LMS Course" + } + ], + "index_web_pages_for_search": 1, + "links": [], + "modified": "2021-05-03 05:57:39.715802", + "modified_by": "Administrator", + "module": "LMS", + "name": "Chapter", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "search_fields": "title", + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "title", + "track_changes": 1 +} \ No newline at end of file diff --git a/community/lms/doctype/chapter/chapter.py b/community/lms/doctype/chapter/chapter.py new file mode 100644 index 00000000..233b0712 --- /dev/null +++ b/community/lms/doctype/chapter/chapter.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, FOSS United and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class Chapter(Document): + pass diff --git a/community/lms/doctype/chapter/test_chapter.py b/community/lms/doctype/chapter/test_chapter.py new file mode 100644 index 00000000..444f741f --- /dev/null +++ b/community/lms/doctype/chapter/test_chapter.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2021, FOSS United and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestChapter(unittest.TestCase): + pass diff --git a/community/lms/doctype/lms_course/lms_course.json b/community/lms/doctype/lms_course/lms_course.json index abad6a04..0c104240 100644 --- a/community/lms/doctype/lms_course/lms_course.json +++ b/community/lms/doctype/lms_course/lms_course.json @@ -74,8 +74,8 @@ "is_published_field": "is_published", "links": [ { - "group": "Topics", - "link_doctype": "LMS Topic", + "group": "Chapters", + "link_doctype": "Chapter", "link_fieldname": "course" }, { @@ -89,7 +89,7 @@ "link_fieldname": "course" } ], - "modified": "2021-04-21 14:45:41.658056", + "modified": "2021-05-03 05:52:30.396824", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course",