Sha256: b4279bc6d1bfbead5adce2bc8be91777cb6f1f58ca88d162b8eda6f5e4a6a744

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

jj# QiniuForm

Rails Qiniu Upload form

## Installation

Add this line to your application's Gemfile:

    gem 'qiniu_form'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install qiniu_form

## Usage

### Init

Update file: `config/initialize/qiniu_from.rb`

```
QiniuForm.upload_url = 'http://up.qiniu.com'
QiniuForm.key_prefix = 'play'
QiniuForm.bucket = 'my_bucket'
QiniuForm.download_host = 'http://my_bucket.qiniu.download.com'
QiniuForm.use_url_value = true # field value: (host + key) or (only key)

```


Update file `app/assets/javascripts/application.js`

```
# = require 'qiniu_form'
```

Update file `app/assets/stylesheets/application.scss`, (require scss)

```
/*
 * = require 'qiniu_form'
*/
```

copy `qiniu_from/vendoc/views/_qiniu_upload_field.html.slim` to `app/views/application/_qiniu_upload_field`


### Rails views

```
- form_for @user do |f|
  = f.qiniu_upload_field :name
  = f.qiniu_upload_field :name, value: 'url'
  = f.qiniu_upload_field :name, value: 'url', type: :image || :audio || :video || :file

= qiniu_upload_tag :name, 'value url'
= qiniu_upload_tag :name, 'value url', type: :image
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/qiniu_form/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qiniu_form-0.0.2 README.md
qiniu_form-0.0.1 README.md