--- server/views/images/index.xml.haml | 4 ++-- server/views/images/show.xml.haml | 4 ++-- server/views/instances/index.xml.haml | 10 ++++------ server/views/instances/show.xml.haml | 12 ++++-------- server/views/realms/index.xml.haml | 4 +--- server/views/realms/show.xml.haml | 9 ++++----- server/views/storage_snapshots/index.xml.haml | 6 ++---- server/views/storage_snapshots/show.xml.haml | 6 ++---- server/views/storage_volumes/index.xml.haml | 12 ++++++------ 9 files changed, 27 insertions(+), 40 deletions(-)
diff --git a/server/views/images/index.xml.haml b/server/views/images/index.xml.haml index 9236d02..82dd6bd 100644 --- a/server/views/images/index.xml.haml +++ b/server/views/images/index.xml.haml @@ -2,8 +2,8 @@ %images - @elements.each do |image| - if full_listing_mode?(:images) - %image{:href => image_url(image.id)} - - image.attributes.each do |attribute| + %image{:href => image_url(image.id), :id => image.id} + - image.attributes.select{ |attr| attr!=:id }.each do |attribute| - haml_tag("#{attribute}".tr('-', '_'), :<) do - haml_concat image.send(attribute) - else diff --git a/server/views/images/show.xml.haml b/server/views/images/show.xml.haml index fbb5d07..c3e2cc4 100644 --- a/server/views/images/show.xml.haml +++ b/server/views/images/show.xml.haml @@ -1,5 +1,5 @@ !!! XML -%image{:href => image_url(@image.id)} - - @image.attributes.each do |attribute| +%image{:href => image_url(@image.id), :id => @image.id} + - @image.attributes.select{ |attr| attr!=:id }.each do |attribute| - haml_tag(attribute, :<) do - haml_concat @image.send(attribute) diff --git a/server/views/instances/index.xml.haml b/server/views/instances/index.xml.haml index c6a208a..72672bc 100644 --- a/server/views/instances/index.xml.haml +++ b/server/views/instances/index.xml.haml @@ -2,15 +2,13 @@ %instances - @elements.each do |instance| - if full_listing_mode?(:instances) - %instance{:href => instance_url(instance.id)} - %id #{instance.id} + %instance{:href => instance_url(instance.id), :id => instance.id} %name #{instance.name} %owner_id #{instance.owner_id} - %image{:href => image_url(instance.image_id)} - %realm{:href => realm_url(instance.realm_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", { :href => hardware_profile_url(instance.instance_profile.id)} do - %id #{instance.instance_profile.id} + - 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 diff --git a/server/views/instances/show.xml.haml b/server/views/instances/show.xml.haml index 2881100..18f563e 100644 --- a/server/views/instances/show.xml.haml +++ b/server/views/instances/show.xml.haml @@ -1,18 +1,14 @@ !!! XML -%instance{:href => instance_url(@instance.id)} - %id< - =@instance.id +%instance{:href => instance_url(@instance.id), :id => @instance.id} %name< =@instance.name %owner_id< =@instance.owner_id - %image{:href => image_url(@instance.image_id)} - %realm{:href => realm_url(@instance.realm_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", {:href => hardware_profile_url(@instance.instance_profile.id)} do - %id< - =@instance.instance_profile.id + - 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 diff --git a/server/views/realms/index.xml.haml b/server/views/realms/index.xml.haml index 03dd3df..e67f282 100644 --- a/server/views/realms/index.xml.haml +++ b/server/views/realms/index.xml.haml @@ -1,9 +1,7 @@ !!!XML %realms - @elements.each do |realm| - %realm{:href => realm_url(realm.id)} - %id< - =realm.id + %realm{:href => realm_url(realm.id), :id => realm.id } %name< =realm.name %state< diff --git a/server/views/realms/show.xml.haml b/server/views/realms/show.xml.haml index 21ab97f..f53c46a 100644 --- a/server/views/realms/show.xml.haml +++ b/server/views/realms/show.xml.haml @@ -1,10 +1,9 @@ !!!XML -%realm{:href => realm_url(@realm.id)} - %id< - =@realm.id +%realm{:href => realm_url(@realm.id), :id => @realm.id } %name< =@realm.name %state< =@realm.state - %limit< - =@realm.limit.eql?(:unlimited) ? '' : @realm.limit + - unless @realm.limit.eql?(:unlimited) + %limit< + =@realm.limit diff --git a/server/views/storage_snapshots/index.xml.haml b/server/views/storage_snapshots/index.xml.haml index 46b362f..4813798 100644 --- a/server/views/storage_snapshots/index.xml.haml +++ b/server/views/storage_snapshots/index.xml.haml @@ -1,11 +1,9 @@ !!!XML %storage_snapshots - @elements.each do |snapshot| - %storage_snapshot{ :href => storage_snapshot_url(snapshot.id)} - %id< - =snapshot.id + %storage_snapshot{ :href => storage_snapshot_url(snapshot.id), :id => snapshot.id } %created< =snapshot.created %state< =snapshot.state - %storage_volume{ :href => storage_volume_url(snapshot.storage_volume_id)} + %storage_volume{ :href => storage_volume_url(snapshot.storage_volume_id), :id => snapshot.storage_volume_id } diff --git a/server/views/storage_snapshots/show.xml.haml b/server/views/storage_snapshots/show.xml.haml index 912f97a..8043d1b 100644 --- a/server/views/storage_snapshots/show.xml.haml +++ b/server/views/storage_snapshots/show.xml.haml @@ -1,9 +1,7 @@ !!!XML -%storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id)} - %id< - =@storage_snapshot.id +%storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id), :id => @storage_snapshot.id } %created< =@storage_snapshot.created %state< =@storage_snapshot.state - %storage_volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id)} + %storage_volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id), :id => @storage_snapshot.storage_volume_id} diff --git a/server/views/storage_volumes/index.xml.haml b/server/views/storage_volumes/index.xml.haml index bc55ff4..a96ab61 100644 --- a/server/views/storage_volumes/index.xml.haml +++ b/server/views/storage_volumes/index.xml.haml @@ -1,13 +1,13 @@ !!!XML %storage_volumes - @elements.each do |volume| - %storage_volume{ :href => storage_volume_url(volume.id)} - %id< - =volume.id + %storage_volume{ :href => storage_volume_url(volume.id), :id => volume.id } %created< =volume.created %capacity< =volume.capacity - %device< - =volume.device - %instance{:href => volume.instance_id} + - unless volume.device.nil? + %device< + =volume.device + - unless volume.instance_id.nil? + %instance{:href => instance_url(volume.instance_id), :id => volume.instance_id}