bootsy 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -19
- data/Rakefile +2 -27
- data/app/assets/javascripts/bootsy.js +0 -1
- data/app/assets/javascripts/bootsy/modal.js +40 -9
- data/app/controllers/bootsy/images_controller.rb +4 -2
- data/app/views/bootsy/images/_new.html.erb +3 -3
- data/{lib/generators/bootsy/templates → config/initializers}/bootsy.rb +0 -0
- data/lib/bootsy.rb +0 -1
- data/lib/bootsy/form_helper.rb +2 -2
- data/lib/bootsy/version.rb +1 -1
- metadata +9 -26
- data/lib/generators/bootsy/USAGE +0 -12
- data/lib/generators/bootsy/install_generator.rb +0 -53
- data/lib/tasks/bootsy_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27b663d973185f6a2ea2f0b028af0f89438e115f
|
4
|
+
data.tar.gz: 32029064e1888368223bf99e8e428089765773a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f9366cf44693f59579830135117516db34a783b0c2da2494ad264ab8ec2e6e752db3632f758069de48faec69a5a6de19f2a8886437e3dad1a6f557d51e2a67
|
7
|
+
data.tar.gz: 53e3dafe4aa45a23627db6a9297aeb89efb515c704deac9d4f257a2aec6934cc6ad13d627d032fb260d0da83eb5366ff6837fdf7564a31789753fd1cf0b84909
|
data/README.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
[](http://travis-ci.org/volmer/bootsy)
|
5
5
|
[](https://gemnasium.com/volmer/bootsy)
|
6
6
|
[](https://codeclimate.com/github/volmer/bootsy)
|
7
|
-
[](https://coveralls.io/r/volmer/bootsy)
|
8
7
|
|
9
8
|
*Bootsy* is a WYSIWYG editor for Rails based on
|
10
9
|
[Bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5) with image uploads using
|
@@ -19,8 +18,8 @@
|
|
19
18
|
## Requirements
|
20
19
|
|
21
20
|
* ImageMagick or GraphicsMagick (for MiniMagick);
|
22
|
-
* Rails
|
23
|
-
* [Bootstrap
|
21
|
+
* Rails >= 4;
|
22
|
+
* [Bootstrap 3](http://getbootstrap.com/) fully installed in your app.
|
24
23
|
|
25
24
|
|
26
25
|
## Installation
|
@@ -35,16 +34,21 @@
|
|
35
34
|
bundle install
|
36
35
|
```
|
37
36
|
|
38
|
-
3.
|
39
|
-
|
40
|
-
|
37
|
+
3. Require Bootsy in the asset pipeline:
|
38
|
+
|
39
|
+
In your `app/assets/javascripts/application.js`, put this **after**
|
40
|
+
requiring jQuery and Bootstrap:
|
41
|
+
|
42
|
+
```javascript
|
43
|
+
//= require bootsy
|
41
44
|
```
|
42
|
-
It will include the javascripts and stylesheets in the assets pipeline,
|
43
|
-
create the `bootsy.rb` initializer and add a copy of the english translations.
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
In your `app/assets/stylesheets/application.css`, put this line **after**
|
47
|
+
requiring Bootstrap:
|
48
|
+
|
49
|
+
```css
|
50
|
+
*= require bootsy
|
51
|
+
```
|
48
52
|
|
49
53
|
4. Add and run migrations:
|
50
54
|
```console
|
@@ -136,17 +140,16 @@ images in the text area using an external image URL.
|
|
136
140
|
## Configuration
|
137
141
|
|
138
142
|
You can set the default editor options, image sizes available (small, medium,
|
139
|
-
large and/or its original), dimensions and more.
|
140
|
-
file
|
141
|
-
|
143
|
+
large and/or its original), dimensions and more. Create a copy of [Bootsy's initalizer
|
144
|
+
file](https://github.com/volmer/bootsy/tree/master/config/initializers/bootsy.rb)
|
145
|
+
in your `config/initializers` and feel free to uncomment and change the options
|
146
|
+
as you like.
|
142
147
|
|
143
148
|
|
144
149
|
## I18n
|
145
150
|
|
146
|
-
Bootsy
|
147
|
-
`config/locales` directory
|
148
|
-
to translate Bootsy to your language.
|
149
|
-
[Here are some examples](https://github.com/volmer/bootsy/tree/master/config/locales).
|
151
|
+
You can translate Bootsy to your own language. Simply create a locale file for
|
152
|
+
it in your `config/locales` directory similar to [Bootsy's master English file](https://github.com/volmer/bootsy/tree/master/config/locales/bootsy.en.yml).
|
150
153
|
|
151
154
|
You also need to translate Bootsy on the JavaScript side. Just follow
|
152
155
|
[this example](https://github.com/volmer/bootsy/blob/master/app/assets/javascripts/bootsy/locales/en.js).
|
@@ -156,4 +159,4 @@ You can set the locale directly by setting a `data-bootsy-locale` attribute on y
|
|
156
159
|
|
157
160
|
## License
|
158
161
|
|
159
|
-
MIT License. Copyright 2012-
|
162
|
+
MIT License. Copyright 2012-2016 Volmer Soares
|
data/Rakefile
CHANGED
@@ -1,35 +1,10 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'Bootsy'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
Bundler::GemHelper.install_tasks
|
24
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
25
2
|
require 'rspec/core/rake_task'
|
26
|
-
require 'coveralls/rake/task'
|
27
3
|
require 'rubocop/rake_task'
|
28
4
|
|
29
5
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
30
6
|
task.patterns = ['app/**/*.rb', 'lib/**/*.rb']
|
31
7
|
end
|
32
|
-
Coveralls::RakeTask.new
|
33
8
|
RSpec::Core::RakeTask.new(:spec)
|
34
9
|
|
35
|
-
task default: [:rubocop, :spec
|
10
|
+
task default: [:rubocop, :spec]
|
@@ -42,14 +42,47 @@ Bootsy.Modal = function(area) {
|
|
42
42
|
this.deleteImage(data.id);
|
43
43
|
}.bind(this));
|
44
44
|
|
45
|
-
this.$el.on('ajax:error', '.bootsy-upload-form', this.imageUploadFailed.bind(this));
|
46
|
-
|
47
45
|
this.$el.on('click', 'a[href="#refresh-gallery"]', this.requestImageGallery.bind(this));
|
48
46
|
|
49
|
-
this.$el.on('
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
this.$el.on('submit', '.bootsy-upload-form', function(event, xhr, settings) {
|
48
|
+
var fileSelect = event.target.querySelector('input[type="file"]');
|
49
|
+
var formData = new FormData();
|
50
|
+
var file = fileSelect.files[0];
|
51
|
+
var fileURLInputName = 'image[remote_image_file_url]';
|
52
|
+
var fileURLInput = event.target.querySelector(
|
53
|
+
'input[name="' + fileURLInputName + '"]');
|
54
|
+
var fileURL;
|
55
|
+
|
56
|
+
event.preventDefault();
|
57
|
+
|
58
|
+
formData.append('authenticity_token',
|
59
|
+
event.target.querySelector('input[name="authenticity_token"]').value);
|
60
|
+
|
61
|
+
if (file) {
|
62
|
+
formData.append('image[image_file]', file, file.name);
|
63
|
+
}
|
64
|
+
|
65
|
+
if (fileURLInput) {
|
66
|
+
fileURL = fileURLInput.value;
|
67
|
+
} else {
|
68
|
+
fileURL = '';
|
69
|
+
}
|
70
|
+
|
71
|
+
formData.append(fileURLInputName, fileURL);
|
72
|
+
|
73
|
+
var xhr = new XMLHttpRequest();
|
74
|
+
xhr.open('POST', event.target.action, true);
|
75
|
+
xhr.onload = function () {
|
76
|
+
var data = JSON.parse(xhr.response);
|
77
|
+
if (xhr.status === 200) {
|
78
|
+
this.area.setImageGalleryId(data.gallery_id);
|
79
|
+
this.addImage(data.image);
|
80
|
+
this.setUploadForm(data.form);
|
81
|
+
} else {
|
82
|
+
this.imageUploadFailed(xhr, data);
|
83
|
+
}
|
84
|
+
}.bind(this);
|
85
|
+
xhr.send(formData);
|
53
86
|
}.bind(this));
|
54
87
|
|
55
88
|
this.$el.modal({ show: false });
|
@@ -122,9 +155,7 @@ Bootsy.Modal.prototype.setUploadForm = function(html) {
|
|
122
155
|
};
|
123
156
|
|
124
157
|
// The image upload failed
|
125
|
-
Bootsy.Modal.prototype.imageUploadFailed = function(
|
126
|
-
var invalidErrors = xhr.responseJSON;
|
127
|
-
|
158
|
+
Bootsy.Modal.prototype.imageUploadFailed = function(xhr, invalidErrors) {
|
128
159
|
if (Number(xhr.status) === 422 && invalidErrors.image_file) {
|
129
160
|
this.hideUploadLoadingAnimation();
|
130
161
|
|
@@ -54,7 +54,8 @@ module Bootsy
|
|
54
54
|
render_to_string(
|
55
55
|
file: 'bootsy/images/_image',
|
56
56
|
formats: [:html],
|
57
|
-
locals: { image: image }
|
57
|
+
locals: { image: image },
|
58
|
+
layout: false
|
58
59
|
)
|
59
60
|
end
|
60
61
|
|
@@ -67,7 +68,8 @@ module Bootsy
|
|
67
68
|
render_to_string(
|
68
69
|
file: 'bootsy/images/_new',
|
69
70
|
formats: [:html],
|
70
|
-
locals: { gallery: gallery, image: gallery.images.new }
|
71
|
+
locals: { gallery: gallery, image: gallery.images.new },
|
72
|
+
layout: false
|
71
73
|
)
|
72
74
|
end
|
73
75
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= form_for([bootsy, resource_or_nil(gallery), image],
|
2
|
-
html: { multipart: true, class: 'bootsy-upload-form form-inline' },
|
1
|
+
<%= form_for([bootsy, resource_or_nil(gallery), image],
|
2
|
+
html: { multipart: true, class: 'bootsy-upload-form form-inline' }, format: 'json') do |f| %>
|
3
3
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
4
4
|
|
5
5
|
<%= render 'bootsy/images/loader', image_class: 'bootsy-upload-loader' %>
|
@@ -13,5 +13,5 @@
|
|
13
13
|
|
14
14
|
<span class="bootsy-upload-spacer"><%= t('bootsy.action.or') %></span>
|
15
15
|
|
16
|
-
<%= f.file_field :image_file, title: t('bootsy.action.upload') %>
|
16
|
+
<%= f.file_field :image_file, title: t('bootsy.action.upload'), accept: 'image/*' %>
|
17
17
|
<% end %>
|
File without changes
|
data/lib/bootsy.rb
CHANGED
data/lib/bootsy/form_helper.rb
CHANGED
@@ -71,8 +71,8 @@ module Bootsy
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def bootsy_options(options)
|
74
|
-
Bootsy.editor_options.merge(options[:editor_options] || {})
|
75
|
-
|
74
|
+
Bootsy.editor_options.merge(options[:editor_options] || {})
|
75
|
+
.merge(uploader: enable_uploader?(options))
|
76
76
|
end
|
77
77
|
|
78
78
|
def text_area_options(options)
|
data/lib/bootsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volmer Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -16,45 +16,31 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: carrierwave
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.11'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: remotipart
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.2'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.2'
|
40
|
+
version: '0.11'
|
55
41
|
description: A beautiful WYSIWYG editor with image uploads for Rails.
|
56
42
|
email:
|
57
|
-
-
|
43
|
+
- rubygems@radicaos.com
|
58
44
|
executables: []
|
59
45
|
extensions: []
|
60
46
|
extra_rdoc_files: []
|
@@ -83,6 +69,7 @@ files:
|
|
83
69
|
- app/views/bootsy/images/_loader.html.erb
|
84
70
|
- app/views/bootsy/images/_modal.html.erb
|
85
71
|
- app/views/bootsy/images/_new.html.erb
|
72
|
+
- config/initializers/bootsy.rb
|
86
73
|
- config/locales/bootsy.en.yml
|
87
74
|
- config/locales/bootsy.pt-BR.yml
|
88
75
|
- config/routes.rb
|
@@ -98,10 +85,6 @@ files:
|
|
98
85
|
- lib/bootsy/form_helper.rb
|
99
86
|
- lib/bootsy/simple_form/bootsy_input.rb
|
100
87
|
- lib/bootsy/version.rb
|
101
|
-
- lib/generators/bootsy/USAGE
|
102
|
-
- lib/generators/bootsy/install_generator.rb
|
103
|
-
- lib/generators/bootsy/templates/bootsy.rb
|
104
|
-
- lib/tasks/bootsy_tasks.rake
|
105
88
|
homepage: http://github.com/volmer/bootsy
|
106
89
|
licenses:
|
107
90
|
- MIT
|
@@ -122,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
105
|
version: '0'
|
123
106
|
requirements: []
|
124
107
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.6.4
|
126
109
|
signing_key:
|
127
110
|
specification_version: 4
|
128
111
|
summary: A beautiful WYSIWYG editor with image uploads for Rails.
|
data/lib/generators/bootsy/USAGE
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Adds Bootsy routes, locale and assets to your application.
|
3
|
-
|
4
|
-
Example:
|
5
|
-
rails generate bootsy:install
|
6
|
-
|
7
|
-
This will create:
|
8
|
-
route mount Bootsy::Engine => '/bootsy', as: 'bootsy'
|
9
|
-
create config/locales/bootsy.en.yml
|
10
|
-
insert app/assets/javascripts/application.js
|
11
|
-
insert app/assets/stylesheets/application.css
|
12
|
-
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Bootsy
|
2
|
-
module Generators
|
3
|
-
# Public: A Rails Generator to copy translations, assets and routes to
|
4
|
-
# the host app.
|
5
|
-
class InstallGenerator < Rails::Generators::Base
|
6
|
-
source_root File.expand_path('../templates', __FILE__)
|
7
|
-
|
8
|
-
def add_routes
|
9
|
-
route "mount Bootsy::Engine => '/bootsy', as: 'bootsy'"
|
10
|
-
end
|
11
|
-
|
12
|
-
def copy_locale
|
13
|
-
copy_file '../../../../config/locales/bootsy.en.yml',
|
14
|
-
'config/locales/bootsy.en.yml'
|
15
|
-
end
|
16
|
-
|
17
|
-
def add_javascript
|
18
|
-
require_asset(
|
19
|
-
'app/assets/javascripts/application.js',
|
20
|
-
"\n//= require bootsy",
|
21
|
-
'//= require jquery_ujs'
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_stylesheet
|
26
|
-
require_asset(
|
27
|
-
'app/assets/stylesheets/application.css',
|
28
|
-
"\n *= require bootsy",
|
29
|
-
'*= require_self'
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
def copy_config
|
34
|
-
template 'bootsy.rb', 'config/initializers/bootsy.rb'
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def require_asset(destination, content, after_line)
|
40
|
-
if File.exist?(destination)
|
41
|
-
if File.binread(destination).include?(content)
|
42
|
-
say_status('skipped', "insert into #{destination}", :yellow)
|
43
|
-
else
|
44
|
-
insert_into_file(destination, content, after: after_line)
|
45
|
-
end
|
46
|
-
else
|
47
|
-
say_status('not found', "#{destination} not found. You must
|
48
|
-
manually require Bootsy in your assets pipeline.", :red)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
data/lib/tasks/bootsy_tasks.rake
DELETED