Skip to content

Commit

Permalink
change new configs to have 1 endpoint by default. change popover to f…
Browse files Browse the repository at this point in the history
…ocus on editing the method
  • Loading branch information
brandonmwest committed Apr 1, 2012
1 parent f1b879d commit e62c0a2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion public/css/default.css
Expand Up @@ -3,7 +3,8 @@ body {
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
padding: 9px 0;
min-height: 300px;
}

.bottom-bar {
Expand Down
33 changes: 22 additions & 11 deletions public/js/default.js
Expand Up @@ -5,11 +5,19 @@ $(function() {
//menu actuators for endpoints
$('.endpointActuator').live('click', showEndpoint);

//tooltip for add endpoint button
if($('.endpoint').length==0) {
$('#addEndpoint').popover({"trigger":"manual", "content":"Get started by adding your first endpoint!", "placement":"bottom"});
$('#addEndpoint').popover('show');
$('body').click(hideEndpointPopover);
//add a new endpoint by default for new configs
if($('.endpoint').length==0 && $('#config').length == 1) {
addEndpoint(true);

firstMethod = $('#ep1 > .methods > .method');

firstMethod.popover({"trigger":"manual",
"title":"Edit this Method",
"content":"Get started by editing this method! Click on the method title bar to show the form.",
"placement":"bottom"});

firstMethod.popover('show');
$('body').click(hideMethodPopover);
}

//save file button
Expand All @@ -31,7 +39,6 @@ $(function() {
$('input.parameterName').live('change', updateParameterName);

$('.section.clickable').live('click', toggleSection);
$('.section.clickable > span').live('click', toggleSection);

//navbar about link
$('a.about').click(showAbout);
Expand All @@ -45,8 +52,8 @@ var saveFile = function(){
$('#outputForm').submit();
}

var hideEndpointPopover = function(e){
$("#addEndpoint").popover('hide');
var hideMethodPopover = function(e){
$('#ep1 > .methods > .method').popover('hide');
}

var showAbout = function() {
Expand Down Expand Up @@ -169,7 +176,7 @@ var syntaxHighlight = function(json) {
}

//TODO refactor these methods into 3 objects - endpoint, method, parameter
var addEndpoint = function(){
var addEndpoint = function(instant){
var endpointIndex = getEndpointIndex();

var newEndpoint = $('#endpointTemplate').children('div').first().clone();
Expand All @@ -189,8 +196,12 @@ var addEndpoint = function(){
//hide all divs
$('.endpoint').hide();

//show the div corresponding to what was clicked
$('#ep' + endpointIndex).show('slow');
if(instant==true)
speed='';
else
speed = 'slow';

$('#ep' + endpointIndex).show(speed);
}

var removeEndpoint = function(e) {
Expand Down

0 comments on commit e62c0a2

Please sign in to comment.