Skip to content

Commit

Permalink
[webui][api] Increase readability by storing xml attribute data in a …
Browse files Browse the repository at this point in the history
…variable
  • Loading branch information
bgeuken committed Aug 18, 2015
1 parent 2ef1399 commit e67794c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/api/app/models/channel_binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ def to_axml(opts={})
# Creates an xml builder object for all binaries
def create_xml(options = {})
channel = channel_binary_list.channel

builder = Nokogiri::XML::Builder.new
builder.channel(project: channel.package.project.name, package: channel.package.name) do |c|
attributes = {
project: channel.package.project.name,
package: channel.package.name
}
builder.channel(attributes) do |c|
p={}
p[:package] = package if package
p[:name] = name if name
Expand All @@ -74,10 +79,18 @@ def create_xml(options = {})
end

def create_channel_node_element(channel_node, channel_target)
channel_node.target(project: channel_target.repository.project.name, repository: channel_target.repository.name) do |target|
target.disabled() if channel_target.disabled
attributes = {
project: channel_target.repository.project.name,
repository: channel_target.repository.name
}
channel_node.target(attributes) do |target|
target.disabled if channel_target.disabled
channel_target.repository.product_update_repositories.each do |up|
target.updatefor(up.product.extend_id_hash({project: up.product.package.project.name, product: up.product.name}))
attributes = {
project: up.product.package.project.name,
product: up.product.name
}
target.updatefor(up.product.extend_id_hash(attributes))
end
end
end
Expand Down

0 comments on commit e67794c

Please sign in to comment.