Skip to content

Commit

Permalink
assigned user added to the story
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Munda authored and maser committed Apr 15, 2011
1 parent bc7d2fe commit 8ad9a13
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ assets/styles
lib/labels.yaml
lib/labels-malformed.yaml
graph.dot
.tmp*
1 change: 0 additions & 1 deletion app/controllers/rb_stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def update
result = story.update_and_position!(params)
story.reload
status = (result ? 200 : 400)

respond_to do |format|
format.html { render :partial => "story", :object => story, :status => status }
end
Expand Down
7 changes: 7 additions & 0 deletions app/helpers/rb_common_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ def status_id_or_default(story)
def status_label_or_default(story)
story.new_record? ? IssueStatus.find(:first, :order => "position ASC").name : story.status.name
end

def assignee_id_or_default(story)
story.new_record? ? "" : story.assigned_to.object_id
end
def assignee_label_or_default(story)
story.new_record? ? "" : story.assigned_to
end

def sprint_html_id_or_empty(sprint)
sprint.new_record? ? "" : "sprint_#{sprint.id}"
Expand Down
6 changes: 6 additions & 0 deletions app/views/rb_stories/_helpers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<%- end %>
</select>

<select class="assignee_id helper" id="assigned_to_id_options">
<%- User.find(:all).each do |user| %>
<option value="<%= user.id %>"><%= user.name %></option>
<%- end %>
</select>

<div id="story_template">
<%= render :partial => 'rb_stories/story', :object => Story.new %>
</div>
4 changes: 4 additions & 0 deletions app/views/rb_stories/_story.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<div class="t"><%= status_label_or_default(story) %></div>
<div class="v"><%= status_id_or_default(story) %></div>
</div>
<div class="assignee_id editable" fieldtype="select" fieldname="assigned_to_id">
<div class="t"><%= assignee_label_or_default(story) %></div>
<div class="v"><%= assignee_id_or_default(story) %></div>
</div>
<div class="story_points editable" fieldname="story_points"><%= story_points_or_empty(story) %></div>
<div class="fixed_version_id"><%= story.fixed_version_id %></div>
<div class="higher_item_id"><%= story.higher_item.blank? ? '' : story.higher_item.id %></div>
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/sprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ RB.Sprint = RB.Object.create(RB.Model, RB.EditableInplace, {

refreshed: function(){
// We have to do this since .live() does not work for some reason
j.find(".editable").bind('mouseup', this.handleClick);
//j.find(".editable").bind('mouseup', this.handleClick);
},

saveDirectives: function(){
var j = this.$;

var data = j.find('.editor').serialize() + "&_method=put";
var url = RB.urlFor('update_sprint', { id: this.getID() });

return {
url : url,
data: data
Expand Down
8 changes: 4 additions & 4 deletions assets/javascripts/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RB.Story = RB.Object.create(RB.Issue, RB.EditableInplace, {
// Associate this object with the element for later retrieval
j.data('this', this);

j.find(".editable").live('mouseup', this.handleClick);
j.find(".editable").live('dblclick', this.handleClick);
},

beforeSave: function(){
Expand Down Expand Up @@ -52,17 +52,17 @@ RB.Story = RB.Object.create(RB.Issue, RB.EditableInplace, {

var data = "prev=" + (prev.length==1 ? this.$.prev().data('this').getID() : '') +
"&fixed_version_id=" + sprint_id;
if(j.find('.editor').length > 0) data += "&" + j.find('.editor').serialize();
if( this.isNew() ){
var url = RB.urlFor( 'create_story' );
} else {
var url = RB.urlFor( 'update_story', { id: this.getID() } );
data += "&_method=put"
}

return {
return {
url: url,
data: data
}
Expand Down
20 changes: 20 additions & 0 deletions assets/stylesheets/rb_default/master_backlog.css
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@
#backlogs_container .stories .story .status_id .v {
display:none;
}
#backlogs_container .stories .story .assignee_id.editable {
display:block;
right:7%;
position:absolute;
width:17%;
top:5px;
text-align: right;
overflow:hidden;
height:15px;
}
#backlogs_container .stories .story .assignee_id .v {
display:none;
}
#backlogs_container .stories .story .story_points {
display:block;
height:15px;
Expand Down Expand Up @@ -429,6 +442,13 @@
top:4px;
width:68px;
}
#backlogs_container .stories .story.editing .assignee_id.editor{
display:block;
right:7%;
margin:0;
top:4px;
width:17%;
}
#backlogs_container .stories .story.editing .story_points.editor{
display:block;
height:10px;
Expand Down

0 comments on commit 8ad9a13

Please sign in to comment.