[bitbake-devel] [PATCH 22/22] bitbake: toastergui: project page Add inline project name change feature

Ed Bartosh ed.bartosh at linux.intel.com
Fri Jul 31 12:09:23 UTC 2015


From: Michael Wood <michael.g.wood at intel.com>

This feature allows the project name to be changed from where ever it is
displayed in the project pages.

[YOCTO #7329]

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 lib/toaster/toastergui/static/js/base.js           | 29 ++++++++++++++++++++++
 .../toastergui/templates/projecttopbar.html        | 11 +++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/toastergui/static/js/base.js b/lib/toaster/toastergui/static/js/base.js
index 09c3ef1..f253361 100644
--- a/lib/toaster/toastergui/static/js/base.js
+++ b/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/lib/toaster/toastergui/templates/projecttopbar.html b/lib/toaster/toastergui/templates/projecttopbar.html
index d4d1951..79f6d1e 100644
--- a/lib/toaster/toastergui/templates/projecttopbar.html
+++ b/lib/toaster/toastergui/templates/projecttopbar.html
@@ -5,7 +5,16 @@
 
 <!-- project name -->
 <div class="row-fluid page-header">
-  <h1>{{project.name}}</h1>
+  <h1><span id="project-name">{{project.name}}</span>
+    <i class="icon-pencil" data-original-title="" id="project-change-form-toggle" title=""></i>
+  </h1>
+  <form id="project-name-change-form" style="margin-bottom: 0px; display: none;">
+    <div class="input-append">
+      <input class="huge input-xxlarge" type="text" id="project-name-change-input" autocomplete="off" value="{{project.name}}">
+        <button id="project-name-change-btn" class="btn btn-large" type="button">Save</button>
+        <a href="#" id="project-name-change-cancel" class="btn btn-large btn-link">Cancel</a>
+    </div>
+  </form>
 </div>
 
 <div class="row-fluid" id="project-topbar">
-- 
2.1.4




More information about the bitbake-devel mailing list