start to format result with new design

This commit is contained in:
Simon Redfern 2015-11-07 00:41:29 +00:00
parent 1f6c01bf12
commit db8fb12c2a
2 changed files with 15 additions and 6 deletions

View File

@ -405,11 +405,11 @@ class ApiExplorer extends Loggable {
".resource_verb_td [id]" #> s"resource_verb_td_${i.id}" & // Probably don't need this now
".url_caller [id]" #> s"url_caller_${i.id}" &
// ".try_me_button [onclick]" #> s"$$(DOUBLE-QUOTE#url_caller_${i.id}DOUBLE-QUOTE).fadeToggle();".replaceAll("DOUBLE-QUOTE","""") &
".result [id]" #> s"result_${i.id}" &
"@result [id]" #> s"result_${i.id}" &
"@example_request_body [id]" #> s"example_request_body_${i.id}" &
"@example_request_body [style]" #> s"display: ${displayRequestBody(i.verb)};" &
//////
// The form field (on the left) is bound to the variable (urlToCall)
// The form field (on the left) is bound to the variable (requestUrl)
// (However, updating the var here does not seem to update the form field value)
// We provide a default value (i.url) and bind the user input to requestUrl. requestURL is available in the function process
// text creates a text box and we can capture its input in requestUrl
@ -421,9 +421,9 @@ class ApiExplorer extends Loggable {
"@request_verb_input" #> text(i.verb, s => requestVerb = s, "type" -> "hidden", "id" -> s"request_verb_input_${i.id}") &
"@resource_id_input" #> text(i.id.toString, s => resourceId = s, "type" -> "hidden", "id" -> s"resource_id_input_${i.id}") &
// Replace the type=submit with Javascript that makes the ajax call.
"@success_response_body [id]" #> s"success_response_body_${i.id}" &
// The button. First argument is the text of the button (GET, POST etc). Second argument is function to call. Arguments to the func could be sent in third argument
"@success_response_body [id]" #> s"success_response_body_${i.id}" &
".call_button" #> ajaxSubmit(i.verb, process)
"@call_button" #> ajaxSubmit(i.verb, process)
}
}
}

View File

@ -94,8 +94,17 @@
</ul>
</div>
<div class="content-box__input-box">
<input type="text" class="default-input" value="OBP URL to call">
<button class="default-button">POST</button>
<form class="lift:form.ajax" id="form1">
<!-- Attributes for these fields are replaced -->
<input type="hidden" name="resource_id_input">
<input type="hidden" name="request_verb_input" placeholder="GET, POST, PUT etc.">
<!-- The url_to_call is populated at render (but it can be edited manually) -->
<input type="text" name="request_url_input" class="default-input" placeholder="OBP URL to call">
<button name="call_button" class="default-button">POST</button>
</form>
</div>
<div name="result" class="content-box__info-box">
<img src="./media/images/close-icon.png" alt="Close icon" class="content-box__close-icon">
</div>
</div>
</div>