You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2010/09/23 14:56:25 UTC
svn commit: r1000442 - in /incubator/deltacloud/trunk/server:
lib/sinatra/respond_to.rb server.rb views/buckets/index.xml.haml
views/buckets/show.xml.haml
Author: marios
Date: Thu Sep 23 12:56:25 2010
New Revision: 1000442
URL: http://svn.apache.org/viewvc?rev=1000442&view=rev
Log:
--> minor fixes in haml for consistency (showing blobs and links to them when viewing buckets - index and show).
--> remove hack in respond_to for content negotiation
Modified:
incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb
incubator/deltacloud/trunk/server/server.rb
incubator/deltacloud/trunk/server/views/buckets/index.xml.haml
incubator/deltacloud/trunk/server/views/buckets/show.xml.haml
Modified: incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb?rev=1000442&r1=1000441&r2=1000442&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/respond_to.rb Thu Sep 23 12:56:25 2010
@@ -43,8 +43,6 @@ module Sinatra
app.before do
# Let through sinatra image urls in development
next if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png}
- #FIXME using ?format to do content negotiation for buckets so skip negotiation here?
- next if request.path_info =~ (/\/api\/buckets\/*/)
unless options.static? && options.public? && (request.get? || request.head?) && static_file?(request.path_info)
rpi = request.path_info.sub(%r{\.([^\./]+)$}, '')
Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1000442&r1=1000441&r2=1000442&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Thu Sep 23 12:56:25 2010
@@ -358,22 +358,14 @@ collection :keys do
end
-VALID_RESPONSE_FORMATS = ['xml', 'XML', 'html', 'HTML', 'json', 'JSON']
-#--
-#* F * I * X * M * E - will ultimately use Accept header to do this
-#--
get '/api/buckets/:bucket/:blob' do
- response_format = params['format'] unless (params['format'].nil? || !VALID_RESPONSE_FORMATS.include?(params['format']))
- response_format ||= 'html'
@blob = driver.blob(credentials, { :id => params[:blob], 'bucket' => params[:bucket]})
if @blob
respond_to do |format|
- case response_format
- when /html/i then format.html { haml :'blobs/show' }
- when /xml/i then format.xml { haml :'blobs/show' }
- when /json/i then format.json { convert_to_json(blobs, @blob) }
+ format.html { haml :"blobs/show" }
+ format.xml { haml :"blobs/show" }
+ format.json { convert_to_json(blobs, @blob) }
end
- end
else
report_error(404, 'not_found')
end
Modified: incubator/deltacloud/trunk/server/views/buckets/index.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/index.xml.haml?rev=1000442&r1=1000441&r2=1000442&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/index.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/index.xml.haml Thu Sep 23 12:56:25 2010
@@ -3,5 +3,8 @@
- @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)
+ - unless attribute == :blob_list
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
+ - haml_concat bucket.send(attribute)
+ - bucket.blob_list.each do |blb|
+ %blob{ :id => blb, :href => bucket_url(bucket.id) +"/#{blb}"}
Modified: incubator/deltacloud/trunk/server/views/buckets/show.xml.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/show.xml.haml?rev=1000442&r1=1000441&r2=1000442&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/show.xml.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/show.xml.haml Thu Sep 23 12:56:25 2010
@@ -5,4 +5,4 @@
-haml_tag(attribute, :<) do
- haml_concat @bucket.send(attribute)
- @bucket.blob_list.each do |blb|
- %blob{:href => bucket_url(@bucket.id + blb), :id => blb}
+ %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"}
\ No newline at end of file