refinerycms-imajax 2.0.0.beta2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
# refinerycms-imajax: extension for Refinery CMS.
|
2
2
|
---
|
3
|
-
This is a small and simple extension that replaces the default behavior for image uploading. By default, all images are uploaded on a single form post. That can lead to timeouts on Heroku (to name one) if you upload too many files at once. What refinerycms-imajax does is simply uploading the files one by one. It will only work with modern browsers that supports FileList and FormData (Chrome is one that supports those) but
|
3
|
+
This is a small and simple extension that replaces the default behavior for image uploading in Refinery CMS. By default, all images are uploaded on a single form post. That can lead to timeouts on Heroku (to name one) if you upload too many files at once. What refinerycms-imajax does is simply uploading the files one by one. It will only work with modern browsers that supports FileList and FormData (Chrome is one that supports those) but it will fallback to default behavior.
|
4
|
+
|
5
|
+
[![Build Status](https://secure.travis-ci.org/jipiboily/refinerycms-imajax.png)](http://travis-ci.org/jipiboily/refinerycms-imajax)
|
6
|
+
|
4
7
|
|
5
8
|
## Requirements
|
6
9
|
---
|
7
10
|
|
8
|
-
You
|
11
|
+
You are expected to have a Rails project with Refinery 2 (>= 2.0.0 but only tested with 2.0.2).
|
9
12
|
|
10
13
|
## Install
|
11
14
|
---
|
12
15
|
Add refinerycms-imajax to your `Gemfile`:
|
13
16
|
|
14
|
-
gem 'refinerycms-imajax', "~> 2.0.0.
|
17
|
+
gem 'refinerycms-imajax', "~> 2.0.0.beta2"
|
15
18
|
|
16
19
|
run
|
17
20
|
|
@@ -23,8 +26,8 @@ It should now work!
|
|
23
26
|
|
24
27
|
## TODO
|
25
28
|
---
|
26
|
-
- Set valid file types based on image model validation (images.js.coffee.erb)
|
27
|
-
- Manage locales and remove hard coded
|
29
|
+
- Set valid file types based on image model validation (in `Images::validate` from `images.js.coffee.erb`)
|
30
|
+
- Manage locales and remove hard coded messages
|
28
31
|
- Add a progress bar for each file maybe?
|
29
32
|
- Setup TravisCI to test over multiple Ruby, Rails and Refinery versions
|
30
33
|
- Fix Capybara so that it can test multiple file uploads
|
@@ -43,14 +46,3 @@ There is only one request spec actually which is a copy of the refinerycms-image
|
|
43
46
|
2. Run tests:
|
44
47
|
|
45
48
|
$ bundle exec rake
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
### How to build this extension as a gem
|
50
|
-
|
51
|
-
cd [imajax directory]
|
52
|
-
gem build refinerycms-imajax.gemspec
|
53
|
-
gem install refinerycms-imajax.gem
|
54
|
-
|
55
|
-
# Sign up for a http://rubygems.org/ account and publish the gem
|
56
|
-
gem push refinerycms-imajax.gem
|
@@ -70,7 +70,7 @@ class Images
|
|
70
70
|
form = new FormData();
|
71
71
|
form.append "image", file
|
72
72
|
form.append "authenticity_token", @authenticity_token
|
73
|
-
_this = @
|
73
|
+
_this = @ # save current scope so we can use current object methods within $.ajax
|
74
74
|
$.ajax
|
75
75
|
type: 'POST'
|
76
76
|
url: @form_action
|
@@ -1,14 +1,14 @@
|
|
1
1
|
::Refinery::Admin::ImagesController.class_eval do
|
2
2
|
|
3
3
|
def ajax_create
|
4
|
-
params[:image] =
|
4
|
+
params[:image] = {:image => params[:image]}
|
5
5
|
params[:image].each do |image|
|
6
6
|
@image = ::Refinery::Image.create(params[:image])
|
7
7
|
end
|
8
8
|
unless @image.errors.any?
|
9
|
-
render :json => { redirect_to
|
9
|
+
render :json => { :redirect_to => refinery.admin_images_path }
|
10
10
|
else
|
11
|
-
render :json => @image.errors, status
|
11
|
+
render :json => @image.errors, :status => 406
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-imajax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jean-Philippe Boily | @jipiboily
|
@@ -13,7 +13,7 @@ date: 2012-03-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: refinerycms-core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70103081290540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70103081290540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: refinerycms-testing
|
27
|
-
requirement: &
|
27
|
+
requirement: &70103081289880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,18 @@ dependencies:
|
|
32
32
|
version: 2.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70103081289880
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: fog
|
38
|
+
requirement: &70103081288960 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70103081288960
|
36
47
|
description: Replacing default bulk image uploading with an Ajaxy, one by one, upload
|
37
48
|
method to prevent timeouts
|
38
49
|
email:
|
@@ -51,7 +62,7 @@ files:
|
|
51
62
|
- lib/refinery/imajax.rb
|
52
63
|
- lib/refinerycms-imajax.rb
|
53
64
|
- README.md
|
54
|
-
homepage:
|
65
|
+
homepage: http://github.com/jipiboily/refinerycms-imajax
|
55
66
|
licenses: []
|
56
67
|
post_install_message:
|
57
68
|
rdoc_options: []
|
@@ -66,9 +77,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
78
|
none: false
|
68
79
|
requirements:
|
69
|
-
- - ! '
|
80
|
+
- - ! '>='
|
70
81
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
82
|
+
version: '0'
|
72
83
|
requirements: []
|
73
84
|
rubyforge_project:
|
74
85
|
rubygems_version: 1.8.17
|