bootsy_full_html 2.2.1
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +159 -0
- data/Rakefile +35 -0
- data/app/assets/images/bootsy/gallery-loader.gif +0 -0
- data/app/assets/images/bootsy/upload-loader.gif +0 -0
- data/app/assets/javascripts/bootsy.js +11 -0
- data/app/assets/javascripts/bootsy/area.js +89 -0
- data/app/assets/javascripts/bootsy/editor_options.js +47 -0
- data/app/assets/javascripts/bootsy/image_template.js +11 -0
- data/app/assets/javascripts/bootsy/init.js +38 -0
- data/app/assets/javascripts/bootsy/locales/en.js +54 -0
- data/app/assets/javascripts/bootsy/locales/pt-BR.js +54 -0
- data/app/assets/javascripts/bootsy/modal.js +192 -0
- data/app/assets/javascripts/bootsy/vendor/bootstrap-wysihtml5.js +530 -0
- data/app/assets/javascripts/bootsy/vendor/bootstrap.file-input.js +122 -0
- data/app/assets/javascripts/bootsy/vendor/polyfill.js +29 -0
- data/app/assets/javascripts/bootsy/vendor/wysihtml5.js +9565 -0
- data/app/assets/stylesheets/bootsy.css +337 -0
- data/app/controllers/bootsy/application_controller.rb +7 -0
- data/app/controllers/bootsy/images_controller.rb +96 -0
- data/app/helpers/bootsy/application_helper.rb +13 -0
- data/app/uploaders/bootsy/image_uploader.rb +39 -0
- data/app/views/bootsy/images/_image.html.erb +43 -0
- data/app/views/bootsy/images/_modal.html.erb +29 -0
- data/app/views/bootsy/images/_new.html.erb +17 -0
- data/config/locales/bootsy.en.yml +30 -0
- data/config/locales/bootsy.pt-BR.yml +30 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20120624171333_create_bootsy_images.rb +9 -0
- data/db/migrate/20120628124845_create_bootsy_image_galleries.rb +8 -0
- data/lib/bootsy.rb +68 -0
- data/lib/bootsy/activerecord/image.rb +12 -0
- data/lib/bootsy/activerecord/image_gallery.rb +23 -0
- data/lib/bootsy/container.rb +52 -0
- data/lib/bootsy/core_ext.rb +4 -0
- data/lib/bootsy/engine.rb +34 -0
- data/lib/bootsy/form_builder.rb +18 -0
- data/lib/bootsy/form_helper.rb +114 -0
- data/lib/bootsy/simple_form/bootsy_input.rb +24 -0
- data/lib/bootsy/version.rb +4 -0
- data/lib/generators/bootsy/USAGE +12 -0
- data/lib/generators/bootsy/install_generator.rb +53 -0
- data/lib/generators/bootsy/templates/bootsy.rb +69 -0
- data/lib/tasks/bootsy_tasks.rake +4 -0
- metadata +130 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
module Bootsy
|
2
|
+
# Public: Module to include Bootsy in `ActionView::Base`.
|
3
|
+
module FormHelper
|
4
|
+
# Public: Return a textarea element with proper attributes to
|
5
|
+
# be loaded as a WYSIWYG editor.
|
6
|
+
#
|
7
|
+
# object_name - The String or Symbol identifier of the object assigned
|
8
|
+
# to the template.
|
9
|
+
#
|
10
|
+
# method - The Symbol attribute name on the object assigned to the
|
11
|
+
# form builder that will tailor the editor.
|
12
|
+
#
|
13
|
+
# options - The Hash of options used to enable/disable features of
|
14
|
+
# the editor (default: {}):
|
15
|
+
# :container - The `Bootsy::Container` instance model
|
16
|
+
# that will be referenced by the editor's
|
17
|
+
# image gallery. Defaults to the object
|
18
|
+
# assigned to the template, if it is a
|
19
|
+
# `Container`.
|
20
|
+
# :uploader - The Boolean value used to enable/disable
|
21
|
+
# the image upload feature. Default: true,
|
22
|
+
# if a`Container` is found, false otherwise.
|
23
|
+
# :editor_options - The Hash of options with Boolean values
|
24
|
+
# usedto enable/disable features of the
|
25
|
+
# editor. Available options are described ib
|
26
|
+
# the Bootsyinitializer file (which is the
|
27
|
+
# default for this argument).
|
28
|
+
def bootsy_area(object_name, method, options = {})
|
29
|
+
container = options[:container] || options[:object]
|
30
|
+
|
31
|
+
set_gallery_id(container, options)
|
32
|
+
|
33
|
+
text_area(object_name, method, text_area_options(options)) +
|
34
|
+
modal(options, container) +
|
35
|
+
gallery_id_param(object_name, container, options)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def enable_uploader?(options)
|
41
|
+
if options[:uploader] == false
|
42
|
+
false
|
43
|
+
elsif options[:container].is_a?(Container)
|
44
|
+
true
|
45
|
+
elsif options[:container].blank? && options[:object].is_a?(Container)
|
46
|
+
true
|
47
|
+
else
|
48
|
+
false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def tag_class(options)
|
53
|
+
classes =
|
54
|
+
if options[:class].blank?
|
55
|
+
[]
|
56
|
+
elsif options[:class].is_a?(Array)
|
57
|
+
options[:class]
|
58
|
+
else
|
59
|
+
[options[:class]]
|
60
|
+
end
|
61
|
+
|
62
|
+
classes << 'bootsy_text_area'
|
63
|
+
end
|
64
|
+
|
65
|
+
def data_options(options)
|
66
|
+
(options[:data] || {}).deep_merge(
|
67
|
+
Hash[bootsy_options(options).map do |key, value|
|
68
|
+
["bootsy-#{key}", value]
|
69
|
+
end]
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
def bootsy_options(options)
|
74
|
+
Bootsy.editor_options
|
75
|
+
.merge(options[:editor_options] || {})
|
76
|
+
.merge(uploader: enable_uploader?(options))
|
77
|
+
end
|
78
|
+
|
79
|
+
def text_area_options(options)
|
80
|
+
options.except(
|
81
|
+
:container,
|
82
|
+
:uploader,
|
83
|
+
:editor_options
|
84
|
+
).merge(
|
85
|
+
data: data_options(options),
|
86
|
+
class: tag_class(options)
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
def set_gallery_id(container, options)
|
91
|
+
return unless enable_uploader?(options)
|
92
|
+
|
93
|
+
container.bootsy_image_gallery_id ||= Bootsy::ImageGallery.create!.id
|
94
|
+
options.deep_merge!(
|
95
|
+
data: { gallery_id: container.bootsy_image_gallery_id }
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
def gallery_id_param(object_name, container, options)
|
100
|
+
return unless enable_uploader?(options) && container.new_record?
|
101
|
+
|
102
|
+
hidden_field(
|
103
|
+
object_name,
|
104
|
+
:bootsy_image_gallery_id,
|
105
|
+
class: 'bootsy_image_gallery_id'
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def modal(options, container)
|
110
|
+
return unless enable_uploader?(options)
|
111
|
+
render('bootsy/images/modal', container: container)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
|
3
|
+
# Public: A SimpleForm Input to wrap Bootsy areas
|
4
|
+
class BootsyInput < SimpleForm::Inputs::Base
|
5
|
+
enable :placeholder, :maxlength, :container, :editor_options, :uploader
|
6
|
+
|
7
|
+
def input(wrapper_options = nil)
|
8
|
+
bootsy_params = [:editor_options, :container, :uploader]
|
9
|
+
input_html_options.merge!(
|
10
|
+
input_options.select { |key, _| bootsy_params.include?(key) }
|
11
|
+
)
|
12
|
+
|
13
|
+
# Check presence of `merge_wrapper_options` to keep
|
14
|
+
# compatibility with both Simple Form 3.0 and 3.1.
|
15
|
+
merged_input_options =
|
16
|
+
if respond_to?(:merge_wrapper_options, true)
|
17
|
+
merge_wrapper_options(input_html_options, wrapper_options)
|
18
|
+
else
|
19
|
+
input_html_options
|
20
|
+
end
|
21
|
+
|
22
|
+
@builder.bootsy_area(attribute_name, merged_input_options)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
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
|
+
|
@@ -0,0 +1,53 @@
|
|
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
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Use this setup block to configure all options available in Bootsy.
|
2
|
+
Bootsy.setup do |config|
|
3
|
+
# Default editor options
|
4
|
+
# You can also override them locally by passing an
|
5
|
+
# editor_options hash to bootsy_area
|
6
|
+
# config.editor_options = {
|
7
|
+
# font_styles: true,
|
8
|
+
# emphasis: true,
|
9
|
+
# lists: true,
|
10
|
+
# html: false,
|
11
|
+
# link: true,
|
12
|
+
# image: true,
|
13
|
+
# color: true
|
14
|
+
# }
|
15
|
+
#
|
16
|
+
# Image versions available
|
17
|
+
# Possible values: :small, :medium, :large and/or :original
|
18
|
+
config.image_versions_available = [:small, :medium, :large, :original]
|
19
|
+
#
|
20
|
+
#
|
21
|
+
# SMALL IMAGES
|
22
|
+
#
|
23
|
+
# Width limit for small images
|
24
|
+
# config.small_image[:width] = 160
|
25
|
+
#
|
26
|
+
# Height limit for small images
|
27
|
+
# config.small_image[:height] = 160
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# MEDIUM IMAGES
|
31
|
+
#
|
32
|
+
# Width limit for medium images
|
33
|
+
# config.medium_image[:width] = 360
|
34
|
+
#
|
35
|
+
# Height limit for medium images
|
36
|
+
# config.medium_image[:height] = 360
|
37
|
+
#
|
38
|
+
#
|
39
|
+
# LARGE IMAGES
|
40
|
+
#
|
41
|
+
# Width limit for large images
|
42
|
+
# config.large_image[:width] = 760
|
43
|
+
#
|
44
|
+
# Height limit for large images
|
45
|
+
# config.large_image[:height] = 760
|
46
|
+
#
|
47
|
+
#
|
48
|
+
# Whether user can destroy uploaded files
|
49
|
+
# config.allow_destroy = true
|
50
|
+
#
|
51
|
+
#
|
52
|
+
# Storage mode
|
53
|
+
# You can change the sorage mode below from :file to :fog if you want
|
54
|
+
# to use Amazon S3 and other cloud services. If you do that, please add
|
55
|
+
# 'fog' to your Gemfile and create and configure your credentials in an
|
56
|
+
# initializer file, as described in Carrierwave's docs:
|
57
|
+
# https://github.com/carrierwaveuploader/carrierwave#using-amazon-s3
|
58
|
+
# config.storage = :file
|
59
|
+
#
|
60
|
+
#
|
61
|
+
# Store directory (inside 'public') for storage = :file
|
62
|
+
# BE CAREFUL! Changing this may break previously uploaded file paths!
|
63
|
+
# config.store_dir = 'uploads'
|
64
|
+
#
|
65
|
+
#
|
66
|
+
# Specify the controller to inherit from. Using ApplicationController
|
67
|
+
# allows you to perform authentication from within your app.
|
68
|
+
# config.base_controller = ActionController::Base
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bootsy_full_html
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Volmer Soares
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mini_magick
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carrierwave
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
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'
|
55
|
+
description: A beautiful WYSIWYG editor with image uploads for Rails.
|
56
|
+
email:
|
57
|
+
- volmer@radicaos.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- MIT-LICENSE
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- app/assets/images/bootsy/gallery-loader.gif
|
66
|
+
- app/assets/images/bootsy/upload-loader.gif
|
67
|
+
- app/assets/javascripts/bootsy.js
|
68
|
+
- app/assets/javascripts/bootsy/area.js
|
69
|
+
- app/assets/javascripts/bootsy/editor_options.js
|
70
|
+
- app/assets/javascripts/bootsy/image_template.js
|
71
|
+
- app/assets/javascripts/bootsy/init.js
|
72
|
+
- app/assets/javascripts/bootsy/locales/en.js
|
73
|
+
- app/assets/javascripts/bootsy/locales/pt-BR.js
|
74
|
+
- app/assets/javascripts/bootsy/modal.js
|
75
|
+
- app/assets/javascripts/bootsy/vendor/bootstrap-wysihtml5.js
|
76
|
+
- app/assets/javascripts/bootsy/vendor/bootstrap.file-input.js
|
77
|
+
- app/assets/javascripts/bootsy/vendor/polyfill.js
|
78
|
+
- app/assets/javascripts/bootsy/vendor/wysihtml5.js
|
79
|
+
- app/assets/stylesheets/bootsy.css
|
80
|
+
- app/controllers/bootsy/application_controller.rb
|
81
|
+
- app/controllers/bootsy/images_controller.rb
|
82
|
+
- app/helpers/bootsy/application_helper.rb
|
83
|
+
- app/uploaders/bootsy/image_uploader.rb
|
84
|
+
- app/views/bootsy/images/_image.html.erb
|
85
|
+
- app/views/bootsy/images/_modal.html.erb
|
86
|
+
- app/views/bootsy/images/_new.html.erb
|
87
|
+
- config/locales/bootsy.en.yml
|
88
|
+
- config/locales/bootsy.pt-BR.yml
|
89
|
+
- config/routes.rb
|
90
|
+
- db/migrate/20120624171333_create_bootsy_images.rb
|
91
|
+
- db/migrate/20120628124845_create_bootsy_image_galleries.rb
|
92
|
+
- lib/bootsy.rb
|
93
|
+
- lib/bootsy/activerecord/image.rb
|
94
|
+
- lib/bootsy/activerecord/image_gallery.rb
|
95
|
+
- lib/bootsy/container.rb
|
96
|
+
- lib/bootsy/core_ext.rb
|
97
|
+
- lib/bootsy/engine.rb
|
98
|
+
- lib/bootsy/form_builder.rb
|
99
|
+
- lib/bootsy/form_helper.rb
|
100
|
+
- lib/bootsy/simple_form/bootsy_input.rb
|
101
|
+
- lib/bootsy/version.rb
|
102
|
+
- lib/generators/bootsy/USAGE
|
103
|
+
- lib/generators/bootsy/install_generator.rb
|
104
|
+
- lib/generators/bootsy/templates/bootsy.rb
|
105
|
+
- lib/tasks/bootsy_tasks.rake
|
106
|
+
homepage: http://github.com/volmer/bootsy
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.4.5.1
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: A beautiful WYSIWYG editor with image uploads for Rails.
|
130
|
+
test_files: []
|