mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:16:53 +00:00
refactor/Speed up the page introduction.html
This commit is contained in:
parent
e4288d3f19
commit
bbc26f8bbb
@ -31,6 +31,7 @@ import code.api.OpenIdConnectConfig
|
||||
import code.api.util.{APIUtil, CustomJsonFormats}
|
||||
import code.model.dataAccess.{Admin, AuthUser}
|
||||
import code.snippet.OpenidConnectInvoke.openIDConnect1IsNotSet
|
||||
import code.util.Helper
|
||||
import net.liftweb.http.{S, SHtml}
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.CssSel
|
||||
@ -62,6 +63,7 @@ class Login {
|
||||
if(AuthUser.loggedIn_?){
|
||||
"*" #> NodeSeq.Empty
|
||||
} else {
|
||||
"#logon *" #> scala.xml.Unparsed(Helper.i18n("logon", Some("Log on"))) &
|
||||
".login [href]" #> AuthUser.loginPageURL &
|
||||
".forgot [href]" #> {
|
||||
val href = for {
|
||||
|
||||
@ -35,6 +35,7 @@ import code.api.util.APIUtil.{activeBrand, getRemoteIpAddress, getServerUrl}
|
||||
import code.api.util.ApiRole.CanReadGlossary
|
||||
import code.api.util.{APIUtil, ApiRole, CustomJsonFormats, ErrorMessages, I18NUtil, PegdownOptions}
|
||||
import code.model.dataAccess.AuthUser
|
||||
import code.util.Helper
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.http.{LiftRules, S, SessionVar}
|
||||
import net.liftweb.util.Helpers._
|
||||
@ -464,7 +465,8 @@ class WebUI extends MdcLoggable{
|
||||
"@for-banks [style]" #> s"display: $displayForBanks"
|
||||
}
|
||||
def userIsLoggedIn: CssSel = {
|
||||
"#register-link [href]" #> scala.xml.Unparsed(s"/already-logged-in")
|
||||
"#register-link [href]" #> scala.xml.Unparsed(s"/already-logged-in") &
|
||||
"#register-link *" #> scala.xml.Unparsed(Helper.i18n("register", Some("Register")))
|
||||
}
|
||||
|
||||
def alreadyLoggedIn: CssSel = {
|
||||
|
||||
76
obp-api/src/main/scala/code/snippet/WebUiTranslation.scala
Normal file
76
obp-api/src/main/scala/code/snippet/WebUiTranslation.scala
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
Open Bank Project - API
|
||||
Copyright (C) 2011-2019, TESOBE GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Email: contact@tesobe.com
|
||||
TESOBE GmbH
|
||||
Osloerstrasse 16/17
|
||||
Berlin 13359, Germany
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
package code.snippet
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.util.Helper
|
||||
import code.util.Helper.MdcLoggable
|
||||
import net.liftweb.http.S
|
||||
import net.liftweb.util.CssSel
|
||||
import net.liftweb.util.Helpers._
|
||||
|
||||
|
||||
class WebUiTranslation extends MdcLoggable {
|
||||
|
||||
@transient protected val log = logger //Logger(this.getClass)
|
||||
|
||||
def apiExplorer: CssSel = {
|
||||
"#api_explorer *" #> scala.xml.Unparsed(Helper.i18n("api_explorer", Some("API Explorer")))
|
||||
}
|
||||
def introduction: CssSel = {
|
||||
"#introduction *" #> scala.xml.Unparsed(Helper.i18n("introduction", Some("Introduction")))
|
||||
}
|
||||
def support: CssSel = {
|
||||
"#support *" #> scala.xml.Unparsed(Helper.i18n("support", Some("Support")))
|
||||
}
|
||||
def apiHost: CssSel = {
|
||||
"#api_host *" #> scala.xml.Unparsed(Helper.i18n("api_host", Some("This API Host")))
|
||||
}
|
||||
def openBankProjectIs: CssSel = {
|
||||
val year = APIUtil.currentYear
|
||||
val text = s"${Helper.i18n("open_bank_project_is", Some("Open Bank Project is ©2011 - "))} $year"
|
||||
"#open_bank_project_is *" #> scala.xml.Unparsed(text)
|
||||
}
|
||||
def andCommercialLicenses: CssSel = {
|
||||
"#and_commercial_licenses *" #> scala.xml.Unparsed(Helper.i18n("and_commercial_licenses", Some("TESOBE and distributed under the AGPL and commercial licenses. ")))
|
||||
}
|
||||
def termsConditions: CssSel = {
|
||||
"#terms_conditions *" #> scala.xml.Unparsed(Helper.i18n("terms_conditions", Some("Terms and Conditions")))
|
||||
}
|
||||
def privacyPolicy: CssSel = {
|
||||
"#privacy_policy *" #> scala.xml.Unparsed(Helper.i18n("privacy_policy", Some("Privacy Policy")))
|
||||
}
|
||||
def apiDocumentation: CssSel = {
|
||||
"#api_documentation *" #> scala.xml.Unparsed(Helper.i18n("api_documentation", Some("Privacy Policy")))
|
||||
}
|
||||
def register: CssSel = {
|
||||
"#register *" #> scala.xml.Unparsed(Helper.i18n("register", Some("Register")))
|
||||
}
|
||||
|
||||
}
|
||||
@ -381,7 +381,8 @@ object Helper{
|
||||
}
|
||||
|
||||
def i18n(message: String, default: Option[String] = None): String = {
|
||||
if(S.?(message)==message) {
|
||||
val translatedMessage = S.?(message)
|
||||
if(translatedMessage==message) {
|
||||
val words = message.split('.').toList match {
|
||||
case x :: Nil => Helpers.capify(x) :: Nil
|
||||
case x :: xs => Helpers.capify(x) :: xs
|
||||
@ -389,7 +390,7 @@ object Helper{
|
||||
}
|
||||
default.getOrElse(words.mkString(" ") + ".")
|
||||
}
|
||||
else S.?(message)
|
||||
else translatedMessage
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -114,7 +114,7 @@ Berlin 13359, Germany
|
||||
</li>
|
||||
<li class="navitem">
|
||||
<a class="navlink api-explorer-link" data-lift="WebUI.apiExplorerLink" href="">
|
||||
<lift:loc locid="api_explorer">API Explorer</lift:loc>
|
||||
<p data-lift="WebUiTranslation.apiExplorer" id="api_explorer">API Explorer</p>
|
||||
</a>
|
||||
</li>
|
||||
<li data-lift="Nav.item?name=Consumer%20Registration&showEvenIfRestricted=true" class="navitem">
|
||||
@ -122,12 +122,12 @@ Berlin 13359, Germany
|
||||
</li>
|
||||
<li class="navitem">
|
||||
<a class="navlink" id="sandbox-introduction-link" data-lift="WebUI.sandboxIntroductionLink" href="">
|
||||
<lift:loc locid="introduction">Introduction</lift:loc>
|
||||
<p data-lift="WebUiTranslation.introduction" id="introduction">Introduction</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="navitem">
|
||||
<a class="navlink" id="technical-faqs-anchor" data-lift="WebUI.technicalFaqsAnchor" href="">
|
||||
<lift:loc locid="support">Support</lift:loc>
|
||||
<p data-lift="WebUiTranslation.support" id="support">Support</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -136,7 +136,7 @@ Berlin 13359, Germany
|
||||
<li data-lift="Nav.item?name=Login" class="navitem">
|
||||
<!-- LOGGED OUT -->
|
||||
<p data-lift="WebUI.userIsLoggedIn">
|
||||
<a href="/user_mgt/sign_up" class="navbar-btn" id ="register-link"><lift:loc locid="register">Register</lift:loc></a><a data-lift="Login.loggedOut" href="#" class="btn btn-danger login"><lift:loc locid="logon">Log on</lift:loc></a>
|
||||
<a href="/user_mgt/sign_up" class="navbar-btn" id ="register-link">Register</a><a id="logon" data-lift="Login.loggedOut" href="#" class="btn btn-danger login">Log on</a>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
@ -170,7 +170,9 @@ Berlin 13359, Germany
|
||||
<ul>
|
||||
<li>
|
||||
<div class="navitem">
|
||||
<a class="navlink api-explorer-link" data-lift="WebUI.apiExplorerLink" href="">API Explorer</a>
|
||||
<a class="navlink api-explorer-link" data-lift="WebUI.apiExplorerLink" href="">
|
||||
<p data-lift="WebUiTranslation.apiExplorer" id="api_explorer">API Explorer</p>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
@ -180,13 +182,15 @@ Berlin 13359, Germany
|
||||
</li>
|
||||
<li>
|
||||
<div class="navitem">
|
||||
<a class="navlink" id="sandbox-introduction-link" data-lift="WebUI.sandboxIntroductionLink" href="">Introduction</a>
|
||||
<a class="navlink" id="sandbox-introduction-link" data-lift="WebUI.sandboxIntroductionLink" href="">
|
||||
<p data-lift="WebUiTranslation.introduction" id="introduction">Introduction</p>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="navitem" id="technical-faqs-anchor-nav">
|
||||
<a class="navlink" id="technical-faqs-anchor" data-lift="WebUI.technicalFaqsAnchor" href="">
|
||||
<lift:loc locid="support">Support</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.support" id="support">Support</p></a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
@ -208,11 +212,13 @@ Berlin 13359, Germany
|
||||
<ul>
|
||||
<li>
|
||||
<a class="termsAndConditions-link" data-lift="WebUI.termsAndConditions" href="">
|
||||
<lift:loc locid="terms_conditions">Terms and Conditions</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.termsConditions" id="terms_conditions">Terms and Conditions</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="privacy-policy-link" data-lift="WebUI.privacyPolicyLink" href="https://openbankproject.com/privacy-policy">
|
||||
<lift:loc locid="privacy_policy">Privacy Policy</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.privacyPolicy" id="privacy_policy">Privacy Policy</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="footer-div-social" href="http://twitter.com/#!/OpenBankProject" data-lift="WebUI.footerSocialLink">Twitter</a>
|
||||
@ -222,18 +228,21 @@ Berlin 13359, Germany
|
||||
</li>
|
||||
<li>
|
||||
<a class="api-documentation-link" data-lift="WebUI.apiDocumentationLink" href="">
|
||||
<lift:loc locid="api_documentation">API Documentation</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.apiDocumentation" id="api_documentation">API Documentation</p>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="sofi-link" data-lift="WebUI.sofiLink" href="">Sofit</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/user_mgt/sign_up?after-signup=link-to-customer" class="navbar-btn" id ="register-link">
|
||||
<lift:loc locid="register">On Board</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.register" id="register">On Board</p>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a class="api-link" data-lift="WebUI.apiLinkHuman" href="">
|
||||
<lift:loc locid="api_host">This API Host</lift:loc></a>
|
||||
<p data-lift="WebUiTranslation.apiHost" id="api_host">This API Host</p></a>
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
@ -244,7 +253,7 @@ Berlin 13359, Germany
|
||||
<span><a id="es" href="/">ES</a></span>
|
||||
</div>
|
||||
<div id="copyright">
|
||||
<a href="http://openbankproject.com"><lift:loc locid="open_bank_project_is">Open Bank Project is ©2011 - </lift:loc> <span id="copyright-year" data-lift="WebUI.currentYearText">2018</span> </a> <a href="http://tesobe.com"><lift:loc locid="and_commercial_licenses">TESOBE and distributed under the AGPL and commercial licenses. </lift:loc></a>
|
||||
<a data-lift="WebUiTranslation.openBankProjectIs" id="open_bank_project_is" href="http://openbankproject.com">Open Bank Project is ©2011 - 2023</a> <a data-lift="WebUiTranslation.andCommercialLicenses" id="and_commercial_licenses" href="http://tesobe.com">TESOBE and distributed under the AGPL and commercial licenses. </a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user