- content_for('page_scripts') do :plain function toggle_upload_popup() { var popup = $('upload-popup'); center(popup); Element.toggle(popup); } function uploadInProgress() { $('upload_button').disabled = true; //$('upload_file').disabled = true; $('busy').appear(); } function showErrorsPopup() { var popup = $('upload-errors-popup'); center(popup); popup.show(); $('upload-popup').hide(); $('busy').hide(); $('upload_button').disabled = false; $('upload_file').disabled = false; } - if model_name == 'stylesheet' %h1 Stylesheets %p Cascading Stylesheets (CSS files) can be used to alter the look & feel of your pages, layouts, and/or snippets. - elsif model_name == 'javascript' %h1 Javascripts %p Javascripts add dynamic behaviors that can be used within your pages, layouts, and/or snippets. %table.index{:id => model_name, :cellspacing => 0, :border => 0, :cellpadding => 0} %thead %tr %th{:class => model_name} = proper_model_name %th.modify Modify %tbody - unless @text_assets.empty? - @text_assets.each do |text_asset| %tr.node.level-1 -# this next class is dumb but Radiant hard coded for the Snippet class so we'll just piggyback on that... %td.snippet = image(model_name, :alt => "#{model_name}-icon", :title => text_asset.url) %span= link_to(text_asset.filename, send("#{model_name}_edit_url", :id => text_asset), :title => text_asset.url) %td.remove = link_to image('remove', :alt => "Remove #{proper_model_name}"), send("#{model_name}_remove_url", :id => text_asset) - else %tr %td.note{:colspan => 2}== No #{proper_model_name.pluralize} %p = link_to(image("new-#{model_name}", :alt => "New #{proper_model_name}"), send("#{model_name}_new_url"))    = link_to image("upload-#{model_name}", :alt => "Upload #{proper_model_name}"), "#", :onclick => "toggle_upload_popup(); return false;" - content_for 'popups' do .popup#upload-popup{:style => 'display:none;width:20em'} #busy.busy{:style => "display: none"}= image 'spinner.gif' %h3== Upload #{proper_model_name} - form_for :upload, :url => send("#{model_name}_upload_url"),:html => { :multipart => true, :target => 'upload_frame', :onsubmit => 'uploadInProgress();' } do |f| %p %label{:for => 'upload_file'}== Select a #{model_name} file: %p= f.file_field :file %p= submit_tag 'Upload', :id => 'upload_button' %p= link_to_function 'Close', "Element.hide('upload-popup')", :class => 'close-link' %iframe{:id => 'upload_frame', :name => "upload_frame", :style => "width:1px;height:1px;border:0px", :src => "about:blank"} .popup#upload-errors-popup{:style => 'display:none'} %h3== Upload Errors %p The file upload experinced the following errors: %div{:id => "errors_for_#{model_name}"} %p= link_to_function 'Close', "Element.hide('upload-errors-popup')", :class => 'close-link'