simple_form_extension 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/simple_form_extension.rb +4 -1
- data/lib/simple_form_extension/inputs.rb +1 -0
- data/lib/simple_form_extension/inputs/redactor_input.rb +14 -0
- data/lib/simple_form_extension/railtie.rb +12 -0
- data/lib/simple_form_extension/version.rb +1 -1
- data/simple_form_extension.gemspec +1 -0
- data/vendor/assets/javascripts/simple_form_extension.coffee +2 -0
- data/vendor/assets/javascripts/simple_form_extension/redactor.coffee +16 -0
- data/vendor/assets/stylesheets/simple_form_extension.sass +1 -0
- metadata +20 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd6ebc653068a82c826a7b64d2a490c772a11bc8
|
4
|
+
data.tar.gz: b94a074230506ffaf6d9f0d6fa08268ea62b0210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a94db520d3eabee92fa9c28d5e322286fe1800293ba2575a89cc2c8a358f79f1c3dbeb980248ad1310b1e8752319d86432d4d7a2cd9851760141cade0ccf836
|
7
|
+
data.tar.gz: 52694a893078b855a2e90d90dc502a610e3463b60111d0324c47d465c3d4509b7af5a780fc98e250411b192e8338b37e691172cf45054e31de9ed5c52da4f5f9
|
data/README.md
CHANGED
@@ -18,12 +18,19 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
To use the popover component, please include in a javascript file :
|
21
|
+
To use the popover component, please include in a javascript file :
|
22
22
|
|
23
23
|
```javascript
|
24
24
|
$('body').popover(selector: '[rel="popover"]')
|
25
25
|
```
|
26
26
|
|
27
|
+
For the [Redactor](https://github.com/SammyLin/redactor-rails) component to
|
28
|
+
work, require the javascript files :
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
//= require simple_form_extension
|
32
|
+
```
|
33
|
+
|
27
34
|
TODO: Write usage instructions here
|
28
35
|
|
29
36
|
## Contributing
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'simple_form_extension/version'
|
2
|
+
require 'redactor-rails'
|
2
3
|
|
3
4
|
module SimpleFormExtension
|
4
5
|
extend ActiveSupport::Autoload
|
@@ -14,3 +15,5 @@ SimpleForm::Inputs::Base.send(:include, SimpleFormExtension::Components::Icons)
|
|
14
15
|
SimpleForm::Inputs::Base.send(:include, SimpleFormExtension::Components::Popovers)
|
15
16
|
|
16
17
|
SimpleForm.custom_inputs_namespaces << 'SimpleFormExtension::Inputs'
|
18
|
+
|
19
|
+
require 'simple_form_extension/railtie' if defined?(Rails)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SimpleFormExtension
|
2
|
+
module Inputs
|
3
|
+
class RedactorInput < SimpleForm::Inputs::TextInput
|
4
|
+
def input(wrapper_options = nil)
|
5
|
+
@additional_classes ||= additional_classes
|
6
|
+
@additional_classes -= [input_type]
|
7
|
+
|
8
|
+
input_html_options[:"data-redactor"] = true
|
9
|
+
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module SimpleFormExtension
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
initializer 'add vendor path to assets pipeline' do |app|
|
4
|
+
%w(javascripts stylesheets).each do |folder|
|
5
|
+
app.config.assets.paths << File.expand_path(
|
6
|
+
"../../../vendor/assets/#{ folder }",
|
7
|
+
__FILE__
|
8
|
+
)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
initRedactor = ->
|
2
|
+
csrf_token = $('meta[name=csrf-token]').attr('content')
|
3
|
+
csrf_param = $('meta[name=csrf-param]').attr('content')
|
4
|
+
|
5
|
+
if (csrf_param isnt undefined and csrf_token isnt undefined)
|
6
|
+
params = csrf_param + "=" + encodeURIComponent(csrf_token);
|
7
|
+
|
8
|
+
$('[data-redactor]').redactor(
|
9
|
+
imageUpload: "/redactor_rails/pictures?" + params
|
10
|
+
imageGetJson: "/redactor_rails/pictures"
|
11
|
+
path: "/assets/redactor-rails"
|
12
|
+
css: "style.css"
|
13
|
+
)
|
14
|
+
|
15
|
+
$(document).ready(initRedactor);
|
16
|
+
$(window).bind('page:change', initRedactor);
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require redactor-rails
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Vasseur
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redactor-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,9 +111,14 @@ files:
|
|
97
111
|
- lib/simple_form_extension/inputs/file_input.rb
|
98
112
|
- lib/simple_form_extension/inputs/image_input.rb
|
99
113
|
- lib/simple_form_extension/inputs/numeric_input.rb
|
114
|
+
- lib/simple_form_extension/inputs/redactor_input.rb
|
115
|
+
- lib/simple_form_extension/railtie.rb
|
100
116
|
- lib/simple_form_extension/translations.rb
|
101
117
|
- lib/simple_form_extension/version.rb
|
102
118
|
- simple_form_extension.gemspec
|
119
|
+
- vendor/assets/javascripts/simple_form_extension.coffee
|
120
|
+
- vendor/assets/javascripts/simple_form_extension/redactor.coffee
|
121
|
+
- vendor/assets/stylesheets/simple_form_extension.sass
|
103
122
|
homepage: http://www.glyph.fr
|
104
123
|
licenses:
|
105
124
|
- MIT
|