@@ -1,5 +1,7 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
from . import __version__ as app_version | from . import __version__ as app_version | ||||
from frappe import _ | |||||
app_name = "frappe" | app_name = "frappe" | ||||
app_title = "Frappe Framework" | app_title = "Frappe Framework" | ||||
@@ -50,7 +52,18 @@ web_include_css = [ | |||||
] | ] | ||||
website_route_rules = [ | website_route_rules = [ | ||||
{"from_route": "/blog/<category>", "to_route": "Blog Post"}, | {"from_route": "/blog/<category>", "to_route": "Blog Post"}, | ||||
{"from_route": "/kb/<category>", "to_route": "Help Article"} | |||||
{"from_route": "/kb/<category>", "to_route": "Help Article"}, | |||||
{"from_route": "/newsletters", "to_route": "Newsletter"}, | |||||
{"from_route": "/newsletters/<path:name>", "to_route": "newsletters", | |||||
"defaults": { | |||||
"doctype": "Newsletter", | |||||
"parents": [{"label": _("Newsletter"), "route": "newsletters"}] | |||||
} | |||||
} | |||||
] | |||||
standard_portal_menu_items = [ | |||||
{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"} | |||||
] | ] | ||||
write_file_keys = ["file_url", "file_name"] | write_file_keys = ["file_url", "file_name"] | ||||
@@ -0,0 +1,15 @@ | |||||
<div class="web-list-item transaction-list-item"> | |||||
<a href = "/newsletters/{{doc.name}}/"> | |||||
<div class="row"> | |||||
<div class="col-sm-8 text-left bold"> | |||||
{{ doc.subject }} | |||||
</div> | |||||
<div class="col-sm-4"> | |||||
<div class="text-muted text-right" | |||||
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}"> | |||||
{{ frappe.utils.pretty_date(doc.modified) }} | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</a> | |||||
</div> |
@@ -0,0 +1,65 @@ | |||||
{% extends "templates/web.html" %} | |||||
{% block title %} {{ _("Newsletter") }} {% endblock %} | |||||
{% block page_content %} | |||||
<style> | |||||
.blog-container { | |||||
max-width: 720px; | |||||
margin: auto; | |||||
} | |||||
.blog-header { | |||||
font-weight: 700; | |||||
font-size: 1.5em; | |||||
} | |||||
.blog-info { | |||||
text-align:center; | |||||
margin-top: 30px; | |||||
} | |||||
.blog-text { | |||||
padding-top: 50px; | |||||
padding-bottom: 50px; | |||||
font-size: 15px; | |||||
line-height: 1.5; | |||||
} | |||||
.blog-text p { | |||||
margin-bottom: 30px; | |||||
} | |||||
</style> | |||||
<div class="blog-container"> | |||||
<article class="blog-content" itemscope> | |||||
<div class="blog-info"> | |||||
<h1 itemprop="headline" class="blog-header">{{ doc.subject }}</h1> | |||||
<p class="post-by text-muted"> | |||||
{{ frappe.format_date(doc.modified) }} | |||||
</p> | |||||
</div> | |||||
<div itemprop="articleBody" class="longform blog-text"> | |||||
{{ doc.message }} | |||||
</div> | |||||
</article> | |||||
{% if attachments %} | |||||
<div> | |||||
<div class="row text-muted"> | |||||
<div class="col-sm-12 h6 text-uppercase"> | |||||
{{ _("Attachments") }} | |||||
</div> | |||||
</div> | |||||
<div class="row"> | |||||
<div class="col-sm-12"> | |||||
{% for attachment in attachments %} | |||||
<p class="small"> | |||||
<a href="{{ attachment.file_url }}" target="blank"> | |||||
{{ attachment.file_name }} | |||||
</a> | |||||
</p> | |||||
{% endfor %} | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{% endif %} | |||||
</div> | |||||
{% endblock %} |
@@ -0,0 +1,18 @@ | |||||
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors | |||||
# License: GNU General Public License v3. See license.txt | |||||
from __future__ import unicode_literals | |||||
import frappe | |||||
from frappe import _ | |||||
def get_context(context): | |||||
context.no_cache = 1 | |||||
context.show_sidebar = True | |||||
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name) | |||||
context.attachments = get_attachments(frappe.form_dict.doctype, frappe.form_dict.name) | |||||
def get_attachments(dt, dn): | |||||
return frappe.get_all("File", | |||||
fields=["name", "file_name", "file_url", "is_private"], | |||||
filters = {"attached_to_name": dn, "attached_to_doctype": dt, "is_private":0}) |