% config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env] access_key = config['access_key_id'] secret_key = config['secret_access_key'] bucket = config['bucket'] policy = { "expiration" => 1.hour.from_now.utc.xmlschema, "conditions" => [ { "bucket" => "#{bucket}-uploads" }, { "acl" => "public-read" }, [ "starts-with", "$key", '' ], #[ "starts-with", "$Content-Type", 'image/' ], [ 'starts-with', '$name', '' ], [ 'starts-with', '$Filename', '' ], ] } @policy = Base64.encode64(policy.to_json).gsub(/\n/,'') @signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret_key, @policy)).gsub("\n","") @s3_upload_url = "https://#{bucket}-uploads.s3.amazonaws.com/" @aws_access_key_id = access_key @top_media_category = Caboose::MediaCategory.top_category(@site.id) #=============================================================================== base_url = @block.page_id ? "/admin/pages/#{@block.page_id}/blocks" : "/admin/posts/#{@block.post_id}/blocks" crumbs = [] b = @block while b href = b.id == @block.id ? "#" : "#{base_url}/#{b.id}/edit" text = b.name ? "#{b.block_type.description} (#{b.name})" : b.block_type.description crumbs << "#{text}" b = b.parent end %>
<% content_for :caboose_css do %> <%= stylesheet_link_tag 'caboose/admin_block_edit_image' %> <%= stylesheet_link_tag 'plupload/jquery.ui.plupload/css/jquery.ui.plupload.css' %> <% end %> <% content_for :caboose_js do %> <%= javascript_include_tag "caboose/model/all" %> <%= javascript_include_tag "caboose/block_media_controller" %> <%= javascript_include_tag 'caboose/jquery-ui.drag-multiple.min.js' %> <%= javascript_include_tag 'plupload/plupload.full.min.js' %> <%= javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js' %> <% #javascript_include_tag 'plupload/moxie.js' #javascript_include_tag 'plupload/plupload.dev.js' #javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js' %> <% end %>