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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a263173adb23bdab220fa74f54d2b0d7c4f001da
4
- data.tar.gz: ec33e9c539a3e1f89feb81e5be90e48516a28c35
3
+ metadata.gz: cd6ebc653068a82c826a7b64d2a490c772a11bc8
4
+ data.tar.gz: b94a074230506ffaf6d9f0d6fa08268ea62b0210
5
5
  SHA512:
6
- metadata.gz: 0b55b1322f13609f1e9153a163884efa9c9c39c363ce16019a0dcff6359765ab3830f5de90ee7695772fbfdd3f9789c0e2e5d327577730c794712daa8735e725
7
- data.tar.gz: e26f356bb4180838cb60c1bdea77d012fd942c57712b97c276018998358c50cafb7608b1e0b06da64053ad40379c60f32adaaa1ac4a77dab62848b782afd0f74
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 "simple_form_extension/version"
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)
@@ -10,5 +10,6 @@ module SimpleFormExtension
10
10
  autoload :ColorInput
11
11
  autoload :FileInput
12
12
  autoload :ImageInput
13
+ autoload :RedactorInput
13
14
  end
14
15
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency 'rails', '>= 3.1'
23
23
  spec.add_dependency 'simple_form'
24
+ spec.add_dependency 'redactor-rails'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.5'
26
27
  spec.add_development_dependency 'rake'
@@ -0,0 +1,2 @@
1
+ #= require redactor-rails/redactor
2
+ #= require_tree ./simple_form_extension
@@ -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.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