On Thursday 14 July 2011 10:09:49 Stephan Kulow wrote:
Mittwoch, 13. Juli 2011 sent OBS build:
From: Sascha Peilicke
Needs some more visual refinement (i.e. github-like diff view). ---
src/webui/app/controllers/request_controller.rb | 14 +++++++++++++- src/webui/app/views/request/show.html.erb | 11 +++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/webui/app/controllers/request_controller.rb b/src/webui/app/controllers/request_controller.rb index b6746d8..a956ec4 100644 --- a/src/webui/app/controllers/request_controller.rb +++ b/src/webui/app/controllers/request_controller.rb @@ -1,3 +1,5 @@ +require 'base64' +
class RequestController < ApplicationController
include ApplicationHelper
@@ -101,7 +103,17 @@ class RequestController < ApplicationController
# get the entire diff from the api begin
transport ||= ActiveXML::Config::transport_for :bsrequest
- @diff_text = transport.direct_http URI("/request/#{@id}?cmd=diff"),
:method => "POST", :data => "" + ret =
transport.direct_http(URI("/request/#{@id}?cmd=diff&view=xml"), :method => 'POST', :data => '') + doc = XML::Parser.string(ret).parse.root + @diff_per_action_hash = {} + # Parse each action and get the it's diff (per file) + doc.find('/action').each_with_index do |action_element, index| + file_diff_hash = {}
Direct usage of XML::Parser should be banned now and in the future.
doc = ActiveXML::Base.new(ret) doc.each_with_index("/action") will do Already solved in a recent commit ;) -- Mit freundlichen Grüßen, Sascha Peilicke