Sha256: b8aeccd4359a7ff0347867a7949ce762a1b838aa9f0ef657a1c0de2836407dba

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

- packet.add_js("page-list-effects.js", :module => "_sparkles_")
- colorbox ||= false
.list-view
  .asset-list
    - for asset in list
      .asset-tile{:id => asset.id}
        %p.asset_tag
          -if(asset.image?)
            = asset.to_asset_tag
          -elsif(asset.pdf?)
            %img{:src => '/assets/_sparkles_/images/pdf_icon.png'}
          -else
            %img{:src => '/assets/_sparkles_/images/file_icon.png'}
        %p.asset_name
          - name = asset.name.size > 50 ? asset.name[0,50] + '...' : asset.name
          - name = name.blank? ? "Untitled Asset ##{asset.id}" : name
          - if colorbox
            %em= name
          - else
            %em
              %a{:href => route_to(:assets, asset.id, :edit)}= name
  %br.clearfix
  - unless colorbox
    %a.button.add-button{:href => route_to(model_name, 'create'), :style => "float: right"} Upload new asset
  %br.clearfix
- if colorbox
  :javascript
    $(".asset-tile .asset_tag a").click(function(ret){ 
      var tile = $(this).closest('.asset-tile');
      var id = tile.attr("id");
      $.markItUp({ replaceWith: '<o:asset id="'+id+'" />' } );
      $.fn.colorbox.close();
      return false;
    });
    $(".asset-tile").click(function(ret){ 
      var tile = $(this);
      var link = $.fn.colorbox.element();
      var preview = link.prev();
      var input_name = link.attr('rel');
      var id = tile.attr("id");
      preview.html(tile.children(".asset_tag").html());
      $("[name*='"+input_name+"']").attr("value", id);
      link.attr("href", "/admin/assets/"+tile.attr("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/list.haml