I'm not very fluent in HAML (sigh), but it looks to me like:
buckets/index.html and buckets/show.html will list blobs within each
bucket
buckets/index.xml will list bucket *attributes*
buckets/show.xml will list *both*
Shouldn't there be more consistency among these?
On 09/20/2010 02:52 PM, [email protected] wrote:
> From: marios <[email protected]>
>
> ---
> server/views/blobs/show.html.haml | 21 ++++++++++++++++++++
> server/views/blobs/show.xml.haml | 7 ++++++
> server/views/buckets/index.html.haml | 35
> ++++++++++++++++++++++++++++++++++
> server/views/buckets/index.xml.haml | 8 +++++++
> server/views/buckets/new.html.haml | 13 ++++++++++++
> server/views/buckets/show.html.haml | 19 ++++++++++++++++++
> server/views/buckets/show.xml.haml | 9 ++++++++
> 7 files changed, 112 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/buckets/index.html.haml
> create mode 100644 server/views/buckets/index.xml.haml
> create mode 100644 server/views/buckets/new.html.haml
> create mode 100644 server/views/buckets/show.html.haml
> create mode 100644 server/views/buckets/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..68042c8
> --- /dev/null
> +++ b/server/views/blobs/show.html.haml
> @@ -0,0 +1,21 @@
> +%h1 Blob
> +%h2
> + = @blob.id
> +
> +%dl
> + %dt bucket
> + %dd
> + = @blob.bucket
> + %dt Content_Length
> + %dd
> + = @blob.content_length
> + %dt Content_Type
> + %dd
> + = @blob.content_type
> + %dt Last_Modified
> + %dd
> + = @blob.last_modified
> + %dt Content
> + %dd
> + =link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id +
> '/content'
> +
> diff --git a/server/views/blobs/show.xml.haml
> b/server/views/blobs/show.xml.haml
> new file mode 100644
> index 0000000..bc499ca
> --- /dev/null
> +++ b/server/views/blobs/show.xml.haml
> @@ -0,0 +1,7 @@
> +!!! XML
> +%blob{:href => bucket_url(@blob.bucket) + '/' + @blob.id, :id => @blob.id}
> + - @blob.attributes.select{ |attr| attr!=:id}.each do |attribute|
> + - unless attribute == :content
> + - haml_tag(attribute, :<) do
> + - haml_concat @blob.send(attribute)
> + %content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content'}
> diff --git a/server/views/buckets/index.html.haml
> b/server/views/buckets/index.html.haml
> new file mode 100644
> index 0000000..2b5377a
> --- /dev/null
> +++ b/server/views/buckets/index.html.haml
> @@ -0,0 +1,35 @@
> +%h1
> + Buckets
> +%br
> +%p
> + =link_to 'Create new bucket', "/api/buckets/new"
> +
> +%table.display
> + %thead
> + %tr
> + %th
> + ID
> + %th
> + Name
> + %th
> + Size
> + %th
> + Blob List
> + %th
> +
> + %tbody
> + - @buckets.each do |bucket|
> + %tr
> + %td
> + = link_to bucket.id, bucket_url(bucket.id)
> + %td
> + = bucket.name
> + %td
> + = bucket.size
> + %td
> + -bucket.blob_list.each do |blob|
> + = blob
> + %td
> + =link_to 'Delete', destroy_bucket_url(bucket.name), :class =>
> 'delete'
> +
> +
> diff --git a/server/views/buckets/index.xml.haml
> b/server/views/buckets/index.xml.haml
> new file mode 100644
> index 0000000..e8cbeec
> --- /dev/null
> +++ b/server/views/buckets/index.xml.haml
> @@ -0,0 +1,8 @@
> +!!! 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)
> +
> diff --git a/server/views/buckets/new.html.haml
> b/server/views/buckets/new.html.haml
> new file mode 100644
> index 0000000..14acf04
> --- /dev/null
> +++ b/server/views/buckets/new.html.haml
> @@ -0,0 +1,13 @@
> +%h1 New Bucket
> +
> +%form{ :action => buckets_url, :method => :post }
> + %label
> + Bucket Name:
> + %input{ :name => 'name', :size => 250}/
> + %br
> + -if driver_has_bucket_location_feature?
> + %p
> + %label
> + Location: (optional)
> + %input{ :name => 'location', :size => 20 }/
> + %input{ :type => :submit, :name => "commit", :value => "create"}/
> diff --git a/server/views/buckets/show.html.haml
> b/server/views/buckets/show.html.haml
> new file mode 100644
> index 0000000..d704867
> --- /dev/null
> +++ b/server/views/buckets/show.html.haml
> @@ -0,0 +1,19 @@
> +%h1 Bucket
> +%h2
> + = @bucket.id
> +
> +%dl
> + %di
> + %dt Name
> + %dd
> + = @bucket.name
> + %dt Size
> + %dd
> + = @bucket.size
> + %dt Blobs
> + %dd
> + [email protected]_list.each do |blob|
> + = link_to blob, bucket_url(@bucket.name) + '/' + blob
> + %dt delete bucket (must be empty)
> + %dd
> + =link_to 'Delete', destroy_bucket_url(@bucket.name), :class => 'delete'
> diff --git a/server/views/buckets/show.xml.haml
> b/server/views/buckets/show.xml.haml
> new file mode 100644
> index 0000000..e61470f
> --- /dev/null
> +++ b/server/views/buckets/show.xml.haml
> @@ -0,0 +1,9 @@
> +!!! 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{:href => bucket_url(@bucket.id + blb), :id => blb}
> +