@@ -180,7 +180,7 @@ def serve(port=8000, profile=False, site=None, sites_path='.'): | |||||
from werkzeug.serving import run_simple | from werkzeug.serving import run_simple | ||||
if profile: | if profile: | ||||
application = ProfilerMiddleware(application, sort_by=('tottime', 'calls')) | |||||
application = ProfilerMiddleware(application, sort_by=('cumtime', 'calls')) | |||||
if not os.environ.get('NO_STATICS'): | if not os.environ.get('NO_STATICS'): | ||||
application = SharedDataMiddleware(application, { | application = SharedDataMiddleware(application, { | ||||
@@ -77,6 +77,14 @@ frappe.get_abbr = function(txt, max_length) { | |||||
return abbr || "?"; | return abbr || "?"; | ||||
} | } | ||||
frappe.gravatars = {}; | |||||
frappe.get_gravatar = function(email_id) { | |||||
if(!frappe.gravatars[email_id]) { | |||||
frappe.gravatars[email_id] = "https://secure.gravatar.com/avatar/" + md5(email_id) + "?d=retro"; | |||||
} | |||||
return frappe.gravatars[email_id]; | |||||
} | |||||
// string commons | // string commons | ||||
function repl(s, dict) { | function repl(s, dict) { | ||||
@@ -29,15 +29,6 @@ frappe.user_info = function(uid) { | |||||
return user_info; | return user_info; | ||||
} | } | ||||
frappe.gravatars = {}; | |||||
frappe.get_gravatar = function(email_id) { | |||||
if(!frappe.gravatars[email_id]) { | |||||
frappe.gravatars[email_id] = "https://secure.gravatar.com/avatar/" + md5(email_id) + "?d=retro"; | |||||
} | |||||
return frappe.gravatars[email_id]; | |||||
} | |||||
frappe.ui.set_user_background = function(src, selector, style) { | frappe.ui.set_user_background = function(src, selector, style) { | ||||
if(!selector) selector = "#page-desktop"; | if(!selector) selector = "#page-desktop"; | ||||
if(!style) style = "Fill Screen"; | if(!style) style = "Fill Screen"; | ||||
@@ -19,7 +19,7 @@ | |||||
<a href="/me">My Account</a> | <a href="/me">My Account</a> | ||||
</li> | </li> | ||||
{% for item in my_account_list -%} | {% for item in my_account_list -%} | ||||
{% if item.count or (not item.reference_doctype) %} | |||||
{% if item.count or (not item.reference_doctype) or item.show_always %} | |||||
<li class="sidebar-item"> | <li class="sidebar-item"> | ||||
<a href="{{ item.route }}" class="text-muted {{ 'active' if pathname==item.route else '' }}" | <a href="{{ item.route }}" class="text-muted {{ 'active' if pathname==item.route else '' }}" | ||||
{% if item.target %}target="{{ item.target }}"{% endif %}> | {% if item.target %}target="{{ item.target }}"{% endif %}> | ||||
@@ -137,6 +137,9 @@ def has_gravatar(email): | |||||
except requests.exceptions.ConnectionError: | except requests.exceptions.ConnectionError: | ||||
return '' | return '' | ||||
def get_gravatar_url(email): | |||||
return "https://secure.gravatar.com/avatar/{hash}?d=mm&s=200".format(hash=md5.md5(email).hexdigest()) | |||||
def get_gravatar(email): | def get_gravatar(email): | ||||
gravatar_url = has_gravatar(email) | gravatar_url = has_gravatar(email) | ||||
@@ -95,7 +95,7 @@ def get_allowed_functions_for_jenv(): | |||||
"user": getattr(frappe.local, "session", None) and frappe.local.session.user or "Guest", | "user": getattr(frappe.local, "session", None) and frappe.local.session.user or "Guest", | ||||
"date_format": frappe.db.get_default("date_format") or "yyyy-mm-dd", | "date_format": frappe.db.get_default("date_format") or "yyyy-mm-dd", | ||||
"get_fullname": frappe.utils.get_fullname, | "get_fullname": frappe.utils.get_fullname, | ||||
"get_gravatar": frappe.utils.get_gravatar, | |||||
"get_gravatar": frappe.utils.get_gravatar_url, | |||||
"full_name": getattr(frappe.local, "session", None) and frappe.local.session.data.full_name or "Guest", | "full_name": getattr(frappe.local, "session", None) and frappe.local.session.data.full_name or "Guest", | ||||
"render_template": frappe.render_template | "render_template": frappe.render_template | ||||
}, | }, | ||||
@@ -85,7 +85,7 @@ def add_sidebar_data(context): | |||||
import frappe.templates.pages.list | import frappe.templates.pages.list | ||||
context.my_account_list = frappe.get_all('Portal Menu Item', | context.my_account_list = frappe.get_all('Portal Menu Item', | ||||
fields=['title', 'route', 'reference_doctype'], filters={'enabled': 1}, order_by='idx asc') | |||||
fields=['title', 'route', 'reference_doctype', 'show_always'], filters={'enabled': 1}, order_by='idx asc') | |||||
for item in context.my_account_list: | for item in context.my_account_list: | ||||
if item.reference_doctype: | if item.reference_doctype: | ||||