From e2072c72da6d01b3af90a85867471373917231ed Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 24 Aug 2021 12:12:55 +0530 Subject: [PATCH] fix: talk card schedule --- .../event_management/doctype/talk/talk.json | 6 +- .../talk_section/talk_section.html | 56 ++++++++++++++++--- community/hooks.py | 38 ++++++------- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/community/event_management/doctype/talk/talk.json b/community/event_management/doctype/talk/talk.json index 6966b079..36ecb39c 100644 --- a/community/event_management/doctype/talk/talk.json +++ b/community/event_management/doctype/talk/talk.json @@ -41,8 +41,8 @@ }, { "fieldname": "thumbnail", - "fieldtype": "Data", - "label": "Preview Image (Link)" + "fieldtype": "Attach", + "label": "Preview Image" }, { "fieldname": "event", @@ -113,7 +113,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-08-20 17:02:51.609288", + "modified": "2021-08-24 11:46:34.476903", "modified_by": "Administrator", "module": "Event Management", "name": "Talk", diff --git a/community/event_management/web_template/talk_section/talk_section.html b/community/event_management/web_template/talk_section/talk_section.html index 77e9f3c0..f6ababe3 100644 --- a/community/event_management/web_template/talk_section/talk_section.html +++ b/community/event_management/web_template/talk_section/talk_section.html @@ -4,24 +4,61 @@

{{ subtitle }}

{%- endif -%}
- {% for talk in talk_details %} - {% set talk_doc = frappe.db.get_value('Talk', talk.talk, ["title", "category", "speaker", "url", "thumbnail"], as_dict=True) %} - {% set speaker_info = frappe.db.get_value("Speaker", talk_doc.speaker, ["user"], as_dict=True) %} + {% for talk in talk_details %} + + {% set talk_doc = frappe.db.get_value('Talk', talk.talk, + ["title", "category", "speaker", "url", "thumbnail", "date", "start_time", "end_time"], as_dict=True) %} + {% set speaker_info = frappe.db.get_value("Speaker", talk_doc.speaker, ["user"], as_dict=True) %} {% set member = frappe.get_doc("User", speaker_info.user) %} + + {% if talk_doc.thumbnail %} + {% set thumbnail = talk_doc.thumbnail %} + {% else %} + {% set video_id = talk_doc.url and talk_doc.url.split("/")[-1] %} + {% set thumbnail = video_id and "https://img.youtube.com/vi/" + video_id + "/maxresdefault.jpg" %} + {% endif %} +
-
-
+
+
+ {% for tag in talk_doc.category.split(",") %} +
{{ tag }}
+ {% endfor %} +
+ {% if not thumbnail %} +
{{ talk_doc.title[0] }}
+ {% endif %}
-
- {{talk_doc.category}} -
+
{{talk_doc.title}}
+
+ {% if talk_doc.date %} + + + {{ frappe.utils.format_date(talk_doc.date, "medium") }} + + {% endif %} + + {% if talk_doc.start_time %} + + From: + {{ frappe.utils.format_time(talk_doc.start_time, "HH:mm") }} + + {% endif %} + {% if talk_doc.end_time %} + + To: + {{ frappe.utils.format_time(talk_doc.end_time, "HH:mm") }} + + {% endif %} + +
{{ widgets.Avatar(member=member, avatar_class="avatar-small")}} - {{ member.full_name }}
@@ -33,5 +70,6 @@
{% endfor %} +
diff --git a/community/hooks.py b/community/hooks.py index 7bb20ad0..4c5394f8 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -86,7 +86,7 @@ web_include_css = "community.bundle.css" override_doctype_class = { "User": "community.overrides.user.CustomUser", - "Web Template": "community.overrides.web_template.CustomWebTemplate" + "Web Template": "community.overrides.web_template.CustomWebTemplate" } # Document Events @@ -132,27 +132,27 @@ fixtures = ["Custom Field"] # Add all simple route rules here website_route_rules = [ - {"from_route": "/sketches/", "to_route": "sketches/sketch"}, - {"from_route": "/courses/", "to_route": "courses/course"}, - {"from_route": "/courses//", "to_route": "courses/topic"}, - {"from_route": "/hackathons/", "to_route": "hackathons/hackathon"}, - {"from_route": "/hackathons//", "to_route": "hackathons/project"}, - {"from_route": "/add-a-new-batch", "to_route": "add-a-new-batch"}, - {"from_route": "/courses//home", "to_route": "batch/home"}, - {"from_route": "/courses//learn", "to_route": "batch/learn"}, - {"from_route": "/courses//learn/.", "to_route": "batch/learn"}, - {"from_route": "/courses//schedule", "to_route": "batch/schedule"}, - {"from_route": "/courses//members", "to_route": "batch/members"}, - {"from_route": "/courses//discuss", "to_route": "batch/discuss"}, - {"from_route": "/courses//about", "to_route": "batch/about"}, - {"from_route": "/courses//progress", "to_route": "batch/progress"}, - {"from_route": "/courses//join", "to_route": "batch/join"}, - {"from_route": "/discussions/", "to_route": "discussions/discussion"}, - {"from_route": "/user/", "to_route": "profiles/profile"}, + {"from_route": "/sketches/", "to_route": "sketches/sketch"}, + {"from_route": "/courses/", "to_route": "courses/course"}, + {"from_route": "/courses//", "to_route": "courses/topic"}, + {"from_route": "/hackathons/", "to_route": "hackathons/hackathon"}, + {"from_route": "/hackathons//", "to_route": "hackathons/project"}, + {"from_route": "/add-a-new-batch", "to_route": "add-a-new-batch"}, + {"from_route": "/courses//home", "to_route": "batch/home"}, + {"from_route": "/courses//learn", "to_route": "batch/learn"}, + {"from_route": "/courses//learn/.", "to_route": "batch/learn"}, + {"from_route": "/courses//schedule", "to_route": "batch/schedule"}, + {"from_route": "/courses//members", "to_route": "batch/members"}, + {"from_route": "/courses//discuss", "to_route": "batch/discuss"}, + {"from_route": "/courses//about", "to_route": "batch/about"}, + {"from_route": "/courses//progress", "to_route": "batch/progress"}, + {"from_route": "/courses//join", "to_route": "batch/join"}, + {"from_route": "/discussions/", "to_route": "discussions/discussion"}, + {"from_route": "/user/", "to_route": "profiles/profile"}, ] website_redirects = [ - {"source": "/update-profile", "target": "/edit-profile"}, + {"source": "/update-profile", "target": "/edit-profile"}, ] update_website_context = 'community.widgets.update_website_context'