diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4b3fda052..acbfdd4d9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -46,7 +46,7 @@ class ApplicationController < ActionController::Base def render_403(style = 'danger') respond_to do |format| format.html do - render file: 'public/403.html', status: :forbidden, layout: false + render 'errors/403', status: :forbidden, layout: false end format.json do render json: { style: style }, status: :forbidden @@ -60,7 +60,7 @@ class ApplicationController < ActionController::Base def render_404 respond_to do |format| format.html do - render file: 'public/404.html', status: :not_found, layout: false + render 'errors/404', status: :not_found, layout: false end format.json do render json: {}, status: :not_found @@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base def render_422(message = t('client_api.permission_error')) respond_to do |format| format.html do - render file: 'public/422.html', status: :unprocessable_entity, layout: false + render 'errors/422', status: :unprocessable_entity, layout: false end format.json do render json: { message: message }, status: :unprocessable_entity diff --git a/app/views/errors/403.html.erb b/app/views/errors/403.html.erb new file mode 100644 index 000000000..2152c64b4 --- /dev/null +++ b/app/views/errors/403.html.erb @@ -0,0 +1,118 @@ + + + + <%= t("errors.forbidden.title") %> + + + + + + +
+ +

<%= t("errors.forbidden.dialog.title") %>

+

<%= t("errors.forbidden.dialog.text") %>

+ + + + <%= t("errors.forbidden.dialog.button") %> + +
+ + diff --git a/app/views/errors/404.html.erb b/app/views/errors/404.html.erb new file mode 100644 index 000000000..4721396d1 --- /dev/null +++ b/app/views/errors/404.html.erb @@ -0,0 +1,81 @@ + + + + <%= t("errors.not_found.title") %> + + + + + + +
+ +

<%= t("errors.not_found.dialog.title") %>

+

<%= t("errors.not_found.dialog.text_1") %>

+

<%= t("errors.not_found.dialog.text_2_html", home_url: root_url, search_url: new_search_url) %>

+
+ + diff --git a/app/views/errors/422.html.erb b/app/views/errors/422.html.erb new file mode 100644 index 000000000..fa8fde02f --- /dev/null +++ b/app/views/errors/422.html.erb @@ -0,0 +1,80 @@ + + + + <%= t("errors.unprocessable_entity.title") %> + + + + + + +
+ +

<%= t("errors.unprocessable_entity.dialog.title") %>

+

<%= t("errors.unprocessable_entity.dialog.text") %>

+
+ + diff --git a/config/locales/en.yml b/config/locales/en.yml index a163773e4..385ff2c81 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3759,3 +3759,24 @@ en: canvas_view: "Canvas view" active_state: "Active state" archived_state: "Archived state" + + errors: + forbidden: + title: "Access to this page is denied (403)." + dialog: + title: "It would seem that you are not allowed in here." + text: "You should request access from your team administrators." + button: "Go back" + not_found: + title: "This page could not be found (404)." + dialog: + title: "This page could not be found (404)." + text_1: "You may have mistyped the address or the page may have moved." + text_2_html: | + "If you are the application owner check the logs for more information. + You can go back to home page or try searching." + unprocessable_entity: + title: "The change you wanted was rejected (422)." + dialog: + title: "Ooops, something went wrong." + text: "Please contact your SciNote administrator."