Sha256: 0f7132bf789e51aa34bf35ad80ef2b83694939c237c18c2aaad3f01b4f3247d8

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

.col-lg-4.panel.panel-success
  .panel-heading Images
  .well.well-sm Upload an image, and then add it to the post with the add button
  = fields_for Blabs::Image.new do |f|
    = f.file_field :image, rel: blabs_images_path
  %ul#images.list-group
    = render partial: 'image', collection: @images

  - key = Rails.application.config.session_options[:key]
  = content_for :scripts do
    :javascript
      var upload_params = {};
      var csrf_param = $('meta[name=csrf-param]').attr('content');
      var csrf_token = $('meta[name=csrf-token]').attr('content');
      upload_params[csrf_param] = encodeURI(encodeURIComponent(csrf_token));
      upload_params['#{ key }'] = '#{ cookies[key] }';

      var url = $('input#blabs_image_image').attr('rel');
      $('input#blabs_image_image').uploadify({
        'swf'     : '#{ image_path("uploadify.swf") }',
        'buttonText': "Upload image",
        'uploader'     : url,
        'fileObjName' : 'blabs_image[image]',
        'fileTypeExts' : '*.png;*.jpg;*.gif',
        'multi'        : true,
        'formData'   : upload_params,
        'auto'         : true,
        'onUploadSuccess'   : function(file, data, response) {
          var newImage = $('#images').prepend(data);
          $(document).trigger('new_image', $(newImage).attr("id"));
        }
      });

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blabs-0.4.4 app/views/blabs/blog_posts/_image_panel.html.haml