simple_form_extension 1.2.0 → 1.2.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: 4ebf2e2e16d3a06c2f7419ad9cb6491fcb319cb0
4
- data.tar.gz: 164cdc3686bbb746a2d306d089f9502468d26394
3
+ metadata.gz: 5e75ad7275cf12c8eac28ce92d131b354cdac533
4
+ data.tar.gz: 84e169abb262b13c9e881dc79d1406fac6c2c9b4
5
5
  SHA512:
6
- metadata.gz: cfdb6037ad8b721a3c4e0ac6042a4b72e6757ac37b9b3926c8cc2f377ffaf081e62ba26371d216863850bb816cb815442b4ca4ed57a15fe7cd4aed7c939ad869
7
- data.tar.gz: ea552e574462465ba6918247621ea9144891f95ef13ecfe7c461bf0210ea1d024477db82f6ea5806ca75a41084eb0a986997bb3b18e44b03925e5a2135a97e3a
6
+ metadata.gz: debf714f2d4c8eddf191e43facec0cbbedcb39a39197e1092d83f8bc51dddd35edbd26aca502b6246736ea47b0ed6d4ee103b912f30d77aa02323cac62dca4f7
7
+ data.tar.gz: 767cb54dea42c7aca292ef2e23c75807d5061da34699e176610a0e38c574076279ab5862d28a6777d289173dce91904ad168b80b145b6a567dab5f79be542766
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -1,60 +1,48 @@
1
- onPageReady ->
2
- csrf_token = $('meta[name=csrf-token]').attr('content')
3
- csrf_param = $('meta[name=csrf-param]').attr('content')
1
+ class Redactor
2
+ constructor: (@$el) ->
3
+ params = @params()
4
+
5
+ @$el.redactor
6
+ buttons: ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted',
7
+ 'unorderedlist', 'orderedlist', 'outdent', 'indent',
8
+ 'image', 'file','link', 'alignment', 'horizontalrule']
9
+ removeEmpty: ['strong', 'em', 'span', 'p', 'h1', 'h2', 'h3', 'h4', 'div']
10
+ minHeight: 400
11
+ buttonSource: true
12
+ replaceDivs: false
13
+ linebreaks: false
14
+ toolbarFixed: false
15
+ imageUpload: ["/redactor_rails/pictures", params].join('?')
16
+ imageManagerJson: "/redactor_rails/pictures"
17
+ fileUpload: ["/redactor_rails/documents", params].join('?')
18
+ fileManagerJson: "/redactor_rails/documents"
19
+ plugins: [
20
+ "clips"
21
+ "filemanager"
22
+ "imagemanager"
23
+ "video"
24
+ "table"
25
+ "fontcolor"
26
+ "fontsize"
27
+ ]
28
+ path: "/assets/redactor-rails"
29
+ lang: "fr"
30
+
31
+ params: ->
32
+ csrf_token = $('meta[name=csrf-token]').attr('content')
33
+ csrf_param = $('meta[name=csrf-param]').attr('content')
4
34
 
5
- if (csrf_param isnt undefined and csrf_token isnt undefined)
6
- params = csrf_param + "=" + encodeURIComponent(csrf_token);
35
+ params = if (csrf_param isnt undefined and csrf_token isnt undefined)
36
+ csrf_param + "=" + encodeURIComponent(csrf_token);
7
37
 
8
- $('[data-redactor]').each (i, el) ->
9
- $textArea = $(el)
10
- # Avoid double initialization
11
- unless $textArea.data('initialized.redactor')
12
- $textArea.redactor
13
- buttons: ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted',
14
- 'unorderedlist', 'orderedlist', 'outdent', 'indent',
15
- 'image', 'file','link', 'alignment', 'horizontalrule']
16
- removeEmpty: ['strong', 'em', 'span', 'p', 'h1', 'h2', 'h3', 'h4', 'div']
17
- minHeight: 400
18
- buttonSource: true
19
- replaceDivs: false
20
- linebreaks: false
21
- toolbarFixed: false
22
- imageUpload: ["/redactor_rails/pictures", params].join('?')
23
- imageManagerJson: "/redactor_rails/pictures"
24
- fileUpload: ["/redactor_rails/documents", params].join('?')
25
- fileManagerJson: "/redactor_rails/documents"
26
- plugins: [
27
- "clips"
28
- "filemanager"
29
- "imagemanager"
30
- "video"
31
- "table"
32
- "fontcolor"
33
- "fontsize"
34
- ]
35
- path: "/assets/redactor-rails"
36
- lang: "fr"
37
- $textArea.data('initialized.redactor', true)
38
+ params
38
39
 
39
- $('[data-air-redactor]').each (i, el) ->
40
- $textArea = $(el)
41
- # Avoid double initialization
42
- unless $textArea.data('initialized.redactor')
43
- $textArea.redactor
44
- air: true
45
- plugins: [
46
- "fontcolor"
47
- "fontsize"
48
- ]
49
- airButtons: [
50
- "bold"
51
- "italic"
52
- "fontcolor"
53
- "fontsize"
54
- "underline"
55
- "deleted"
56
- "link"
57
- ]
58
- lang: "fr"
59
-
60
- $textArea.data('initialized.redactor', true)
40
+ $.fn.simpleFormRedactor = ->
41
+ @each (i, el) ->
42
+ $textarea = $(el)
43
+ return if $textarea.data('simple-form:redactor')
44
+ instance = new Redactor($textarea)
45
+ $textarea.data('simple-form:redactor', instance)
46
+
47
+ onPageReady ->
48
+ $('[data-redactor]').simpleFormRedactor()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Vasseur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-16 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails