浏览代码

Merge pull request #4054 from rmehta/fix-switch-to-desk

[fix] [translation] switch to desk, #3328
version-14
Rushabh Mehta 7 年前
committed by GitHub
父节点
当前提交
a3ff228dfd
共有 5 个文件被更改,包括 18 次插入7 次删除
  1. +7
    -2
      frappe/__init__.py
  2. +1
    -1
      frappe/app.py
  3. +1
    -0
      frappe/templates/includes/navbar/navbar_login.html
  4. +4
    -4
      frappe/website/js/website.js
  5. +5
    -0
      frappe/www/message.html

+ 7
- 2
frappe/__init__.py 查看文件

@@ -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



+ 1
- 1
frappe/app.py 查看文件

@@ -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:


+ 1
- 0
frappe/templates/includes/navbar/navbar_login.html 查看文件

@@ -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 %}


+ 4
- 4
frappe/website/js/website.js 查看文件

@@ -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();


+ 5
- 0
frappe/www/message.html 查看文件

@@ -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'>


正在加载...
取消
保存