mirror of
https://github.com/OpenBankProject/API-Explorer.git
synced 2026-02-06 10:47:23 +00:00
Merge branch 'develop' of https://github.com/OpenBankProject/Social-Finance into develop
Conflicts: src/main/webapp/media/js/highlight.min.js
This commit is contained in:
commit
ce5b625b16
@ -162,7 +162,7 @@ class Boot extends Loggable{
|
||||
for {
|
||||
//TODO: Pagination: This is not totally trivial, since the transaction list groups by date and 2 pages may have some transactions on the same date
|
||||
transactionsJson <- ObpAPI.transactions(bank, account, viewName, Some(10000), Some(0), None, None, None)
|
||||
accountJson <- ObpAPI.account(bank, account, viewName) //TODO: Execute this request and the one above in parallel
|
||||
accountJson <- ObpAPI.getAccount(bank, account, viewName) //TODO: Execute this request and the one above in parallel
|
||||
} yield {
|
||||
(transactionsJson, accountJson, transactionsURLParams)
|
||||
}
|
||||
@ -264,7 +264,7 @@ class Boot extends Loggable{
|
||||
logOrReturnResult {
|
||||
for {
|
||||
viewsJson <- ObpAPI.getViews(bank, account)
|
||||
accountJson <- ObpAPI.account(bank, account, "owner" /*TODO: This shouldn't be hardcoded*/) //TODO: Execute this request and the one above in parallel
|
||||
accountJson <- ObpAPI.getAccount(bank, account, "owner" /*TODO: This shouldn't be hardcoded*/) //TODO: Execute this request and the one above in parallel
|
||||
} yield {
|
||||
(viewsJson, accountJson, PermissionsUrlParams(bank, account))
|
||||
}
|
||||
@ -314,7 +314,7 @@ class Boot extends Loggable{
|
||||
for {
|
||||
permissionsJson <- ObpAPI.getPermissions(bank, account)
|
||||
accountViewsJson <- ObpAPI.getViews(bank, account)
|
||||
accountJson <- ObpAPI.account(bank, account, "owner" /*TODO: This shouldn't be hardcoded*/) //TODO: Execute this request and the one above in parallel
|
||||
accountJson <- ObpAPI.getAccount(bank, account, "owner" /*TODO: This shouldn't be hardcoded*/) //TODO: Execute this request and the one above in parallel
|
||||
} yield (permissionsJson, accountJson, accountViewsJson, PermissionsUrlParams(bank, account))
|
||||
}
|
||||
} else Empty
|
||||
|
||||
@ -83,7 +83,7 @@ object ObpAPI extends Loggable {
|
||||
ObpGet("/v1.2.1/accounts/private").flatMap(_.extractOpt[BarebonesAccountsJson])
|
||||
}
|
||||
|
||||
def account(bankId: String, accountId: String, viewId: String) : Box[AccountJson] = {
|
||||
def getAccount(bankId: String, accountId: String, viewId: String) : Box[AccountJson] = {
|
||||
ObpGet("/v1.2/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) + "/" + urlEncode(viewId) + "/account").flatMap(x => x.extractOpt[AccountJson])
|
||||
}
|
||||
|
||||
@ -94,7 +94,15 @@ object ObpAPI extends Loggable {
|
||||
val deleteAccountUrl = "/internal/v1.0/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId)
|
||||
ObpInternalDelete(deleteAccountUrl)
|
||||
}
|
||||
|
||||
|
||||
def updateAccountLabel(bankId: String, accountId : String, label: String) = {
|
||||
val json =
|
||||
("id" -> accountId) ~
|
||||
("label" -> label) ~
|
||||
("bank_id" -> bankId)
|
||||
ObpPost("/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId), json)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The json for the comment if it was successfully added
|
||||
*/
|
||||
|
||||
@ -55,7 +55,7 @@ class Nav {
|
||||
val bankId = url( url.indexOf("banks")+1 )
|
||||
val accountId = url( url.indexOf("accounts")+1 )
|
||||
|
||||
ObpAPI.account(bankId, accountId, viewId)
|
||||
ObpAPI.getAccount(bankId, accountId, viewId)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@ -417,10 +417,12 @@ Used in transactions list
|
||||
availableViews.exists(view => view.id == Some("owner"))
|
||||
}
|
||||
var label = accountJson.label.getOrElse("")
|
||||
if (label.isEmpty && hasManagementAccess)
|
||||
label = accountJson.number.getOrElse("")
|
||||
else
|
||||
label = accountJson.id.getOrElse("")
|
||||
if (label.isEmpty) {
|
||||
if (hasManagementAccess)
|
||||
label = accountJson.number.getOrElse("")
|
||||
else
|
||||
label = accountJson.id.getOrElse("")
|
||||
}
|
||||
|
||||
"#accountShortDiscription *" #> label
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import net.liftweb.http.js.JsCmds.{SetHtml, Alert, RedirectTo}
|
||||
import net.liftweb.common.{Loggable, Box}
|
||||
import code.lib.ObpAPI
|
||||
import net.liftweb.http.SHtml.{text,ajaxSubmit, ajaxButton}
|
||||
import ObpAPI.{addView, deleteView}
|
||||
import ObpAPI.{addView, deleteView, updateAccountLabel, getAccount}
|
||||
import SHtml._
|
||||
|
||||
case class ViewUpdateData(
|
||||
@ -204,4 +204,30 @@ class ViewsOverview(viewsDataJson: ViewsDataJSON) extends Loggable {
|
||||
"type=submit" #> ajaxSubmit("OK", process)
|
||||
).apply(xhtml)
|
||||
}
|
||||
|
||||
//set up ajax handlers to edit account label
|
||||
def setupEditLabel(xhtml: NodeSeq): NodeSeq = {
|
||||
var newLabel = ""
|
||||
|
||||
def process(): JsCmd = {
|
||||
logger.debug(s"ViewsOverview.setupEditLabel.process: edit label $newLabel")
|
||||
val result = updateAccountLabel(bank, account, newLabel)
|
||||
if (result.isDefined) {
|
||||
val msg = "Label " + newLabel + " has been set"
|
||||
Call("socialFinanceNotifications.notify", msg).cmd
|
||||
} else {
|
||||
val msg = "Sorry, Label" + newLabel + " could not be set ("+ result +")"
|
||||
Call("socialFinanceNotifications.notifyError", msg).cmd
|
||||
}
|
||||
}
|
||||
|
||||
val label = getAccount(bank, account, "owner").get.label.getOrElse("Label")
|
||||
(
|
||||
// Bind newViewName field to variable (e.g. http://chimera.labs.oreilly.com/books/1234000000030/ch03.html)
|
||||
"@new_label" #> text(newLabel, s => newLabel = s) &
|
||||
// Replace the type=submit with Javascript that makes the ajax call.
|
||||
"type=submit" #> ajaxSubmit("OK", process) &
|
||||
"type=text [value]" #> label
|
||||
).apply(xhtml)
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ Berlin 13359, Germany
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><input class="create-permission" type="submit" value="Create"></td>
|
||||
<td></td><td><input class="create-permission" type="submit" value="Create"></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</form>
|
||||
|
||||
@ -36,8 +36,6 @@ e.g. http://localhost:8080/banks/bnpp-fr2/accounts/1137869186/owner
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<div class="lift:surround?with=default;at=content">
|
||||
|
||||
<div id="account_details" class="lift:OBPTransactionSnippet.accountDetails">
|
||||
|
||||
@ -39,7 +39,7 @@ See views.js for the javascript which manipulates the DOM for editing
|
||||
|
||||
<div class="lift:surround?with=default;at=content">
|
||||
<div class="views">
|
||||
<div>
|
||||
<div class="action-bar">
|
||||
<button id="view-add">Add new view</button>
|
||||
<div id="add-view-form" class="lift:ViewsOverview.setupAddView">
|
||||
<form class="lift:form.ajax">
|
||||
@ -47,7 +47,14 @@ See views.js for the javascript which manipulates the DOM for editing
|
||||
<input type="submit" value="placeholder">
|
||||
</form>
|
||||
</div>
|
||||
<button id="view-edit-advanced-options">Show advanced options</button>
|
||||
<button id="account-edit-label">Change account label</button>
|
||||
<div id="account-edit-label-form" class="lift:ViewsOverview.setupEditLabel">
|
||||
<form class="lift:form.ajax">
|
||||
<input type="text" name="new_label" placeholder="Label">
|
||||
<input type="submit" value="placeholder">
|
||||
</form>
|
||||
</div>
|
||||
<button id="view-edit-advanced-options">Hide advanced options</button>
|
||||
</div>
|
||||
<div class="lift:ViewsOverview.getTableContent">
|
||||
<table id="view_table">
|
||||
|
||||
1
src/main/webapp/media/css/highlight.js.min.css
vendored
Normal file
1
src/main/webapp/media/css/highlight.js.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.hljs{display:block;overflow-x:auto;padding:0.5em;background:#f0f0f0;-webkit-text-size-adjust:none}.hljs,.hljs-subst,.hljs-tag .hljs-title,.nginx .hljs-title{color:black}.hljs-string,.hljs-title,.hljs-constant,.hljs-parent,.hljs-tag .hljs-value,.hljs-rule .hljs-value,.hljs-preprocessor,.hljs-pragma,.hljs-name,.haml .hljs-symbol,.ruby .hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-template_tag,.django .hljs-variable,.smalltalk .hljs-class,.hljs-addition,.hljs-flow,.hljs-stream,.bash .hljs-variable,.pf .hljs-variable,.apache .hljs-tag,.apache .hljs-cbracket,.tex .hljs-command,.tex .hljs-special,.erlang_repl .hljs-function_or_atom,.asciidoc .hljs-header,.markdown .hljs-header,.coffeescript .hljs-attribute,.tp .hljs-variable{color:#800}.smartquote,.hljs-comment,.hljs-annotation,.diff .hljs-header,.hljs-chunk,.asciidoc .hljs-blockquote,.markdown .hljs-blockquote{color:#888}.hljs-number,.hljs-date,.hljs-regexp,.hljs-literal,.hljs-hexcolor,.smalltalk .hljs-symbol,.smalltalk .hljs-char,.go .hljs-constant,.hljs-change,.lasso .hljs-variable,.makefile .hljs-variable,.asciidoc .hljs-bullet,.markdown .hljs-bullet,.asciidoc .hljs-link_url,.markdown .hljs-link_url{color:#080}.hljs-label,.ruby .hljs-string,.hljs-decorator,.hljs-filter .hljs-argument,.hljs-localvars,.hljs-array,.hljs-attr_selector,.hljs-important,.hljs-pseudo,.hljs-pi,.haml .hljs-bullet,.hljs-doctype,.hljs-deletion,.hljs-envvar,.hljs-shebang,.apache .hljs-sqbracket,.nginx .hljs-built_in,.tex .hljs-formula,.erlang_repl .hljs-reserved,.hljs-prompt,.asciidoc .hljs-link_label,.markdown .hljs-link_label,.vhdl .hljs-attribute,.clojure .hljs-attribute,.asciidoc .hljs-attribute,.lasso .hljs-attribute,.coffeescript .hljs-property,.hljs-phony{color:#88f}.hljs-keyword,.hljs-id,.hljs-title,.hljs-built_in,.css .hljs-tag,.hljs-doctag,.smalltalk .hljs-class,.hljs-winutils,.bash .hljs-variable,.pf .hljs-variable,.apache .hljs-tag,.hljs-type,.hljs-typename,.tex .hljs-command,.asciidoc .hljs-strong,.markdown .hljs-strong,.hljs-request,.hljs-status,.tp .hljs-data,.tp .hljs-io{font-weight:bold}.asciidoc .hljs-emphasis,.markdown .hljs-emphasis,.tp .hljs-units{font-style:italic}.nginx .hljs-built_in{font-weight:normal}.coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5}
|
||||
@ -872,8 +872,8 @@ span#accountsMsg
|
||||
|
||||
#feedback .feedback-slider {
|
||||
display:block;
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
width:20px;
|
||||
height:100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 15px;
|
||||
background-position: 50%;
|
||||
@ -900,6 +900,7 @@ a.otherAccountLinkForAlias{
|
||||
display: inline-block;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
|
||||
@ -921,26 +922,27 @@ td.main-attributes{
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.advanced-option {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.desc_input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#view-edit-advanced-options {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#add-view-form {
|
||||
display: none;
|
||||
}
|
||||
|
||||
td.imageURL {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
td.imageURL span.text {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
div.views .action-bar {
|
||||
padding: 5px 0px 15px 0px;
|
||||
}
|
||||
|
||||
#view-edit-advanced-options {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#add-view-form, #account-edit-label-form {
|
||||
display: none;
|
||||
}
|
||||
2
src/main/webapp/media/js/highlight.min.js
vendored
2
src/main/webapp/media/js/highlight.min.js
vendored
File diff suppressed because one or more lines are too long
@ -3,13 +3,13 @@ $(document).ready(function(){
|
||||
$('#view-edit-advanced-options').click(function(){
|
||||
var thisButton = $(this)
|
||||
var showButtonText = "Show advanced options"
|
||||
|
||||
|
||||
$('.advanced-option').toggle();
|
||||
|
||||
if(thisButton.text() === showButtonText) {
|
||||
$('.advanced-option').show();
|
||||
thisButton.text("Hide advanced options");
|
||||
} else {
|
||||
$('.advanced-option').hide();
|
||||
thisButton.text(showButtonText);
|
||||
thisButton.text("Hide advanced options");
|
||||
} else {
|
||||
thisButton.text(showButtonText);
|
||||
}
|
||||
})
|
||||
|
||||
@ -23,6 +23,16 @@ $(document).ready(function(){
|
||||
}
|
||||
})
|
||||
|
||||
$('#account-edit-label').click(function(){
|
||||
var el = $('#account-edit-label-form')
|
||||
if (el.is(":visible")) {
|
||||
el.hide()
|
||||
} else {
|
||||
el.css("display", "inline-block")
|
||||
$('#account-edit-label-form form input:first-of-type').focus()
|
||||
}
|
||||
})
|
||||
|
||||
/* clicking on edit: change view to edit mode for selected view */
|
||||
$(".edit").on("click", function(){
|
||||
var viewId = $(this).attr("data-id")
|
||||
|
||||
@ -38,17 +38,14 @@ Berlin 13359, Germany
|
||||
|
||||
<link href="/media/css/website.css" rel="stylesheet" type="text/css" />
|
||||
<script id="jquery" src="/media/js/jquery-1.11.1.min.js" type="text/javascript"></script>
|
||||
<script src="/media/js/polarize.js" type="text/javascript"></script>
|
||||
<script src="/media/js/polarize.js" type="text/javascript"></script>
|
||||
<script src="/media/js/website.js" type="text/javascript"></script>
|
||||
<script src="/media/js/views.js" type="text/javascript"></script>
|
||||
<script src="/media/js/toastr.min.js"></script>
|
||||
<link href="/media/css/toastr.min.css" rel="stylesheet"/>
|
||||
<script src="/media/js/notifications.js" type="text/javascript"></script>
|
||||
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/default.min.css">
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/media/css/highlight.js.min.css">
|
||||
<script src="/media/js/highlight.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user