Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
changed input fields for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
fayderflorez committed Oct 18, 2013
1 parent c5faef0 commit daf1ca2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
26 changes: 14 additions & 12 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,45 +35,47 @@ <h1 style="margin-top: 40px;">REST Countries</h1>
<div class="col-lg-6">
<h2>Search by 2-letter country code</h2>
<div class="input-group">
<input id="rc-input-alpha2" type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/alpha2/ee"></input>
<span class="input-group-btn"><a id="rc-a-alpha2" class="btn btn-default rc-a-tryit">Try it!</a></span>
<a id="rc-a-alpha2" class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/alpha2/ee</a>
</div>
</div>
<div class="col-lg-6">
<h2>Search by 3-letter country code</h2>
<div class="input-group">
<input id="rc-input-alpha3" type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/alpha3/col"></input>
<span class="input-group-btn"><a id="rc-a-alpha3" class="btn btn-default rc-a-tryit">Try it!</a></span>
<a id="rc-a-alpha3" class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/alpha3/col</a>
</div>
</div>
<div class="col-lg-6">
<h2>Search by Name (English)</h2>
<div class="input-group">
<input type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/name/united"></input>
<span class="input-group-btn"><a class="btn btn-default rc-a-tryit">Try it!</a></span>
<a class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/name/united</a>
</div>
</div>
<div class="col-lg-6">
<h2>Search by Currency</h2>
<div class="input-group">
<input type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/currency/eur"></input>
<span class="input-group-btn"><a class="btn btn-default rc-a-tryit">Try it!</a></span>
<a class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/currency/eur</a>
</div>
</div>
<div class="col-lg-6">
<h2>Search by Calling Code</h2>
<div class="input-group">
<input type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/callingcode/7"></input>
<span class="input-group-btn"><a class="btn btn-default rc-a-tryit">Try it!</a></span>
<a class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/callingcode/7</a>
</div>
</div>
<div class="col-lg-6">
<h2>Search by Capital City</h2>
<div class="input-group">
<input type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/capital/oslo"></input>
<span class="input-group-btn"><a class="btn btn-default rc-a-tryit">Try it!</a></span>
<a class="btn btn-default rc-a-tryit">http://restcountries.eu/rest/capital/oslo</a>
</div>
</div>

<div class="col-lg-11" style="margin-top: 10px; text-align: center;">
<h2>Try it yourself</h2>
<div class="input-group">
<input type="text" class="form-control rc-input-tryit" value="http://restcountries.eu/rest/name/united"></input>
<span class="input-group-btn"><a class="btn btn-default rc-a-tryityou">Try it!</a></span>
</div>
</div>

<!-- json preview -->
<div class="col-lg-11" style="margin-top: 10px;">
Expand Down
17 changes: 14 additions & 3 deletions src/main/webapp/js/restcountries.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@ $(function () {
jsonwell : $('#rc-json-well'),
warning : $('#rc-warning'),
errorMsg : $('#rc-error'),
searchers : $('#rc-searchers')
searchers : $('#rc-searchers'),
tryityou : $('.rc-a-tryityou'),
};

restc.ui.navbarlink.click(function(e) {
navbarLinkActive(e.target);
});

restc.ui.tryityou.click(function(e) {
ajax($(e.target).parent().prev().val(), function(data) {
restc.ui.jsonwell.removeClass('hidden');
restc.ui.jsonwell.html(getCodeHtml(data));
$(document).scrollTop(restc.ui.searchers.get(0).clientHeight);
});
});

restc.ui.tryit.click(function(e) {
ajax($(e.target).parent().prev().val(), function(data) {
var codeWell = $(e.target).parent().parent().next().next();
ajax($(e.target).html(), function(data) {
restc.ui.jsonwell.removeClass('hidden');
restc.ui.jsonwell.html(getCodeHtml(data));
$(document).scrollTop(restc.ui.searchers.get(0).clientHeight);
Expand All @@ -31,6 +39,7 @@ $(function () {
$(e.target).next().get(0).firstChild.click();
}
});


var navbarLinkActive = function(target) {
restc.ui.navbarlink.parent().removeClass('active');
Expand Down Expand Up @@ -68,5 +77,7 @@ $(function () {
html.push('</code></pre>');
return html.join('');
};

// $('#rc-a-alpha2').click();

});

0 comments on commit daf1ca2

Please sign in to comment.