Skip to content

Commit

Permalink
add version and estimated_hours to popup card and update the card aft…
Browse files Browse the repository at this point in the history
…er commit
  • Loading branch information
samchen2009 committed Dec 11, 2013
1 parent e14cd22 commit f04649f
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/controllers/kanban_apis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def pane_wip_and_limit
render :json => {:wip => wip, :wip_limit => wip_limit}
end

def issue_card_detail
issue = Issues.find(params[:issue_id])
card = KanbanCard.find_by_issue_id(params[:issue_id])
render :json => {:issue=> issue, :card => card}
end

def detail_to_desc(journal)
prop_keys = ["status_id","priority_id", "fixed_version_id", "done_ratio","category_id","assigned_to_id"]
actions = ['Set','Changed',"Set","",'Set', 'Change']
Expand Down Expand Up @@ -166,3 +172,5 @@ def kanban_card_journals
render :json => {:card_journals => card_journals,:issue_journals => issue_journals}
end
end


2 changes: 2 additions & 0 deletions app/controllers/kanban_cards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def update
@issue.assigned_to_id = params[:assignee_id]
@issue.start_date = params[:start_date_]
@issue.due_date = params[:due_date_]
@issue.fixed_version_id = params[:version_id]
@issue.estimated_hours = params[:est_hours]

@saved = false
begin
Expand Down
1 change: 1 addition & 0 deletions app/controllers/kanbans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def index
@members= @project.members
@principals = @project.principals
@user = User.current
@versions = @project.versions

@roles = @user.roles_for_project(@project)

Expand Down
9 changes: 9 additions & 0 deletions app/views/kanban_cards/_update.js.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ $("#ajax-indicator").hide();
$("#popupWindow").find("#errorExplanation").hide();
$("#popupWindow").find("#errorExplanation").text("");
$("##{@issue.id}").appendTo($("#pane_#{@card.kanban_pane_id}"));
$("##{@issue.id}").find("#assignee_id").val("#{@issue.assigned_to_id}")
$("##{@issue.id}").find("#developer_id").val("#{@card.developer_id}")
$("##{@issue.id}").find("#verifier_id").val("#{@card.verifier_id}")
$("##{@issue.id}").find("#issue_status_id").val("#{@issue.status_id}")
$("##{@issue.id}").find("#kanban_state_id").val("#{@card.kanban_pane.kanban_state_id}")
$("##{@issue.id}").find("#version_id").val("#{@issue.fixed_version_id}")
$("##{@issue.id}").find("#est_hours").val("#{@issue.estimated_hours}")
$("##{@issue.id}").find("#start_date").val("#{@issue.start_date}")
$("##{@issue.id}").find("#due_date").val("#{@issue.due_date}")
- else
:plain
$("#popupWindow").find("#errorExplanation").text(" #{@errors}")
Expand Down
9 changes: 8 additions & 1 deletion app/views/kanbans/_card_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
.newline
= label_tag "Verifier: "
= select_tag "verifier_id", options_from_collection_for_select(@principals,"id", "name")
.newline
= label_tag "Version: "
= select_tag "version_id", options_from_collection_for_select(@versions,"id", "name")
.newline
= label_tag "Start_date: "
= text_field_tag :start_date_, " ", :size => 10, :type => "date"
= calendar_for(:start_date_)
.newline
= label_tag "Due_date: "
= text_field_tag :due_date_, " ", :size => 10, :type => "date"
= text_field_tag :due_date_, " ", :size => 10
= calendar_for(:due_date_)
.newline
= label_tag "Est Hours:"
= text_field_tag :est_hours, " ", :size => 3

/.newline
/= label_tag "Keywords: "
/= text_field_tag "keyword"
Expand Down
2 changes: 2 additions & 0 deletions app/views/kanbans/_kanban_pane.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
= hidden_field_tag :due_date, i.due_date
= hidden_field_tag :created_on, i.created_on.utc.strftime("%Y/%m/%d %H:%M:%S UTC")
= hidden_field_tag :tracker_id, i.tracker_id
= hidden_field_tag :version_id, i.fixed_version_id
= hidden_field_tag :est_hours, i.estimated_hours
%span.tip{:style => "font-weight: normal; font-size:11px"}
%strong= link_to "##{i.id} #{i.subject}", issue_path(i)
%br
Expand Down
5 changes: 4 additions & 1 deletion assets/javascripts/kanban.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function renderPopupCard(popup,card,action,sender,receiver){
popup.find("select#issue_status_id").val(card.find("#issue_status_id").val());
popup.find("select#kanban_state_id").val(card.find("#kanban_state_id").val());
var pane_id = sender.attr("id").match(/\d+$/)[0];
popup.find("#kanban_pane_id").val(pane_id);
popup.find("#kanban_pane_id").val(pane_id);
}else if (action == 'drop'){
// Change the assignee to me
var pane_id = receiver.attr("id").match(/\d+$/)[0];
Expand Down Expand Up @@ -467,6 +467,9 @@ function renderPopupCard(popup,card,action,sender,receiver){
popup.find("#issue_id").val(issue_id);
popup.find("textarea").val("").focus(1);
popup.find("#indication").hide();
popup.find("#version_id").val(card.find("#version_id").val());
popup.find("#est_hours").val(card.find("#est_hours").val());

}
}

Expand Down
13 changes: 13 additions & 0 deletions assets/javascripts/kanban_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ function getUserWipAndLimit(user_id){
});
}

function getIssueDetail(issue_id){
kanbanAjaxCall("get",
"/kanban_apis/issue_card_detail",{"card_id":issue_id},
function(data,result){
if (result == 0){
return data;
}else{
return undefined;
}
});
}


function getKanbanStates(){
kanbanAjaxCall("get",
"/kanban_apis/kanban_states",{"id":9999},
Expand Down
4 changes: 4 additions & 0 deletions assets/stylesheets/kanban.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ td .kanban-card-form select{
margin: 4px;
}

.kanban-card-form .float_left {
float:left;
}

#popupSubmit input{width:auto;}
.newline {clear:both;}

Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
match 'issue_status_kanban_states/update', :controller => 'issue_status_kanban_states', :action => "update", :via => :put
match 'kanbans/copy', :controller => 'kanbans', :action => "copy"
match 'kanban_reports/index', :controller => 'kanban_reports', :action => "index", :via => :get
match 'kanban_apis/issue_card_detail', :controller => 'kanban_apis', :action => 'issue_card_detail', :via => :get
end

0 comments on commit f04649f

Please sign in to comment.