From d0649fffce1cccd3e8130035aa8189aa28e2cbf7 Mon Sep 17 00:00:00 2001 From: James Antrobus Date: Sat, 25 Aug 2012 18:40:28 +0100 Subject: [PATCH 1/3] issue #4 updated Redmine issue description to include link to Redmine --- lib/rmt/redmine.rb | 12 +++++++++--- lib/rmt/trello.rb | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/rmt/redmine.rb b/lib/rmt/redmine.rb index 7554e7d..2e43c13 100644 --- a/lib/rmt/redmine.rb +++ b/lib/rmt/redmine.rb @@ -78,12 +78,11 @@ def parse_issues(response_body) { :id => get_value_of_text_child_node(issue_node, "id"), :subject => get_value_of_text_child_node(issue_node, "subject"), - :description => get_value_of_text_child_node(issue_node, "description"), + :description => get_issue_description(issue_node), :start_date => get_value_of_text_child_node(issue_node, "start_date"), :due_date => get_value_of_text_child_node(issue_node, "due_date"), :done_ratio => get_value_of_text_child_node(issue_node, "done_ratio"), - :estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"), - :description => get_value_of_text_child_node(issue_node, "description"), + :estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"), :created_on => get_value_of_text_child_node(issue_node, "created_on"), :updated_on => get_value_of_text_child_node(issue_node, "updated_on"), :tracker => get_attribute_of_child_node(issue_node, "tracker", :name), @@ -103,6 +102,13 @@ def get_value_of_text_child_node(node, child_node_name) end private :get_value_of_text_child_node + def get_issue_description(node) + issue_id = get_value_of_text_child_node(node, "id") + description = get_value_of_text_child_node(node, "description") || "" + "#{description} #{@base_url}/issues/#{issue_id}" + end + private :get_issue_description + # given an Ox xml node, find a child node by the specified child_node_name. The specified node # should have an attribute with the name specified by attr_name; this method returns the value # of that attribute. diff --git a/lib/rmt/trello.rb b/lib/rmt/trello.rb index 3849b90..55db607 100644 --- a/lib/rmt/trello.rb +++ b/lib/rmt/trello.rb @@ -28,7 +28,7 @@ def create_card(properties) puts "Adding card: #{properties[:name]}" card = ::Trello::Card.create(:name => properties[:name], :list_id => properties[:list], - :description => sanitize_utf8(properties[:description] || "")) + :description => sanitize_utf8(properties[:description])) if properties[:color] card.add_label(properties[:color]) end @@ -74,4 +74,4 @@ def sanitize_utf8(str) str.each_char.map { |c| c.valid_encoding? ? c : "\ufffd"}.join end end -end +end \ No newline at end of file From 6a8ba52556ae28413982f7aee69c3c6537356926 Mon Sep 17 00:00:00 2001 From: James Antrobus Date: Tue, 28 Aug 2012 23:15:19 +0100 Subject: [PATCH 2/3] moved Redmine link to the beginning of the description to prevent scrolling --- lib/rmt/redmine.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rmt/redmine.rb b/lib/rmt/redmine.rb index 2e43c13..9af80ea 100644 --- a/lib/rmt/redmine.rb +++ b/lib/rmt/redmine.rb @@ -102,10 +102,11 @@ def get_value_of_text_child_node(node, child_node_name) end private :get_value_of_text_child_node + # prepends the isue description with a link to the issue on Redmine def get_issue_description(node) issue_id = get_value_of_text_child_node(node, "id") description = get_value_of_text_child_node(node, "description") || "" - "#{description} #{@base_url}/issues/#{issue_id}" + "#{@base_url}/issues/#{issue_id} \n\n#{description}" end private :get_issue_description From 8bd6902f4f2e41a6a168d4eca1746fd8ba4969fe Mon Sep 17 00:00:00 2001 From: James Antrobus Date: Tue, 28 Aug 2012 23:41:07 +0100 Subject: [PATCH 3/3] fixed typo in comment --- lib/rmt/redmine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rmt/redmine.rb b/lib/rmt/redmine.rb index 9af80ea..d645ba8 100644 --- a/lib/rmt/redmine.rb +++ b/lib/rmt/redmine.rb @@ -102,7 +102,7 @@ def get_value_of_text_child_node(node, child_node_name) end private :get_value_of_text_child_node - # prepends the isue description with a link to the issue on Redmine + # prepends the issue description with a link to the issue on Redmine def get_issue_description(node) issue_id = get_value_of_text_child_node(node, "id") description = get_value_of_text_child_node(node, "description") || ""