Module: ChikkenInaBukket::Views
- Defined in:
- lib/chikken_in_a_bukket.rb
Instance Method Summary collapse
- #add_file_form ⇒ Object
- #bucket ⇒ Object
- #config_link ⇒ Object
- #configuration ⇒ Object
- #delete_bucket_link(bucket, *text) ⇒ Object
- #detail ⇒ Object
- #index ⇒ Object
- #layout ⇒ Object
- #separator ⇒ Object
Instance Method Details
#add_file_form ⇒ Object
402 403 404 405 406 407 408 409 410 411 |
# File 'lib/chikken_in_a_bukket.rb', line 402 def add_file_form h1 "Add a new file to #{@bucket}" fieldset do legend "File to upload" form :method => "post", :enctype => "multipart/form-data" do input :name => "File", :type => "file", :size => 30 p { input :type => "submit", :value => "Upload" } end end end |
#bucket ⇒ Object
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/chikken_in_a_bukket.rb', line 349 def bucket h1 "Files in bucket #{@bucket}" h3 "#{@objs.length} objects in this bucket" a "All buckets", :href => R(Index) separator delete_bucket_link(@bucket, "Delete this bucket") separator config_link separator a "Upload a file", :href => R(AddFile, @bucket) ul do @objs.each do |f| li do a "#{f.key} (#{number_to_human_size f.size})", :href => R(Details, @bucket, f.key) span :class => 'delete' do a "[Delete]", :href => R(Delete, @bucket, f.key), :onclick => "return confirm('Are you sure you want to delete #{f.key}?');" end end end end if @previous_url a "Back", :href => @previous_url end separator if @previous_url and @next_url if @next_url a "More", :href => @next_url end end |
#config_link ⇒ Object
291 292 293 |
# File 'lib/chikken_in_a_bukket.rb', line 291 def config_link a "S3 Configuration", :href => R(Configuration) end |
#configuration ⇒ Object
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/chikken_in_a_bukket.rb', line 413 def configuration h1 "Your S3 Configuration" a "Return to top", :href => R(Index) p "You're not letting anyone look at this over your shoulder, are you?" form :action => R(Configuration), :method => "post", :onsubmit => "return confirm('Are you sure you want to change these?');" do label "Access Key:", :for => 'access_key' input :value => ChikkenInaBukket::Config.access_key, :name => "access_key", :type => "text", :id => "access_key", :size => 30 label "Secret Key", :for => "secret_key" input :value => ChikkenInaBukket::Config.secret_key, :name => "secret_key", :type => "text", :id => "secret_key", :size => 40 br p do input :type => "submit", :name => "submit", :value => "Change 'em!" input :type => "reset", :name => "reset", :value => "Nah, forget it" end end end |
#delete_bucket_link(bucket, *text) ⇒ Object
295 296 297 298 299 |
# File 'lib/chikken_in_a_bukket.rb', line 295 def delete_bucket_link(bucket, *text) a (text.first ? text.first : "Delete"), :href => R(DeleteBucket, bucket), :onclick => "return confirm('Are you sure you want to delete the bucket #{bucket}?');" end |
#detail ⇒ Object
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/chikken_in_a_bukket.rb', line 383 def detail h1 "Attributes for #{@obj.key}" a "All buckets", :href => R(Index) separator a "Back to #{@bucket.name}", :href => R(Buckets, @bucket.name) separator config_link ul do li "Content-Type: #{@obj.content_type}" li "E-Tag: #{@obj.etag}" li "Last-Modified: #{@obj.last_modified}" li "Size: #{number_to_human_size(@obj.size)}" end a "Download this file", :href => @url separator a "Delete this file", :href => R(Delete, @bucket.name, @obj.key), :onclick => "return confirm('Are you sure you want to delete this object?')" end |
#index ⇒ Object
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/chikken_in_a_bukket.rb', line 320 def index h1 "Welcome to your S3 Storage" h2 "Your current buckets are:" if @flash h3 @flash, :class => 'flash' end ul do @buckets.each do |bucket| li do a bucket, :href => R(Buckets, bucket) span :class => 'delete' do delete_bucket_link(bucket, "[Delete]") end end end end form :action => "/", :method => "post" do fieldset do label "Create a new bucket" input :type => "text", :name => "bucket", :size => 25, :class => "bucket" input :type => "submit", :name => "Submit", :value => "Make it so!" end end hr config_link end |
#layout ⇒ Object
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/chikken_in_a_bukket.rb', line 301 def layout html do head do title 'Chikken in a Bukket' link :rel => 'stylesheet', :type => 'text/css', :href => '/style.css', :media => 'screen' end body do self << yield div :class => 'bucket' do img :src => R(BucketImage) end end end end |
#separator ⇒ Object
287 288 289 |
# File 'lib/chikken_in_a_bukket.rb', line 287 def separator span "|", :class => "separator" end |