Mailinglist Archive: opensuse-buildservice (120 mails)

< Previous Next >
[opensuse-buildservice] Re: [PATCH] [webui] Initial display of per-action-per-file diff request view.
Mittwoch, 13. Juli 2011 sent OBS build:
From: Sascha Peilicke <saschpe@xxxxxxx>

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

Greetings, Stephan


--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups