From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]>
---
server/views/buckets/index.xml.haml | 10 ++----
server/views/buckets/show.xml.haml | 8 +++--
server/views/images/index.xml.haml | 17 ++--------
server/views/images/show.xml.haml | 3 +-
server/views/instances/index.xml.haml | 38 +-----------------------
server/views/instances/show.xml.haml | 3 +-
server/views/load_balancers/index.xml.haml | 1 -
server/views/realms/index.xml.haml | 10 +-----
server/views/realms/show.xml.haml | 3 +-
server/views/storage_snapshots/index.xml.haml | 7 +---
server/views/storage_snapshots/show.xml.haml | 3 +-
11 files changed, 26 insertions(+), 77 deletions(-)
diff --git a/server/views/buckets/index.xml.haml
b/server/views/buckets/index.xml.haml
index e8cbeec..9f1fd20 100644
--- a/server/views/buckets/index.xml.haml
+++ b/server/views/buckets/index.xml.haml
@@ -1,8 +1,4 @@
-!!! XML
+!!!XML
%buckets
- - @elements.each do |bucket|
- %bucket{:href => bucket_url(bucket.id), :id => bucket.id}
- - bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
- - haml_tag("#{attribute}".tr('-', '_'), :<) do
- - haml_concat bucket.send(attribute)
-
+ - @elements.each do |c|
+ = haml :'buckets/show', :locals => { :@bucket => c, :partial => true }
diff --git a/server/views/buckets/show.xml.haml
b/server/views/buckets/show.xml.haml
index 9b650e2..67f6935 100644
--- a/server/views/buckets/show.xml.haml
+++ b/server/views/buckets/show.xml.haml
@@ -1,8 +1,10 @@
-!!! XML
+- unless defined?(partial)
+ !!! XML
%bucket{:href => bucket_url(@bucket.id), :id => @bucket.id}
- @bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
- unless attribute == :blob_list
-haml_tag(attribute, :<) do
- haml_concat @bucket.send(attribute)
- - @bucket.blob_list.each do |blb|
- %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"}
\ No newline at end of file
+ - if @bucket.blob_list
+ - @bucket.blob_list.each do |blb|
+ %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"}
diff --git a/server/views/images/index.xml.haml
b/server/views/images/index.xml.haml
index b05bf73..52d86e6 100644
--- a/server/views/images/index.xml.haml
+++ b/server/views/images/index.xml.haml
@@ -1,14 +1,5 @@
-!!! XML
+- unless defined?(partial)
+ !!! XML
%images
- - @elements.each do |image|
- %image{:href => image_url(image.id), :id => image.id}
- - image.attributes.select{ |attr| attr!=:id }.each do |attribute|
- - haml_tag("#{attribute}".tr('-', '_'), :<) do
- - if [:name, :description].include?(attribute)
- =cdata do
- - haml_concat image.send(attribute)
- - else
- - haml_concat image.send(attribute)
- %actions
- %link{ :rel => 'create_instance', :method => :post, :href =>
"#{instances_url};image_id=#{image.id}"}
-
+ - @elements.each do |c|
+ = haml :'images/show', :locals => { :@image => c, :partial => true }
diff --git a/server/views/images/show.xml.haml
b/server/views/images/show.xml.haml
index b35b249..c1f5348 100644
--- a/server/views/images/show.xml.haml
+++ b/server/views/images/show.xml.haml
@@ -1,4 +1,5 @@
-!!! XML
+- unless defined?(partial)
+ !!! XML
%image{:href => image_url(@image.id), :id => @image.id}
- @image.attributes.select{ |attr| attr!=:id }.each do |attribute|
- haml_tag(attribute, :<) do
diff --git a/server/views/instances/index.xml.haml
b/server/views/instances/index.xml.haml
index 0f317ba..e5f39ba 100644
--- a/server/views/instances/index.xml.haml
+++ b/server/views/instances/index.xml.haml
@@ -1,38 +1,4 @@
!!! XML
%instances
- - @elements.each do |instance|
- %instance{:href => instance_url(instance.id), :id => instance.id}
- %name #{instance.name}
- %owner_id #{instance.owner_id}
- %image{:href => image_url(instance.image_id), :id => instance.image_id }
- %realm{:href => realm_url(instance.realm_id), :id => instance.realm_id }
- %state #{instance.state}
- - haml_tag :"hardware_profile", { :id => instance.instance_profile.id,
:href => hardware_profile_url(instance.instance_profile.id)} do
- - instance.instance_profile.overrides.each do |p, v|
- %property{:kind => 'fixed', :name => p, :value => v, :unit =>
Deltacloud::HardwareProfile::unit(p)}
- %actions
- - instance.actions.compact.each do |action|
- %link{:rel => action, :href => self.send("#{action}_instance_url",
instance.id), :method => instance_action_method(action)}
- - if driver.respond_to?(:run_on_instance)
- %link{:rel => 'run', :method => :post, :href =>
run_instance_url(instance.id)}
- - if instance.can_create_image?
- %link{:rel => 'create_image', :method => :post, :href =>
"#{create_image_url};instance_id=#{instance.id}"}
- %public_addresses
- - instance.public_addresses.each do |address|
- %address #{address}
- %private_addresses
- - instance.private_addresses.each do |address|
- %address #{address}
- - if driver_has_auth_features?
- %authentication{ :type => driver_auth_feature_name }
- - if instance.authn_feature_failed?
- %error #{instance.authn_error}
- - else
- - if driver_auth_feature_name == 'password'
- %login
- %username #{instance.username}
- %password #{instance.password}
- - if driver_auth_feature_name == 'key'
- %login
- %keyname #{instance.keyname}
-
+ - @elements.each do |c|
+ = haml :'instances/show', :locals => { :@instance => c, :partial => true }
diff --git a/server/views/instances/show.xml.haml
b/server/views/instances/show.xml.haml
index 45cd84b..efbdac1 100644
--- a/server/views/instances/show.xml.haml
+++ b/server/views/instances/show.xml.haml
@@ -1,4 +1,5 @@
-!!! XML
+- unless defined?(partial)
+ !!! XML
%instance{:href => instance_url(@instance.id), :id => @instance.id}
- if @instance.name
%name<
diff --git a/server/views/load_balancers/index.xml.haml
b/server/views/load_balancers/index.xml.haml
index 22c6911..053b628 100644
--- a/server/views/load_balancers/index.xml.haml
+++ b/server/views/load_balancers/index.xml.haml
@@ -1,4 +1,3 @@
-
!!!XML
%load_balancers
- @elements.each do |c|
diff --git a/server/views/realms/index.xml.haml
b/server/views/realms/index.xml.haml
index e67f282..71d1cb1 100644
--- a/server/views/realms/index.xml.haml
+++ b/server/views/realms/index.xml.haml
@@ -1,10 +1,4 @@
!!!XML
%realms
- - @elements.each do |realm|
- %realm{:href => realm_url(realm.id), :id => realm.id }
- %name<
- =realm.name
- %state<
- =realm.state
- %limit<
- =realm.limit.eql?(:unlimited) ? '' : realm.limit
+ - @elements.each do |c|
+ = haml :'realms/show', :locals => { :@realm => c, :partial => true }
diff --git a/server/views/realms/show.xml.haml
b/server/views/realms/show.xml.haml
index f53c46a..42f77c3 100644
--- a/server/views/realms/show.xml.haml
+++ b/server/views/realms/show.xml.haml
@@ -1,4 +1,5 @@
-!!!XML
+- unless defined?(partial)
+ !!! XML
%realm{:href => realm_url(@realm.id), :id => @realm.id }
%name<
[email protected]
diff --git a/server/views/storage_snapshots/index.xml.haml
b/server/views/storage_snapshots/index.xml.haml
index 8748532..9ae9675 100644
--- a/server/views/storage_snapshots/index.xml.haml
+++ b/server/views/storage_snapshots/index.xml.haml
@@ -1,7 +1,4 @@
!!!XML
%storage_snapshots
- - @elements.each do |snapshot|
- %storage_snapshot{ :href => storage_snapshot_url(snapshot.id), :id =>
snapshot.id }
- %created<
- =snapshot.created
- %storage_volume{ :href =>
storage_volume_url(snapshot.storage_volume_id), :id =>
snapshot.storage_volume_id }
+ - @elements.each do |c|
+ = haml :'storage_snapshots/show', :locals => { :@storage_snapshot => c,
:partial => true }
diff --git a/server/views/storage_snapshots/show.xml.haml
b/server/views/storage_snapshots/show.xml.haml
index 3cfa8a6..f9596a6 100644
--- a/server/views/storage_snapshots/show.xml.haml
+++ b/server/views/storage_snapshots/show.xml.haml
@@ -1,4 +1,5 @@
-!!!XML
+- unless defined?(partial)
+ !!! XML
%storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id), :id =>
@storage_snapshot.id }
%created<
=@storage_snapshot.created
--
1.7.4.1