diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb
index 7a4e9ef71c..3e5ed8aa6e 100755
--- a/app/views/tasks/_task.html.erb
+++ b/app/views/tasks/_task.html.erb
@@ -1,11 +1,11 @@
>
<%= issue_link_or_empty(task) %>
<%= task.subject %>
-
<%= remaining_hours(task) %>
<%= assignee_name_or_empty(task) %>
<%= assignee_id_or_empty(task) %>
+
<%= remaining_hours(task) %>
<%- if @include_meta -%>
diff --git a/assets/javascripts/impediment.js b/assets/javascripts/impediment.js
index 60d15622d8..851adf3d79 100644
--- a/assets/javascripts/impediment.js
+++ b/assets/javascripts/impediment.js
@@ -14,6 +14,8 @@ RB.Impediment = RB.Object.create(RB.Task, {
// Associate this object with the element for later retrieval
j.data('this', this);
+
+ j.bind('mouseup', this.handleClick);
},
// Override saveDirectives of RB.Task
diff --git a/assets/javascripts/story.js b/assets/javascripts/story.js
index 73c9dcec3f..f9844a3d7c 100755
--- a/assets/javascripts/story.js
+++ b/assets/javascripts/story.js
@@ -36,6 +36,7 @@ RB.Story = RB.Object.create(RB.Model, {
if(this.isNew()){
this.$.hide('blind');
}
+ console.log("cancelEdit")
},
checkSubjectLength: function(){
diff --git a/assets/javascripts/task.js b/assets/javascripts/task.js
index 461dfa849f..ab02b798a6 100755
--- a/assets/javascripts/task.js
+++ b/assets/javascripts/task.js
@@ -28,7 +28,41 @@ RB.Task = RB.Object.create(RB.Story, {
},
edit: function(){
- throw "Edit is not yet implemented";
+ var editor = $("#item_editor").html("");
+ var self = this;
+
+ this.$.find('.editable').each(function(index){
+ var field = $(this);
+ var fieldType = field.attr('fieldtype')!=null ? field.attr('fieldtype') : 'input';
+ var fieldName = field.attr('fieldname');
+ var input;
+
+ $(document.createElement("label")).text(fieldName.replace(/_/ig, " ").replace(/ id$/ig,"")).appendTo(editor);
+ input = fieldType=='select' ? $('#' + fieldName + '_options').clone(true) : $(document.createElement(fieldType));
+ input.removeAttr('id');
+ input.attr('name', fieldName);
+ input.addClass(fieldName);
+ input.addClass('editor');
+ input.removeClass('template');
+ input.appendTo(editor);
+ // input.bind('keyup', j.data('this').handleKeyup);
+
+ // Copy the value in the field to the input element
+ value = ( fieldType=='select' ? field.children('.v').first().text() : field.text() );
+ input.val(value);
+ });
+
+ editor.dialog({
+ modal: true,
+ title: "Edit " + (this.isNew() ? "New " + (this.$.hasClass('task') ? "Task" : "Impediment") : "#" + this.getID()),
+ buttons: {
+ "Cancel" : function(){ self.cancelEdit(); $(this).dialog("close") },
+ "OK" : function(){ self.saveFromDialog(); $(this).dialog("close") }
+ },
+ close: function(event, ui){ if(event.which==27) self.cancelEdit() }
+ });
+
+ editor.find(".editor").first().focus();
},
handleClick: function(event){
@@ -105,6 +139,13 @@ RB.Task = RB.Object.create(RB.Story, {
if(!this.$.hasClass('editing')) this.saveEdits();
},
+
+ saveFromDialog: function(){
+ var editors = this.$.find(".editors").length==0 ? $(document.createElement("div")).addClass("editors").appendTo(this.$) : this.$.find(".editors").first();
+ editors.html("");
+ editors.append($("#item_editor").children(".editor"));
+ this.saveEdits();
+ },
// Override RB.Story.storyUpdated()
storyUpdated: function(xhr, textStatus){
diff --git a/assets/stylesheets/taskboard.css b/assets/stylesheets/taskboard.css
index 8a99519ce5..64c2f6833c 100755
--- a/assets/stylesheets/taskboard.css
+++ b/assets/stylesheets/taskboard.css
@@ -235,6 +235,29 @@ See RB.Taskboard.initialize()
border-color:#CC0000;
display:block;
}
+.item .editors{
+ display:none;
+}
+
+/* item editor */
+#item_editor label{
+ display:block;
+ font-size:11px;
+ text-transform:capitalize;
+ width:100%;
+}
+#item_editor .editor{
+ font-size:11px;
+ margin-bottom:10px;
+ width:100%;
+}
+#item_editor .subject{
+ height:65px;
+ width:272px;
+}
+#item_editor .remaining_hours{
+ width:268px;
+}
/* compact view */
.compact .story,