Skip to content

askehansen/redactor_s3

Repository files navigation

RedactorS3

This gem provides easy integration between redactor.js and Amazon S3 for rails applications

Getting started

  1. Add the gem:

    gem 'redactor_s3'
    
  2. Mount it inside your routes:

    mount RedactorS3::Engine => "/s3"
    
  3. Run the installer:

    rails generate redactor_s3:install
    

Dont forget to edit the config file

Usage

To use it you need to render some hidden fields in the views where you will be using redactor

Example:

# edit.html.rb
...
...
<textarea class="redactor"></textarea>
<%= render 'redactor_s3/config' %>

You then need to configure your redactor instance in jquery:

# edit.js
...
...
$("textarea.redactor").redactor({
    ...
    ...
    imageUpload: $("#aws_endpoint").val(),
    uploadCrossDomain: true,
    uploadFields: {
        'key': '#aws_key',
        'AWSAccessKeyId': '#aws_access_key',
        'acl': '#aws_acl',
        'success_action_redirect': '#aws_success_path',
        'policy': '#aws_policy',
        'signature': '#aws_signature',
        'Content-Type': '#aws_content_type'
    },
    imageGetJson: $("#aws_files_path").val()
});

You should now be good to go

License

This project rocks and uses MIT-LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published