Parcourir la source

[fix] error messages and minor fix in form_macros.html

version-14
Rushabh Mehta il y a 9 ans
Parent
révision
3efd898501
3 fichiers modifiés avec 13 ajouts et 10 suppressions
  1. +1
    -1
      frappe/patches.txt
  2. +11
    -8
      frappe/public/js/frappe/request.js
  3. +1
    -1
      frappe/templates/includes/form_macros.html

+ 1
- 1
frappe/patches.txt Voir le fichier

@@ -1,7 +1,7 @@
execute:frappe.db.sql("""update `tabPatch Log` set patch=replace(patch, '.4_0.', '.v4_0.')""") #2014-05-12 execute:frappe.db.sql("""update `tabPatch Log` set patch=replace(patch, '.4_0.', '.v4_0.')""") #2014-05-12
frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4 frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4
frappe.patches.v6_1.rename_file_data frappe.patches.v6_1.rename_file_data
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2016-06-15
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2016-07-08
execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2016-02-26 execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2016-02-26
execute:frappe.reload_doc('core', 'doctype', 'docperm') #2014-06-24 execute:frappe.reload_doc('core', 'doctype', 'docperm') #2014-06-24
execute:frappe.reload_doc('custom', 'doctype', 'custom_field') #2015-10-19 execute:frappe.reload_doc('custom', 'doctype', 'custom_field') #2015-10-19


+ 11
- 8
frappe/public/js/frappe/request.js Voir le fichier

@@ -67,11 +67,12 @@ frappe.request.call = function(opts) {
opts.success_callback && opts.success_callback(data, xhr.responseText); opts.success_callback && opts.success_callback(data, xhr.responseText);
}, },
401: function(xhr) { 401: function(xhr) {
msgprint(__("You have been logged out"));
msgprint({message:__("You have been logged out"), indicator: 'red'});
frappe.app.logout(); frappe.app.logout();
}, },
404: function(xhr) { 404: function(xhr) {
msgprint(__("Not found"));
msgprint({title:__("Not found"), indicator:'red',
message: __('The resource you are looking for is not available')});
}, },
403: function(xhr) { 403: function(xhr) {
if (xhr.responseJSON && xhr.responseJSON._server_messages) { if (xhr.responseJSON && xhr.responseJSON._server_messages) {
@@ -84,15 +85,17 @@ frappe.request.call = function(opts) {
} }


frappe.utils.play_sound("error"); frappe.utils.play_sound("error");
msgprint(__("Not permitted"));
msgprint({title:__("Not permitted"), indicator:'red',
message: __('You do not have enough permissions to access this resource. Please contact your manager to get access.')});
}, },
508: function(xhr) { 508: function(xhr) {
frappe.utils.play_sound("error"); frappe.utils.play_sound("error");
msgprint(__("Another transaction is blocking this one. Please try again in a few seconds."));
msgprint({title:__('Please try again'), indicator:'red',
message:__("Another transaction is blocking this one. Please try again in a few seconds.")});
}, },
413: function(data, xhr) { 413: function(data, xhr) {
msgprint(__("File size exceeded the maximum allowed size of {0} MB",
[(frappe.boot.max_file_size || 5242880) / 1048576]));
msgprint({indicator:'red', title:__('File too big'), message:__("File size exceeded the maximum allowed size of {0} MB",
[(frappe.boot.max_file_size || 5242880) / 1048576])});
}, },
417: function(xhr) { 417: function(xhr) {
var r = xhr.responseJSON; var r = xhr.responseJSON;
@@ -112,7 +115,7 @@ frappe.request.call = function(opts) {
}, },
500: function(xhr) { 500: function(xhr) {
frappe.utils.play_sound("error"); frappe.utils.play_sound("error");
msgprint(__("Server Error: Please check your server logs or contact tech support."))
msgprint({message:__("Server Error: Please check your server logs or contact tech support."), title:__('Something went wrong'), indicator: 'red'});
opts.error_callback && opts.error_callback(); opts.error_callback && opts.error_callback();
frappe.request.report_error(xhr, opts); frappe.request.report_error(xhr, opts);
}, },
@@ -304,7 +307,7 @@ frappe.request.report_error = function(xhr, request_opts) {


request_opts = frappe.request.cleanup_request_opts(request_opts); request_opts = frappe.request.cleanup_request_opts(request_opts);


var msg_dialog = msgprint(error_message);
var msg_dialog = msgprint({message:error_message, indicator:'red'});


msg_dialog.msg_area.find(".report-btn") msg_dialog.msg_area.find(".report-btn")
.toggle(error_report_email ? true : false) .toggle(error_report_email ? true : false)


+ 1
- 1
frappe/templates/includes/form_macros.html Voir le fichier

@@ -4,7 +4,7 @@
{{ key }}="{{ value }}" {% endfor %}{% endif %}> {{ key }}="{{ value }}" {% endfor %}{% endif %}>
{% if options -%} {% if options -%}
{% for option in options -%} {% for option in options -%}
{% set option_value = option.value if option is mapping else option %}
{% set option_value = option.value if option is missing else option %}
<option value="{{ option_value }}" <option value="{{ option_value }}"
{{ "selected" if value == option_value else "" }}>{{ _(option.label if option is mapping else option) }}</option> {{ "selected" if value == option_value else "" }}>{{ _(option.label if option is mapping else option) }}</option>
{%- endfor %} {%- endfor %}


Chargement…
Annuler
Enregistrer