Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/css/builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,11 @@ div.propertyItems label[for|=id] {
font-weight: bold;
}

.titleBar input {
width: 150px;
margin: 3px;
}

.openButton {
background-image: url("images/openButton_up.png");
background-repeat: no-repeat;
Expand Down
30 changes: 29 additions & 1 deletion src/js/views/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,34 @@
'-webkit-transform-origin':'2 2'});
},
_buttonEvents: function(box, pid, widget) {
var openHandler, cloneHandler, deleteHandler;
var renameHandler, openHandler, cloneHandler, deleteHandler;
renameHandler = function(e) {
var spanElement = $(this),
renameProject = function(e, inputElement, spanElement) {
var projectName = inputElement.val();
if (projectName.trim() == '')
projectName = 'Untitled'
$.rib.pmUtils.setProperty(pid, "name", projectName);
spanElement.html(projectName);
spanElement.show();
inputElement.remove();
};

spanElement.hide();
$('<input>')
.attr('type', 'text')
.val(spanElement.html())
.appendTo(spanElement.parent())
.keydown(function(e) {
if(e.keyCode == '13') {
renameProject(e, $(this), spanElement);
}
})
.blur(function(e) {
renameProject(e, $(this), spanElement);
})
.focus();
};
openHandler = function () {
var success = function () {
// show the layout tab
Expand Down Expand Up @@ -397,6 +424,7 @@
$.rib.pmUtils.deleteProject(pid, success);
});
};
box.find('.titleBar > span').dblclick(renameHandler);
box.find('.openButton').click(openHandler);
box.find('.clone.button').click(cloneHandler);
box.find('.delete.button').click(deleteHandler);
Expand Down