wysiwyg_rails_simple_form 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/lib/generators/wysiwyg_rails_simple_form/install_generator.rb +14 -0
- data/lib/generators/wysiwyg_rails_simple_form/templates/wysiwyg_rails_simple_form.rb +9 -0
- data/lib/wysiwyg_rails_simple_form.rb +15 -0
- data/lib/wysiwyg_rails_simple_form/engine.rb +5 -0
- data/lib/wysiwyg_rails_simple_form/simple_form/wrsf_input.rb +20 -0
- data/lib/wysiwyg_rails_simple_form/version.rb +3 -0
- data/wysiwyg_rails_simple_form.gemspec +23 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ebd819c17bcb7f57d00dc8d68bd6454e8a2d658
|
4
|
+
data.tar.gz: f2b478af94ec5e1bacf72b59d04257fbff68a5ae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e40bd71d34aec6c2e0e92c64653c532f86c04066caac97fc1e57065d444647d9af2e1bf1b3baca4a2f601f485013502934cb13588751710ec2634f12c8bf04f1
|
7
|
+
data.tar.gz: 4b22fe93d8970020f84849b05fda6a193058418f5062144476fb80be712408fa8ab6bcf1eaad924240a27fbbe605023fa445aa87377c69016b276ea45409a9f0
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 nexoff
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# WysiwygRailsSimpleForm
|
2
|
+
|
3
|
+
wysiwyg_rails_simple_form gem adds [simple_form](https://github.com/plataformatec/simple_form) input for editor [wysiwyg-rails](https://github.com/froala/wysiwyg-rails).
|
4
|
+
|
5
|
+
*Note*: This gem doesn't include wysiwyg-rails and simple_form.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile
|
10
|
+
|
11
|
+
gem 'wysiwyg_rails_simple_form'
|
12
|
+
|
13
|
+
and run `bundle install`.
|
14
|
+
|
15
|
+
After it you need to run the generator:
|
16
|
+
|
17
|
+
rails generate wysiwyg_rails_simple_form:install
|
18
|
+
|
19
|
+
The generator will add the `/config/initializers/wysiwyg_rails_simple_form.rb` initializer to your application.
|
20
|
+
|
21
|
+
##Using wysiwyg_rails_simple_form.
|
22
|
+
|
23
|
+
Now you can simply create full featured wysiwyg from any input. Just add `as: :wrsf` like following:
|
24
|
+
|
25
|
+
<%= f.input :content, as: :wrsf %>
|
26
|
+
|
27
|
+
You can customize editor through a hash `wrsf_options` or edit initializer file `/config/initializers/wysiwyg_rails_simple_form.rb`.
|
28
|
+
|
29
|
+
<%= f.input :content, as: :wrsf, wrsf_options: {minHeight: 150, maxHeight: 300} %>
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it ( https://github.com/[my-github-username]/wysiwyg_rails_simple_form/fork )
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module WysiwygRailsSimpleForm
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path("../templates", __FILE__)
|
6
|
+
|
7
|
+
desc "Creates and copy a gem initializer to your application."
|
8
|
+
def copy_initializer
|
9
|
+
template "wysiwyg_rails_simple_form.rb", "config/initializers/wysiwyg_rails_simple_form.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#Use this setup block to configure wysiwyg editor.
|
2
|
+
WysiwygRailsSimpleForm.configure do |config|
|
3
|
+
config.options = {
|
4
|
+
inlineMode: false
|
5
|
+
#paragraphy: true,
|
6
|
+
#placeholder: 'Start typing something...',
|
7
|
+
#buttons: ["formatBlock", "bold", "italic", "underline", "align", "createLink", "undo", "redo", "insertHorizontalRule"]
|
8
|
+
}
|
9
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'wysiwyg_rails_simple_form/engine'
|
2
|
+
require "wysiwyg_rails_simple_form/version"
|
3
|
+
|
4
|
+
autoload :WrsfInput, 'wysiwyg_rails_simple_form/simple_form/wrsf_input'
|
5
|
+
|
6
|
+
module WysiwygRailsSimpleForm
|
7
|
+
|
8
|
+
mattr_accessor :options
|
9
|
+
@@options = {}
|
10
|
+
|
11
|
+
def self.configure
|
12
|
+
yield self
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class WrsfInput < SimpleForm::Inputs::Base
|
4
|
+
|
5
|
+
def input(wrapper_options)
|
6
|
+
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
7
|
+
merged_wrsf_options = merge_wrsf_options options[:wrsf_options], WysiwygRailsSimpleForm.options
|
8
|
+
|
9
|
+
@builder.text_area(attribute_name, merged_input_options) +
|
10
|
+
template.content_tag(:script, type: 'text/javascript') do
|
11
|
+
"$('textarea##{input_class}').editable(#{merged_wrsf_options.to_json});".html_safe
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def merge_wrsf_options input_wrsf_options, wrsf_options
|
18
|
+
input_wrsf_options.present? ? wrsf_options.merge(input_wrsf_options) : wrsf_options
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wysiwyg_rails_simple_form/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wysiwyg_rails_simple_form"
|
8
|
+
spec.version = WysiwygRailsSimpleForm::VERSION
|
9
|
+
spec.authors = ["Andrei Pauliukevich"]
|
10
|
+
spec.email = ["nexoff@gmx.se"]
|
11
|
+
spec.summary = %q{wysiwyg_rails_simple_form gem adds simple_form input for the editor wysiwyg-rails.}
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = "https://github.com/nexoff/wysiwyg_rails_simple_form"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency 'rake', '~> 0'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wysiwyg_rails_simple_form
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrei Pauliukevich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: wysiwyg_rails_simple_form gem adds simple_form input for the editor wysiwyg-rails.
|
42
|
+
email:
|
43
|
+
- nexoff@gmx.se
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/generators/wysiwyg_rails_simple_form/install_generator.rb
|
54
|
+
- lib/generators/wysiwyg_rails_simple_form/templates/wysiwyg_rails_simple_form.rb
|
55
|
+
- lib/wysiwyg_rails_simple_form.rb
|
56
|
+
- lib/wysiwyg_rails_simple_form/engine.rb
|
57
|
+
- lib/wysiwyg_rails_simple_form/simple_form/wrsf_input.rb
|
58
|
+
- lib/wysiwyg_rails_simple_form/version.rb
|
59
|
+
- wysiwyg_rails_simple_form.gemspec
|
60
|
+
homepage: https://github.com/nexoff/wysiwyg_rails_simple_form
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: wysiwyg_rails_simple_form gem adds simple_form input for the editor wysiwyg-rails.
|
84
|
+
test_files: []
|