Commit 40d71d32 by Dányi Bence

store: ajax rename

parent 0a2066bb
...@@ -199,6 +199,15 @@ $(function() { ...@@ -199,6 +199,15 @@ $(function() {
} }
}) })
} }
self.rename=function(item,e){
$(e.target).parent().parent().parent().unbind('click');
$(e.target).parent().parent().parent().find('.name').html('<input type="text" value="'+item.originalName+'" />\
<input type="submit" value="Átnevezés" />');
$(e.target).parent().parent().parent().find('.name input[type=submit]').click(function(){
var newName=$(e.target).parent().parent().parent().find('.name input[type=text]').val();
loadFolder(self.currentPath());
})
}
self.uploadURL = ko.observable('/'); self.uploadURL = ko.observable('/');
self.getUploadURL = function() { self.getUploadURL = function() {
$.ajax({ $.ajax({
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="name" data-bind="text: name, attr: {class: getTypeClass}"></div> <div class="name" data-bind="text: name, attr: {class: getTypeClass}"></div>
<div class="info" data-bind="text: size"></div> <div class="info" data-bind="text: size"></div>
<div class="actions"> <div class="actions">
<a href="#"> <a href="#" data-bind="click: $parent.rename, clickBubble: false">
<img src="/static/icons/pencil.png" alt="rename" /> <img src="/static/icons/pencil.png" alt="rename" />
</a> </a>
<a href="#" data-bind="click: $parent.delete, clickBubble: false"> <a href="#" data-bind="click: $parent.delete, clickBubble: false">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment