simple_form_markdown_editor 0.0.1 → 0.0.2

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: c5c6a73ac5c7888296fde17f9ae33f400503c003
4
- data.tar.gz: 9e5e6861ebc55abb6f60d3d4557fe8b5b4259b63
3
+ metadata.gz: 77aa3b6c0bf6971d380554911c59414e89ef0275
4
+ data.tar.gz: 215ff60ff6369f4d0f6cc2dc170d2c6996bd82d5
5
5
  SHA512:
6
- metadata.gz: c0cba84a45c4023bc1e08287e1edabe4da75fd5c000d7c8793c0a89d7455ae9f2377bd9a51c844558f4bf877fbb6067e4838790424a99ef5c28884996a831c27
7
- data.tar.gz: b237ae007a6f238bd28453532a2cf2544629fab7472e718b26e895248a1f440ccf0a808249d305f9dc712bb981f8e823b8f8105b0bc10948a69134bcb1d11796
6
+ metadata.gz: 8f8bf90d711e6b3b6dddf5b53041b68b405ecce1537e1e15bda9e4b7663409e74dcbee39a4ee86201f220ac90adb5bbaacaefb9b1006f9e3797f9a29f37126d1
7
+ data.tar.gz: e61a920eb7df93eae82679df475b6c88bf570924a2d8f0b02d37593b0b9bca8d311ff20ecfa8eb795ac85761abb6af6b70fd79d756efbe559f9544f152f08b1f
data/Gemfile.lock CHANGED
@@ -1,86 +1,78 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_markdown_editor (0.0.1)
5
- autoprefixer-rails
4
+ simple_form_markdown_editor (0.0.2)
6
5
  rails (>= 4.2)
7
6
  redcarpet
8
- responders (~> 2.0)
9
7
  simple_form (>= 3.0.2)
10
8
 
11
9
  GEM
12
10
  remote: https://rubygems.org/
13
11
  specs:
14
- actionmailer (4.2.0)
15
- actionpack (= 4.2.0)
16
- actionview (= 4.2.0)
17
- activejob (= 4.2.0)
12
+ actionmailer (4.2.3)
13
+ actionpack (= 4.2.3)
14
+ actionview (= 4.2.3)
15
+ activejob (= 4.2.3)
18
16
  mail (~> 2.5, >= 2.5.4)
19
17
  rails-dom-testing (~> 1.0, >= 1.0.5)
20
- actionpack (4.2.0)
21
- actionview (= 4.2.0)
22
- activesupport (= 4.2.0)
23
- rack (~> 1.6.0)
18
+ actionpack (4.2.3)
19
+ actionview (= 4.2.3)
20
+ activesupport (= 4.2.3)
21
+ rack (~> 1.6)
24
22
  rack-test (~> 0.6.2)
25
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
27
- actionview (4.2.0)
28
- activesupport (= 4.2.0)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.3)
26
+ activesupport (= 4.2.3)
29
27
  builder (~> 3.1)
30
28
  erubis (~> 2.7.0)
31
29
  rails-dom-testing (~> 1.0, >= 1.0.5)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
33
- activejob (4.2.0)
34
- activesupport (= 4.2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
+ activejob (4.2.3)
32
+ activesupport (= 4.2.3)
35
33
  globalid (>= 0.3.0)
36
- activemodel (4.2.0)
37
- activesupport (= 4.2.0)
34
+ activemodel (4.2.3)
35
+ activesupport (= 4.2.3)
38
36
  builder (~> 3.1)
39
- activerecord (4.2.0)
40
- activemodel (= 4.2.0)
41
- activesupport (= 4.2.0)
37
+ activerecord (4.2.3)
38
+ activemodel (= 4.2.3)
39
+ activesupport (= 4.2.3)
42
40
  arel (~> 6.0)
43
- activesupport (4.2.0)
41
+ activesupport (4.2.3)
44
42
  i18n (~> 0.7)
45
43
  json (~> 1.7, >= 1.7.7)
46
44
  minitest (~> 5.1)
47
45
  thread_safe (~> 0.3, >= 0.3.4)
48
46
  tzinfo (~> 1.1)
49
47
  arel (6.0.0)
50
- autoprefixer-rails (5.1.7.1)
51
- execjs
52
- json
53
48
  builder (3.2.2)
54
49
  erubis (2.7.0)
55
- execjs (2.4.0)
56
- globalid (0.3.3)
50
+ globalid (0.3.5)
57
51
  activesupport (>= 4.1.0)
58
- hike (1.2.3)
59
52
  i18n (0.7.0)
60
- json (1.8.2)
61
- loofah (2.0.1)
53
+ json (1.8.3)
54
+ loofah (2.0.2)
62
55
  nokogiri (>= 1.5.9)
63
56
  mail (2.6.3)
64
57
  mime-types (>= 1.16, < 3)
65
- mime-types (2.4.3)
58
+ mime-types (2.6.1)
66
59
  mini_portile (0.6.2)
67
- minitest (5.5.1)
68
- multi_json (1.11.0)
60
+ minitest (5.7.0)
69
61
  nokogiri (1.6.6.2)
70
62
  mini_portile (~> 0.6.0)
71
- rack (1.6.0)
63
+ rack (1.6.4)
72
64
  rack-test (0.6.3)
73
65
  rack (>= 1.0)
74
- rails (4.2.0)
75
- actionmailer (= 4.2.0)
76
- actionpack (= 4.2.0)
77
- actionview (= 4.2.0)
78
- activejob (= 4.2.0)
79
- activemodel (= 4.2.0)
80
- activerecord (= 4.2.0)
81
- activesupport (= 4.2.0)
66
+ rails (4.2.3)
67
+ actionmailer (= 4.2.3)
68
+ actionpack (= 4.2.3)
69
+ actionview (= 4.2.3)
70
+ activejob (= 4.2.3)
71
+ activemodel (= 4.2.3)
72
+ activerecord (= 4.2.3)
73
+ activesupport (= 4.2.3)
82
74
  bundler (>= 1.3.0, < 2.0)
83
- railties (= 4.2.0)
75
+ railties (= 4.2.3)
84
76
  sprockets-rails
85
77
  rails-deprecated_sanitizer (1.0.3)
86
78
  activesupport (>= 4.2.0.alpha)
@@ -90,30 +82,24 @@ GEM
90
82
  rails-deprecated_sanitizer (>= 1.0.1)
91
83
  rails-html-sanitizer (1.0.2)
92
84
  loofah (~> 2.0)
93
- railties (4.2.0)
94
- actionpack (= 4.2.0)
95
- activesupport (= 4.2.0)
85
+ railties (4.2.3)
86
+ actionpack (= 4.2.3)
87
+ activesupport (= 4.2.3)
96
88
  rake (>= 0.8.7)
97
89
  thor (>= 0.18.1, < 2.0)
98
90
  rake (10.4.2)
99
- redcarpet (3.2.2)
100
- responders (2.1.0)
101
- railties (>= 4.2.0, < 5)
91
+ redcarpet (3.3.2)
102
92
  simple_form (3.1.0)
103
93
  actionpack (~> 4.0)
104
94
  activemodel (~> 4.0)
105
- sprockets (2.12.3)
106
- hike (~> 1.2)
107
- multi_json (~> 1.0)
95
+ sprockets (3.2.0)
108
96
  rack (~> 1.0)
109
- tilt (~> 1.1, != 1.3.0)
110
- sprockets-rails (2.2.4)
97
+ sprockets-rails (2.3.2)
111
98
  actionpack (>= 3.0)
112
99
  activesupport (>= 3.0)
113
100
  sprockets (>= 2.8, < 4.0)
114
101
  thor (0.19.1)
115
102
  thread_safe (0.3.5)
116
- tilt (1.4.1)
117
103
  tzinfo (1.2.2)
118
104
  thread_safe (~> 0.1)
119
105
 
@@ -1,8 +1,8 @@
1
- require 'responders'
2
-
3
1
  module SimpleFormMarkdownEditor
4
2
  class PreviewsController < ActionController::Base
5
3
 
4
+ protect_from_forgery with: :exception
5
+
6
6
  respond_to :html
7
7
 
8
8
  def preview
@@ -14,8 +14,9 @@ module SimpleFormMarkdownEditor
14
14
  private # =============================================================
15
15
 
16
16
  def preview_params
17
+ return unless params[:text].present?
17
18
  params.require(:text)
18
19
  end
19
20
 
20
21
  end
21
- end
22
+ end
data/config/routes.rb CHANGED
@@ -1,7 +1,5 @@
1
- # NOTE: Is this the best way to do it? Users will have to mount the engine. Alternative?
2
-
3
1
  SimpleFormMarkdownEditor::Engine.routes.draw do
4
2
  scope module: :simple_form_markdown_editor do
5
- post "/preview" => "previews#preview", as: :preview
3
+ put "/preview" => "previews#preview", as: :preview
6
4
  end
7
- end
5
+ end
@@ -34,13 +34,11 @@ do ($ = jQuery, window, document) ->
34
34
  # ---------------------------------------------------------------------
35
35
 
36
36
  get_help_div: -> @$element.find('div.help')
37
-
38
37
  get_sections_ul: -> @get_help_div().find('ul.sections')
39
38
  get_section_lis: -> @get_sections_ul().children('li')
40
39
  get_sub_section_ul: (section) -> @get_sub_sections_uls().filter(".#{section}")
41
40
  get_sub_sections_uls: -> @get_help_div().find('ul.sub_sections')
42
41
  get_sub_section_lis: -> @get_sub_sections_uls().children('li.sub_section')
43
-
44
42
  get_help_text_divs: -> @get_help_div().find('div.help_text')
45
43
 
46
44
  set_section_li: ($li) ->
@@ -33,7 +33,9 @@ do ($ = jQuery, window, document) ->
33
33
  context: @element
34
34
  type: 'POST'
35
35
  url: @$element.attr('data-preview-url')
36
- data: text: @get_textarea().val()
36
+ data:
37
+ _method: 'PUT'
38
+ text: @get_textarea().val() || ''
37
39
  success: (html) =>
38
40
  @get_preview_div().html(html) or "<p>#{@get_nothing_to_preview_text()}</p>"
39
41
  )
@@ -62,7 +62,6 @@ div.simple_form_markdown_editor {
62
62
  border: 1px solid $grey;
63
63
  border-radius: 2px;
64
64
  width: 100%;
65
- min-height: 176px;
66
65
  margin: 0;
67
66
  box-sizing: border-box;
68
67
  padding: 7px;
@@ -272,4 +271,4 @@ div.simple_form_markdown_editor {
272
271
  }
273
272
  }
274
273
  }
275
- }
274
+ }
@@ -16,6 +16,7 @@ module SimpleFormMarkdownEditor
16
16
  end
17
17
 
18
18
  def call
19
+ return unless @str.present?
19
20
  markdown_renderer.render(@str).html_safe
20
21
  end
21
22
 
@@ -21,7 +21,10 @@ module SimpleFormMarkdownEditor
21
21
 
22
22
  def input wrapper_options
23
23
  template.content_tag :div, merge_wrapper_options(input_html_options, wrapper_options) do
24
- header + help + editor + preview
24
+ template.concat header
25
+ template.concat help
26
+ template.concat editor
27
+ template.concat preview
25
28
  end
26
29
  end
27
30
 
@@ -1,3 +1,3 @@
1
1
  module SimpleFormMarkdownEditor
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = "0.0.2"
3
+ end
@@ -21,10 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "rails", ">= 4.2"
22
22
  spec.add_dependency "simple_form", ">= 3.0.2"
23
23
  spec.add_dependency "redcarpet"
24
- spec.add_dependency "autoprefixer-rails"
25
-
26
- spec.add_dependency "responders", "~> 2.0"
27
24
 
28
25
  spec.add_development_dependency "bundler", "~> 1.6"
29
26
  spec.add_development_dependency "rake"
30
- end
27
+ end
@@ -1,14 +1,3 @@
1
- GIT
2
- remote: git@github.com:tomasc/simple_form_markdown_editor.git
3
- revision: 7c77f1c7e20e370426cb996e9447f8bd52165d15
4
- branch: master
5
- specs:
6
- simple_form_markdown_editor (0.0.1)
7
- rails (>= 4.2)
8
- redcarpet
9
- responders (~> 2.0)
10
- simple_form (>= 3.0.2)
11
-
12
1
  GEM
13
2
  remote: https://rubygems.org/
14
3
  specs:
@@ -48,6 +37,9 @@ GEM
48
37
  thread_safe (~> 0.3, >= 0.3.4)
49
38
  tzinfo (~> 1.1)
50
39
  arel (6.0.0)
40
+ autoprefixer-rails (5.1.7.1)
41
+ execjs
42
+ json
51
43
  binding_of_caller (0.7.2)
52
44
  debug_inspector (>= 0.0.1)
53
45
  bson (2.3.0)
@@ -145,6 +137,12 @@ GEM
145
137
  simple_form (3.1.0)
146
138
  actionpack (~> 4.0)
147
139
  activemodel (~> 4.0)
140
+ simple_form_markdown_editor (0.0.1)
141
+ autoprefixer-rails
142
+ rails (>= 4.2)
143
+ redcarpet
144
+ responders (~> 2.0)
145
+ simple_form (>= 3.0.2)
148
146
  slim (3.0.3)
149
147
  temple (~> 0.7.3)
150
148
  tilt (>= 1.3.3, < 2.1)
@@ -187,7 +185,7 @@ DEPENDENCIES
187
185
  rails (= 4.2.0)
188
186
  sass-rails (~> 5.0)
189
187
  sdoc (~> 0.4.0)
190
- simple_form_markdown_editor!
188
+ simple_form_markdown_editor
191
189
  slim
192
190
  spring
193
191
  turbolinks
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_markdown_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Celizna
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-19 00:00:00.000000000 Z
12
+ date: 2015-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -53,34 +53,6 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: autoprefixer-rails
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: responders
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '2.0'
77
- type: :runtime
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '2.0'
84
56
  - !ruby/object:Gem::Dependency
85
57
  name: bundler
86
58
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
196
  version: '0'
225
197
  requirements: []
226
198
  rubyforge_project:
227
- rubygems_version: 2.4.6
199
+ rubygems_version: 2.4.8
228
200
  signing_key:
229
201
  specification_version: 4
230
202
  summary: Simple Markdown editor (inspired by GitHub editor).