diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js index 09c3ef137b..f25336110a 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js @@ -5,6 +5,10 @@ function basePageInit(ctx) { var newBuildButton = $("#new-build-button"); var newBuildTargetInput; var newBuildTargetBuildBtn; + var projectNameForm = $("#project-name-change-form"); + var projectName = $("#project-name"); + var projectNameFormToggle = $("#project-change-form-toggle"); + var projectNameChangeCancel = $("#project-name-change-cancel"); /* initially the current project is used unless overridden by the new build * button in top right nav @@ -16,6 +20,31 @@ function basePageInit(ctx) { var newBuildProjectInput = $("#new-build-button #project-name-input"); var newBuildProjectSaveBtn = $("#new-build-button #save-project-button"); + /* Project name change functionality */ + projectNameFormToggle.click(function(e){ + e.preventDefault(); + + $(this).add(projectName).hide(); + projectNameForm.fadeIn(); + }); + + projectNameChangeCancel.click(function(e){ + e.preventDefault(); + + projectNameForm.hide(); + projectName.add(projectNameFormToggle).fadeIn(); + }); + + $("#project-name-change-btn").click(function(e){ + var newProjectName = $("#project-name-change-input").val(); + + libtoaster.editCurrentProject({ projectName: newProjectName },function (){ + + projectName.text(newProjectName); + libtoaster.ctx.projectName = newProjectName; + projectNameChangeCancel.click(); + }); + }); _checkProjectBuildable(); diff --git a/bitbake/lib/toaster/toastergui/templates/projecttopbar.html b/bitbake/lib/toaster/toastergui/templates/projecttopbar.html index d4d1951ae4..79f6d1e346 100644 --- a/bitbake/lib/toaster/toastergui/templates/projecttopbar.html +++ b/bitbake/lib/toaster/toastergui/templates/projecttopbar.html @@ -5,7 +5,16 @@