[fix] [translation] switch to desk, #3328
This commit is contained in:
parent
09404a7276
commit
faee27f773
5 changed files with 18 additions and 7 deletions
|
|
@ -1022,7 +1022,8 @@ def compare(val1, condition, val2):
|
|||
return frappe.utils.compare(val1, condition, val2)
|
||||
|
||||
def respond_as_web_page(title, html, success=None, http_status_code=None,
|
||||
context=None, indicator_color=None, primary_action='/', primary_label = None, fullpage=False):
|
||||
context=None, indicator_color=None, primary_action='/', primary_label = None, fullpage=False,
|
||||
width=None):
|
||||
"""Send response as a web page with a message rather than JSON. Used to show permission errors etc.
|
||||
|
||||
:param title: Page title and heading.
|
||||
|
|
@ -1033,7 +1034,9 @@ def respond_as_web_page(title, html, success=None, http_status_code=None,
|
|||
:param indicator_color: color of indicator in title
|
||||
:param primary_action: route on primary button (default is `/`)
|
||||
:param primary_label: label on primary button (defaut is "Home")
|
||||
:param fullpage: hide header / footer"""
|
||||
:param fullpage: hide header / footer
|
||||
:param width: Width of message in pixels
|
||||
"""
|
||||
local.message_title = title
|
||||
local.message = html
|
||||
local.response['type'] = 'page'
|
||||
|
|
@ -1057,6 +1060,8 @@ def respond_as_web_page(title, html, success=None, http_status_code=None,
|
|||
context['primary_action'] = primary_action
|
||||
context['error_code'] = http_status_code
|
||||
context['fullpage'] = fullpage
|
||||
if width:
|
||||
context['card_width'] = width
|
||||
|
||||
local.response['context'] = context
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ def handle_exception(e):
|
|||
|
||||
frappe.respond_as_web_page("Server Error",
|
||||
traceback, http_status_code=http_status_code,
|
||||
indicator_color='red')
|
||||
indicator_color='red', width=640)
|
||||
return_as_message = True
|
||||
|
||||
if e.__class__ == frappe.AuthenticationError:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
{%- endif -%}
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
<li class='switch-to-desk hidden'><a href="/desk">{{ _('Switch To Desk') }}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% if not hide_login %}
|
||||
|
|
|
|||
|
|
@ -322,6 +322,9 @@ $.extend(frappe, {
|
|||
},
|
||||
is_user_logged_in: function() {
|
||||
return window.full_name ? true : false;
|
||||
},
|
||||
add_switch_to_desk: function() {
|
||||
$('.switch-to-desk').removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -372,10 +375,7 @@ $(document).ready(function() {
|
|||
|
||||
// switch to app link
|
||||
if(getCookie("system_user")==="yes" && logged_in) {
|
||||
$("#website-post-login .dropdown-menu").append('<li><a href="/desk">'
|
||||
+__('Switch To Desk')+'</a></li>');
|
||||
$(".navbar-header .dropdown:not(.dropdown-submenu) > .dropdown-menu")
|
||||
.append('<li><a href="/desk">'+__('Switch To Desk')+'</a></li>');
|
||||
frappe.add_switch_to_desk();
|
||||
}
|
||||
|
||||
frappe.render_user();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ html, body {
|
|||
background-color: #f5f7fa;
|
||||
}
|
||||
{% endif %}
|
||||
{% if card_width %}
|
||||
.page-card {
|
||||
max-width: {{ card_width }}px;
|
||||
}
|
||||
{% endif %}
|
||||
</style>
|
||||
<div class='page-card'>
|
||||
<div class='page-card-head'>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue