|
@@ -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
|
|
|
+ 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|project/\\d$|importlayer$') > 0) {
|
|
|
- newBuildButton.hide();
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
- var selectedProject = libtoaster.ctx;
|
|
|
- var selectedTarget;
|
|
|
|
|
|
/* 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;
|
|
|
-
|
|
|
-
|
|
|
});
|
|
|
|
|
|
}
|