From b3f87ba5b66f4959c6a74adfbb412fce37003aca Mon Sep 17 00:00:00 2001 From: pateljannat Date: Mon, 24 May 2021 10:39:04 +0530 Subject: [PATCH] fix: removed community course member and references to profile macro --- .../community_course_member/__init__.py | 0 .../community_course_member.js | 8 -- .../community_course_member.json | 96 ------------------- .../community_course_member.py | 52 ---------- .../templates/community_course_member.html | 25 ----- .../community_course_member_row.html | 4 - .../test_community_course_member.py | 10 -- community/www/dashboard/index.html | 29 ------ community/www/macros/profile.html | 10 -- community/www/profiles/profile.html | 1 - 10 files changed, 235 deletions(-) delete mode 100644 community/community/doctype/community_course_member/__init__.py delete mode 100644 community/community/doctype/community_course_member/community_course_member.js delete mode 100644 community/community/doctype/community_course_member/community_course_member.json delete mode 100644 community/community/doctype/community_course_member/community_course_member.py delete mode 100644 community/community/doctype/community_course_member/templates/community_course_member.html delete mode 100644 community/community/doctype/community_course_member/templates/community_course_member_row.html delete mode 100644 community/community/doctype/community_course_member/test_community_course_member.py delete mode 100644 community/www/macros/profile.html diff --git a/community/community/doctype/community_course_member/__init__.py b/community/community/doctype/community_course_member/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/community/community/doctype/community_course_member/community_course_member.js b/community/community/doctype/community_course_member/community_course_member.js deleted file mode 100644 index a01a2c7c..00000000 --- a/community/community/doctype/community_course_member/community_course_member.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Frappe and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Community Course Member', { - // refresh: function(frm) { - - // } -}); diff --git a/community/community/doctype/community_course_member/community_course_member.json b/community/community/doctype/community_course_member/community_course_member.json deleted file mode 100644 index f6853b54..00000000 --- a/community/community/doctype/community_course_member/community_course_member.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "actions": [], - "autoname": "field:user_name", - "creation": "2021-03-02 11:24:49.612530", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "enabled", - "full_name", - "user_name", - "email", - "short_intro", - "bio", - "photo", - "route" - ], - "fields": [ - { - "default": "1", - "fieldname": "enabled", - "fieldtype": "Check", - "label": "Enabled" - }, - { - "fieldname": "full_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Full Name", - "reqd": 1 - }, - { - "fieldname": "user_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "User Name", - "reqd": 1, - "unique": 1 - }, - { - "fieldname": "email", - "fieldtype": "Data", - "label": "Email", - "options": "Email", - "reqd": 1 - }, - { - "fieldname": "short_intro", - "fieldtype": "Data", - "label": "Short Intro" - }, - { - "fieldname": "bio", - "fieldtype": "Markdown Editor", - "label": "Bio" - }, - { - "fieldname": "photo", - "fieldtype": "Attach Image", - "label": "Photo" - }, - { - "fieldname": "route", - "fieldtype": "Data", - "label": "Route" - } - ], - "has_web_view": 1, - "index_web_pages_for_search": 1, - "is_published_field": "enabled", - "links": [], - "modified": "2021-04-06 11:50:41.551665", - "modified_by": "Administrator", - "module": "Community", - "name": "Community Course Member", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "route": "community-course-member", - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/community/community/doctype/community_course_member/community_course_member.py b/community/community/doctype/community_course_member/community_course_member.py deleted file mode 100644 index 8455178f..00000000 --- a/community/community/doctype/community_course_member/community_course_member.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -import re -from frappe.website.website_generator import WebsiteGenerator -from frappe import _ - -class CommunityCourseMember(WebsiteGenerator): - - def get_context(self, context): - context.abbr = ("").join([ s[0] for s in self.full_name.split() ]) - return context - - def validate(self): - self.validate_user_name() - if not self.route: - self.route = self.user_name - - def validate_user_name(self): - if len(self.user_name) < 4: - frappe.throw(_("Username must be atleast 4 characters long.")) - if not re.match("^[A-Za-z0-9_]*$", self.user_name): - frappe.throw(_("Username can only contain alphabets, numbers, and underscore.")) - self.user_name = self.user_name.lower() - - def after_insert(self): - if frappe.db.exists("User", self.email): - user = frappe.get_doc("User", self.email) - else: - user, update_password_link = self.create_user() - self.send_email(update_password_link) - - def send_email(self, update_password_link): - - args = { - 'update_password_link': update_password_link, - 'full_name': self.full_name, - } - - frappe.sendmail( - recipients=self.email, - sender="Administrator", - subject=_("Set your Password"), - template="community_course_membership", - reference_doctype=self.doctype, - reference_name=self.name, - send_priority=0, - queue_separately=True, - args=args) diff --git a/community/community/doctype/community_course_member/templates/community_course_member.html b/community/community/doctype/community_course_member/templates/community_course_member.html deleted file mode 100644 index fabec4d2..00000000 --- a/community/community/doctype/community_course_member/templates/community_course_member.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "templates/web.html" %} -{% block page_content %} -
- {% if photo %} -
- {{ full_name }} -
- {% else %} -
-
{{ abbr }}
-
- {% endif %} -
-

