You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2010/08/13 23:30:14 UTC
['PATCH' 3/3] basic blobstore functions - views haml for container, blob [3/3]
From: marios <ma...@redhat.com>
---
server/views/blobs/show.html.haml | 18 ++++++++++++++++++
server/views/blobs/show.xml.haml | 5 +++++
server/views/containers/index.html.haml | 27 +++++++++++++++++++++++++++
server/views/containers/index.xml.haml | 8 ++++++++
server/views/containers/show.html.haml | 16 ++++++++++++++++
server/views/containers/show.xml.haml | 9 +++++++++
6 files changed, 83 insertions(+), 0 deletions(-)
create mode 100644 server/views/blobs/show.html.haml
create mode 100644 server/views/blobs/show.xml.haml
create mode 100644 server/views/containers/index.html.haml
create mode 100644 server/views/containers/index.xml.haml
create mode 100644 server/views/containers/show.html.haml
create mode 100644 server/views/containers/show.xml.haml
diff --git a/server/views/blobs/show.html.haml b/server/views/blobs/show.html.haml
new file mode 100644
index 0000000..f038b8e
--- /dev/null
+++ b/server/views/blobs/show.html.haml
@@ -0,0 +1,18 @@
+%h1 Blob
+%h2
+ = @blob.id
+
+%dl
+ %dt Container
+ %dd
+ = @blob.container
+ %dt Content_Length
+ %dd
+ = @blob.content_length
+ %dt Content_Type
+ %dd
+ = @blob.content_type
+ %dt Last_Modified
+ %dd
+ = @blob.last_modified
+
diff --git a/server/views/blobs/show.xml.haml b/server/views/blobs/show.xml.haml
new file mode 100644
index 0000000..0f8597e
--- /dev/null
+++ b/server/views/blobs/show.xml.haml
@@ -0,0 +1,5 @@
+!!! XML
+%blob{:href => container_url(@blob.container) + '/' + @blob.id, :id => @blob.id}
+ - @blob.attributes.select{ |attr| attr!=:id }.each do |attribute|
+ -haml_tag(attribute, :<) do
+ - haml_concat @blob.send(attribute)
\ No newline at end of file
diff --git a/server/views/containers/index.html.haml b/server/views/containers/index.html.haml
new file mode 100644
index 0000000..a199ace
--- /dev/null
+++ b/server/views/containers/index.html.haml
@@ -0,0 +1,27 @@
+%h1
+ Containers
+
+%table.display
+ %thead
+ %tr
+ %th
+ ID
+ %th
+ Name
+ %th
+ Size
+ %th
+ Blob List
+
+ %tbody
+ - @containers.each do |container|
+ %tr
+ %td
+ = link_to container.id, container_url(container.id)
+ %td
+ = container.name
+ %td
+ = container.size
+ %td
+ -container.blob_list.each do |blob|
+ = blob
\ No newline at end of file
diff --git a/server/views/containers/index.xml.haml b/server/views/containers/index.xml.haml
new file mode 100644
index 0000000..86c4349
--- /dev/null
+++ b/server/views/containers/index.xml.haml
@@ -0,0 +1,8 @@
+!!! XML
+%containers
+ - @elements.each do |container|
+ %container{:href => container_url(container.id), :id => container.id}
+ - container.attributes.select{ |attr| attr!=:id }.each do |attribute|
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
+ - haml_concat container.send(attribute)
+
diff --git a/server/views/containers/show.html.haml b/server/views/containers/show.html.haml
new file mode 100644
index 0000000..dea2603
--- /dev/null
+++ b/server/views/containers/show.html.haml
@@ -0,0 +1,16 @@
+%h1 Container
+%h2
+ = @container.id
+
+%dl
+ %di
+ %dt Name
+ %dd
+ = @container.name
+ %dt Size
+ %dd
+ = @container.size
+ %dt Objects
+ %dd
+ -@container.blob_list.each do |blob|
+ = link_to blob, container_url(@container.name) + '/' + blob
\ No newline at end of file
diff --git a/server/views/containers/show.xml.haml b/server/views/containers/show.xml.haml
new file mode 100644
index 0000000..df27074
--- /dev/null
+++ b/server/views/containers/show.xml.haml
@@ -0,0 +1,9 @@
+!!! XML
+%container{:href => container_url(@container.id), :id => @container.id}
+ - @container.attributes.select{ |attr| attr!=:id }.each do |attribute|
+ - unless attribute == :blob_list
+ -haml_tag(attribute, :<) do
+ - haml_concat @container.send(attribute)
+ - @container.blob_list.each do |blb|
+ %blob{:href => container_url(@container.id + blb), :id => blb}
+
\ No newline at end of file
--
1.7.2.1