Skip to content

Commit

Permalink
LTI-341: show default error msg if translation is missing (#304)
Browse files Browse the repository at this point in the history
* LTI-341: show default error msg if translation is missing

* replace tab indentation with 2 spaces

---------

Co-authored-by: Jesus Federico <[email protected]>
  • Loading branch information
Mariam05 and jfedericobn authored May 9, 2024
1 parent 08f5fee commit dc65e20
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 deletions.
Binary file added app/assets/images/favicon.ico
Binary file not shown.
7 changes: 6 additions & 1 deletion app/controllers/rooms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ def individual_recording

def set_error(error, status, domain = 'room')
@room = @user = nil
@error = { key: t("error.#{domain}.#{error}.code"), message: t("error.#{domain}.#{error}.message"), suggestion: t("error.#{domain}.#{error}.suggestion"), status: status }
@error = {
key: t("error.#{domain}.#{error}.code", default: t("error.#{domain}.default.code")),
message: t("error.#{domain}.#{error}.message", default: t("error.#{domain}.default.message")),
suggestion: t("error.#{domain}.#{error}.suggestion", default: t("error.#{domain}.default.suggestion")),
status: status,
}
end

def authenticate_user!
Expand Down
1 change: 1 addition & 0 deletions app/javascript/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

@import 'rooms';
@import 'errors';
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
Expand Down
9 changes: 9 additions & 0 deletions app/javascript/stylesheets/errors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@
// Place all the styles related to the errors controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.error-code {
font-size: 8rem;
color: #263f88;
}

.error-message {
font-size: 2rem;
}
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= favicon_link_tag asset_path('favicon.ico') %>
</head>

<body lang="<%= I18n.locale %>"
Expand Down
51 changes: 26 additions & 25 deletions app/views/shared/_error.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
%>

<head>
<style>
.error-code {
font-size: 8rem;
color: #263f88;
}

.error-message {
font-size: 2rem;
}
</style>
</head>
<div class="text-center" style="margin-top: 8%">
<h2 class= "error-code">
<%= code %> <br>
</h2>
<div class="error-message font-extrabold">
<span class="sr-only"><%= message %></span><%= message %>
</div>
<div>
<% if suggestion %>
<%= suggestion %>
<% end %>
</div>
</div>
<div class="container bg-white">
<div class = "row">
<div class ="flex items-start mt-20 mr-10 mb-10 ">
<img style ="top:50%" alt="" src="">
</div>
</div>
<div class="row">
<div class = "bg-gray-200 grid justify-items-center grid-cols-1 gap-10 p-20 pt-40 pb-40" >
<div class="text-center">
<% if code %>
<h2 class= "error-code">
<%= code %> <br>
</h2>
<% end %>
<div class="error-message font-extrabold">
<span class="sr-only"><%= message %></span><%= message %>
</div>
<div>
<% if suggestion %>
<%= suggestion %>
<% end %>
</div>
</div>
</div>
</div>
</div>
8 changes: 8 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ en:
message: "Unreachable resource"
suggestion: "It seems that you are trying to access this resource using an LTI endpoint that is no longer supported. Try updating the endpoint o credentials for the external tool"
bigbluebutton:
default:
code: "BigBlueButton error"
message: "BigBlueButton encountered an error"
suggestion: "Please try again later or contact technical support if the issue persists"
invalidrequest:
code: "BBBAPICallInvalid"
message: "BBB API call invalid"
Expand All @@ -191,6 +195,10 @@ en:
message: "Connection error. Your URL is probably incorrect"
suggestion: "Make sure that the BBB credentials are configured correctly"
room:
default:
code: "Error"
message: "An unexpected error occured"
suggestion: "Please try again later or contact technical support if the issue persists"
forbidden:
code: "AccessForbidden"
message: "The session has expired"
Expand Down

0 comments on commit dc65e20

Please sign in to comment.