diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css index da78f47f85..072a71d834 100644 --- a/bitbake/lib/toaster/toastergui/static/css/default.css +++ b/bitbake/lib/toaster/toastergui/static/css/default.css @@ -179,7 +179,6 @@ table { table-layout: fixed; word-wrap: break-word; } .well-alert > .lead { color: #C09853; padding-bottom: .75em; } .configuration-alert { margin-bottom: 0px; padding: 8px 14px; } .configuration-alert p { margin-bottom: 0px; } -fieldset { padding-left: 19px; } .project-form { margin-top: 10px; } .add-layers .btn-block + .btn-block, .build .btn-block + .btn-block { margin-top: 0px; } input.huge { font-size: 17.5px; padding: 11px 19px; } diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js index f1711c134f..6fd77ea457 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js @@ -3,33 +3,57 @@ function basePageInit(ctx) { var newBuildButton = $("#new-build-button"); - /* Hide the button if we're on the project,newproject or importlyaer page - * or if there are no projects yet defined - */ - if (ctx.numProjects === 0 || ctx.currentUrl.search('newproject|project/\\d$|importlayer$') > 0) { - newBuildButton.hide(); - return; - } + var newBuildTargetInput; + var newBuildTargetBuildBtn; var selectedProject = libtoaster.ctx; var selectedTarget; + var newBuildProjectInput = $("#new-build-button #project-name-input"); + var newBuildProjectSaveBtn = $("#new-build-button #save-project-button"); + + $("#config-nav .nav li a").each(function(){ + if (window.location.pathname === $(this).attr('href')) + $(this).parent().addClass('active'); + else + $(this).parent().removeClass('active'); + }); + + if ($(".total-builds").length !== 0){ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ + if (prjInfo.builds) + $(".total-builds").text(prjInfo.builds.length); + }); + } + + /* Hide the button if we're on the project,newproject or importlyaer page + * or if there are no projects yet defined + * only show if there isn't already a build-target-input already + */ + if (ctx.numProjects > 0 && + ctx.currentUrl.search('newproject') < 0 && + $(".build-target-input").length === 1) { + + newBuildTargetInput = $("#new-build-button .build-target-input"); + newBuildTargetBuildBtn = $("#new-build-button .build-button"); + + newBuildButton.show(); + _setupNewBuildButton(); + } else if ($(".build-target-input").length > 0) { + newBuildTargetInput = $("#project-topbar .build-target-input"); + newBuildTargetBuildBtn = $("#project-topbar .build-button"); + } else { + return; + } + + /* Hide the change project icon when there is only one project */ if (ctx.numProjects === 1) { $('#project .icon-pencil').hide(); } - newBuildButton.show().removeAttr("disabled"); - - - var newBuildProjectInput = $("#new-build-button #project-name-input"); - var newBuildTargetBuildBtn = $("#new-build-button #build-button"); - var newBuildTargetInput = $("#new-build-button #build-target-input"); - var newBuildProjectSaveBtn = $("#new-build-button #save-project-button"); - _checkProjectBuildable(); - _setupNewBuildButton(); function _checkProjectBuildable() { @@ -57,8 +81,6 @@ function basePageInit(ctx) { selectedProject.projectName = item.name; selectedProject.projectId = item.id; selectedProject.projectBuildsUrl = item.projectBuildsUrl; - - }); } diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 0accd971d4..e522373b3f 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js @@ -15,6 +15,19 @@ function layerDetailsPageInit (ctx) { layerDepBtn.removeAttr("disabled"); }); + $(".breadcrumb li:first a").click(function(e){ + /* By default this link goes to the project configuration page. However + * if we have some builds we go there instead of the default href + */ + libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){ + if (prjInfo.builds && prjInfo.builds.length > 0) { + window.location.replace(libtoaster.ctx.projectBuildsUrl); + e.preventDefault(); + return; + } + }); + }); + function addRemoveDep(depLayerId, add, doneCb) { var data = { layer_version_id : ctx.layerVersion.id }; if (add) diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index b34e6c37d3..6c3e1a3823 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html @@ -80,7 +80,6 @@ {% endif %}