Sha256: dd12429228829e4770d3b7e785efb7c39643660ebef86c78969431c8a3b444c4

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

- colorbox ||= false
.form-view
  %form#asset-insert{:action => "#{packet.route_to(model_name, 'new')}", :method => 'post', :enctype=>"multipart/form-data"}
    - if colorbox
      %input{:type => 'hidden', :name => "fake_xhr", :value => "1"}
    - for prop in props
      - next if [:path, :secondary_path].include?(prop[:name])
      %p= view_attribute(prop, model_name, :label => true)
    %p
      %label File
      %br
      %input{:type => 'file', :name => "#{model_name}[file]"}
    / %p
    /   %label Secondary File
    /   %br
    /   %input{:type => 'file', :name => "#{model_name}[file2]"}
    %input{:type => 'submit', :value => 'Save New Item'}
- if colorbox
  :javascript
    $("#asset-insert").ajaxForm({dataType: 'json', success: function(ret){ 
      var link = $.fn.colorbox.element();
      var preview = link.prev();
      var input_name = link.attr('rel');
      preview.html(ret.html);
      $("[name*='"+input_name+"']").attr("value", ret.id);
      link.attr("href", "/admin/assets/"+ret.id+"/change");
      link.text("Change Asset");
      $.fn.colorbox.close();
    }});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orange-sparkles-0.5.9 lib/orange-sparkles/views/assets/create.haml