General text error + CSS styling

Minor merge conflict fix by theworldbright
This commit is contained in:
augier 2015-11-23 11:02:56 +01:00 committed by theworldbright
parent 10314ffc8c
commit ef7ea1a855
6 changed files with 35 additions and 6 deletions

View file

@ -13,6 +13,7 @@
@import "mobile/settings";
@import "mobile/stream_element";
@import "mobile/comments";
@import 'mobile/openid_connect_error_page';
@import 'typography';

View file

@ -0,0 +1,9 @@
.landing { margin: -56px -20px 10px; }
.api-error {
background-color: $light-grey;
box-shadow: $card-shadow;
margin-top: 20px;
h4 { text-align: center; }
}

View file

@ -177,7 +177,7 @@ module Api
if params[:client_id] && params[:redirect_uri]
handle_params_error_when_client_id_and_redirect_uri_exists(error, error_description)
else
render_error error_description
render_error I18n.t("api.openid_connect.error_page.could_not_authorize"), error_description
end
end
@ -186,7 +186,8 @@ module Api
if app && app.redirect_uris.include?(params[:redirect_uri])
redirect_prompt_error_display(error, error_description)
else
render_error "Invalid client id or redirect uri"
render_error I18n.t("api.openid_connect.error_page.could_not_authorize"),
"Invalid client id or redirect uri"
end
end
@ -239,10 +240,14 @@ module Api
redirect_to new_api_openid_connect_authorization_path(params)
end
def render_error(error_description)
def render_error(error_description, detailed_error=nil)
@error_description = error_description
render "api/openid_connect/error/error",
layout: request.format == :mobile ? "application" : "with_header_with_footer"
@detailed_error = detailed_error
if request.format == :mobile
render "api/openid_connect/error/error.mobile", layout: "application.mobile"
else
render "api/openid_connect/error/error", layout: "with_header_with_footer"
end
end
end
end

View file

@ -4,4 +4,8 @@
%h4
%b= t("api.openid_connect.error_page.title")
%div{id: "openid_connect_error_description"}
= @error_description
%p= @error_description
- unless @detailed_error.nil?
%p= t("api.openid_connect.error_page.contact_developer")
%pre= @detailed_error

View file

@ -1 +1,8 @@
.landing
%h1.session
= pod_name
= render partial: "api/openid_connect/error/error"
%footer
= link_to t("layouts.application.toggle"), toggle_mobile_path

View file

@ -919,6 +919,9 @@ en:
description: "This allows the application to send new posts, write conversations, and send reactions"
error_page:
title: "Oh! Something went wrong :("
contact_developer: "You should contact the developer of the application and include the following detailed message error:"
login_required: "You must first login before authorize this application"
could_not_authorize: "The application could not be authorized"
people:
zero: "No people"