{{ full_name }}

- {% if short_intro %} -

{{ short_intro }}

- {% endif %} - {% if bio %} -

{{ frappe.utils.md_to_html(bio) }}

- {% endif %} -
-
-{% endblock %} - - \ No newline at end of file diff --git a/community/community/doctype/community_course_member/templates/community_course_member_row.html b/community/community/doctype/community_course_member/templates/community_course_member_row.html deleted file mode 100644 index 6444272c..00000000 --- a/community/community/doctype/community_course_member/templates/community_course_member_row.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{ doc.full_name }} -
- diff --git a/community/community/doctype/community_course_member/test_community_course_member.py b/community/community/doctype/community_course_member/test_community_course_member.py deleted file mode 100644 index 45422930..00000000 --- a/community/community/doctype/community_course_member/test_community_course_member.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Frappe and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestCommunityCourseMember(unittest.TestCase): - pass diff --git a/community/www/dashboard/index.html b/community/www/dashboard/index.html index 864ffcb4..7c2ecfc3 100644 --- a/community/www/dashboard/index.html +++ b/community/www/dashboard/index.html @@ -1,5 +1,4 @@ {% extends "templates/base.html" %} -{% from "www/macros/profile.html" import Profile %} {% block title %}{{ _("Community") }}{% endblock %} {% block head_include %} @@ -15,34 +14,6 @@ height: 200px; } - .dashboard__profile { - width: 150px; - height: 155px; - border-radius: 50%; - object-fit: contain; - } - - .dashboard__profileSmall { - width: 59px; - height: 57px; - border-radius: 50%; - object-fit: contain; - } - - .dashboard__abbr { - font-size: 50px; - width: 155px; - height: 155px; - border-radius: 50%; - } - - .dashboard__abbrSmall { - font-size: 20px; - width: 59px; - height: 57px; - border-radius: 50%; - } - .dashboard__parent { display: flex; } diff --git a/community/www/macros/profile.html b/community/www/macros/profile.html deleted file mode 100644 index c608b59f..00000000 --- a/community/www/macros/profile.html +++ /dev/null @@ -1,10 +0,0 @@ -{% macro Profile(photo, full_name, abbr, icon) %} -{% if photo %} -{{ full_name }} -{% else %} -
- {{ abbr }} -
-{% endif %} -{% endmacro %} \ No newline at end of file diff --git a/community/www/profiles/profile.html b/community/www/profiles/profile.html index 18f73e2a..d7f3daae 100644 --- a/community/www/profiles/profile.html +++ b/community/www/profiles/profile.html @@ -1,5 +1,4 @@ {% extends "templates/web.html" %} -{% from "www/macros/profile.html" import Profile %} {% block head_include %}