simple_form_markdown_editor 0.0.10 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +70 -58
  4. data/app/controllers/simple_form_markdown_editor/previews_controller.rb +19 -7
  5. data/lib/assets/javascripts/simple_form_markdown_editor.js +1 -3
  6. data/lib/assets/javascripts/simple_form_markdown_editor/__buttons.coffee.erb +48 -0
  7. data/lib/assets/javascripts/simple_form_markdown_editor/__editor.coffee.erb +81 -0
  8. data/lib/assets/javascripts/simple_form_markdown_editor/__help.coffee.erb +86 -0
  9. data/lib/assets/javascripts/simple_form_markdown_editor/__preview.coffee.erb +42 -0
  10. data/lib/assets/javascripts/simple_form_markdown_editor/__tabs.coffee.erb +59 -0
  11. data/lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor.coffee.erb +98 -0
  12. data/lib/assets/stylesheets/simple_form_markdown_editor.css +2 -2
  13. data/lib/assets/stylesheets/simple_form_markdown_editor/_partials.scss +5 -0
  14. data/lib/assets/stylesheets/simple_form_markdown_editor/buttons/__button.scss.erb +4 -0
  15. data/lib/assets/stylesheets/simple_form_markdown_editor/buttons/__button_group.scss.erb +5 -0
  16. data/lib/assets/stylesheets/simple_form_markdown_editor/buttons/__button_wrapper.scss.erb +5 -0
  17. data/lib/assets/stylesheets/simple_form_markdown_editor/buttons/__buttons.scss.erb +9 -0
  18. data/lib/assets/stylesheets/simple_form_markdown_editor/editor/__editor.scss.erb +4 -0
  19. data/lib/assets/stylesheets/simple_form_markdown_editor/header/__header.scss.erb +4 -0
  20. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help.scss.erb +12 -0
  21. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__section.scss.erb +3 -0
  22. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__sections.scss.erb +5 -0
  23. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__sub_section.scss.erb +9 -0
  24. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__sub_section__item.scss.erb +7 -0
  25. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__sub_section__items.scss.erb +5 -0
  26. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__sub_sections.scss.erb +5 -0
  27. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__text.scss.erb +9 -0
  28. data/lib/assets/stylesheets/simple_form_markdown_editor/help/__help__texts.scss.erb +5 -0
  29. data/lib/assets/stylesheets/simple_form_markdown_editor/preview/__preview.scss.erb +4 -0
  30. data/lib/assets/stylesheets/simple_form_markdown_editor/simple_form_markdown_editor.scss.erb +23 -0
  31. data/lib/assets/stylesheets/simple_form_markdown_editor/tabs/__tab.scss.erb +8 -0
  32. data/lib/assets/stylesheets/simple_form_markdown_editor/tabs/__tabs.scss.erb +9 -0
  33. data/lib/simple_form_markdown_editor.rb +11 -3
  34. data/lib/simple_form_markdown_editor/markdown_editor_input.rb +41 -53
  35. data/lib/simple_form_markdown_editor/version.rb +1 -1
  36. data/simple_form_markdown_editor.gemspec +4 -1
  37. metadata +72 -7
  38. data/lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_buttons.coffee.erb +0 -114
  39. data/lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_help.coffee +0 -92
  40. data/lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_tabs.coffee +0 -82
  41. data/lib/assets/stylesheets/simple_form_markdown_editor/simple_form_markdown_editor.css.scss +0 -274
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c223a067b189cfc19fc2b13004aae3264a9da72b
4
- data.tar.gz: '095304ef36d7a2bf71d813aabb742c14f880283f'
3
+ metadata.gz: 62b487c0633479c9e70d4afa7b43c4e8e9bdb0ec
4
+ data.tar.gz: 9be5189c8ce8f6464e555414371093fd15be0e9e
5
5
  SHA512:
6
- metadata.gz: 461e126ef612f53bef65b62ce3321f31fefdf8f076a04843e68b50a64b8852f9988aafdf540fa672d22998923164baaad00dc02dc67c96d688906917a5f8ac4e
7
- data.tar.gz: 0e9cc022b643e04635e6b0f800fae700e83dae49bc8b0096c69b3b9eee459d0003abe80f28c27bc1cf9f95216cdd3c366ac25030916e18ce740351d8c5b54ff7
6
+ metadata.gz: ce18b0bd63c50a787ff2daed4eddc27e47acc273de0936ecc19cc4c8bec927ecf635c9354e528452f1a158b91f17915dade902fe280e991db873557951c8c5ea
7
+ data.tar.gz: bd3c545a0c0e54f701bdefb58fd1aaa584fb3c1f98ed4db59ef43b281eca39d5e80031b4d56db6b91eb048b1d80a4b469051ed8446e79da35fdcb4db73220b54
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.0.0
4
+
5
+ * refactored markup & css
@@ -1,105 +1,113 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_markdown_editor (0.0.10)
4
+ simple_form_markdown_editor (1.0.0)
5
5
  rails (>= 4.2)
6
6
  redcarpet
7
7
  responders
8
8
  simple_form (>= 3.0.2)
9
+ slim
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- actioncable (5.0.2)
14
- actionpack (= 5.0.2)
15
- nio4r (>= 1.2, < 3.0)
14
+ actioncable (5.1.1)
15
+ actionpack (= 5.1.1)
16
+ nio4r (~> 2.0)
16
17
  websocket-driver (~> 0.6.1)
17
- actionmailer (5.0.2)
18
- actionpack (= 5.0.2)
19
- actionview (= 5.0.2)
20
- activejob (= 5.0.2)
18
+ actionmailer (5.1.1)
19
+ actionpack (= 5.1.1)
20
+ actionview (= 5.1.1)
21
+ activejob (= 5.1.1)
21
22
  mail (~> 2.5, >= 2.5.4)
22
23
  rails-dom-testing (~> 2.0)
23
- actionpack (5.0.2)
24
- actionview (= 5.0.2)
25
- activesupport (= 5.0.2)
24
+ actionpack (5.1.1)
25
+ actionview (= 5.1.1)
26
+ activesupport (= 5.1.1)
26
27
  rack (~> 2.0)
27
28
  rack-test (~> 0.6.3)
28
29
  rails-dom-testing (~> 2.0)
29
30
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
- actionview (5.0.2)
31
- activesupport (= 5.0.2)
31
+ actionview (5.1.1)
32
+ activesupport (= 5.1.1)
32
33
  builder (~> 3.1)
33
- erubis (~> 2.7.0)
34
+ erubi (~> 1.4)
34
35
  rails-dom-testing (~> 2.0)
35
36
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
36
- activejob (5.0.2)
37
- activesupport (= 5.0.2)
37
+ activejob (5.1.1)
38
+ activesupport (= 5.1.1)
38
39
  globalid (>= 0.3.6)
39
- activemodel (5.0.2)
40
- activesupport (= 5.0.2)
41
- activerecord (5.0.2)
42
- activemodel (= 5.0.2)
43
- activesupport (= 5.0.2)
44
- arel (~> 7.0)
45
- activesupport (5.0.2)
40
+ activemodel (5.1.1)
41
+ activesupport (= 5.1.1)
42
+ activerecord (5.1.1)
43
+ activemodel (= 5.1.1)
44
+ activesupport (= 5.1.1)
45
+ arel (~> 8.0)
46
+ activesupport (5.1.1)
46
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
47
48
  i18n (~> 0.7)
48
49
  minitest (~> 5.1)
49
50
  tzinfo (~> 1.1)
50
- arel (7.1.4)
51
+ arel (8.0.0)
51
52
  builder (3.2.3)
52
53
  concurrent-ruby (1.0.5)
53
- erubis (2.7.0)
54
- globalid (0.3.7)
55
- activesupport (>= 4.1.0)
56
- i18n (0.8.1)
54
+ erubi (1.6.0)
55
+ globalid (0.4.0)
56
+ activesupport (>= 4.2.0)
57
+ i18n (0.8.4)
57
58
  loofah (2.0.3)
58
59
  nokogiri (>= 1.5.9)
59
- mail (2.6.4)
60
+ mail (2.6.5)
60
61
  mime-types (>= 1.16, < 4)
61
62
  method_source (0.8.2)
62
63
  mime-types (3.1)
63
64
  mime-types-data (~> 3.2015)
64
65
  mime-types-data (3.2016.0521)
65
- mini_portile2 (2.1.0)
66
- minitest (5.10.1)
67
- nio4r (2.0.0)
68
- nokogiri (1.7.1)
69
- mini_portile2 (~> 2.1.0)
70
- rack (2.0.1)
66
+ mini_portile2 (2.2.0)
67
+ minitest (5.10.2)
68
+ minitest-rails (3.0.0)
69
+ minitest (~> 5.8)
70
+ railties (~> 5.0)
71
+ nio4r (2.1.0)
72
+ nokogiri (1.8.0)
73
+ mini_portile2 (~> 2.2.0)
74
+ rack (2.0.3)
71
75
  rack-test (0.6.3)
72
76
  rack (>= 1.0)
73
- rails (5.0.2)
74
- actioncable (= 5.0.2)
75
- actionmailer (= 5.0.2)
76
- actionpack (= 5.0.2)
77
- actionview (= 5.0.2)
78
- activejob (= 5.0.2)
79
- activemodel (= 5.0.2)
80
- activerecord (= 5.0.2)
81
- activesupport (= 5.0.2)
77
+ rails (5.1.1)
78
+ actioncable (= 5.1.1)
79
+ actionmailer (= 5.1.1)
80
+ actionpack (= 5.1.1)
81
+ actionview (= 5.1.1)
82
+ activejob (= 5.1.1)
83
+ activemodel (= 5.1.1)
84
+ activerecord (= 5.1.1)
85
+ activesupport (= 5.1.1)
82
86
  bundler (>= 1.3.0, < 2.0)
83
- railties (= 5.0.2)
87
+ railties (= 5.1.1)
84
88
  sprockets-rails (>= 2.0.0)
85
- rails-dom-testing (2.0.2)
86
- activesupport (>= 4.2.0, < 6.0)
87
- nokogiri (~> 1.6)
89
+ rails-dom-testing (2.0.3)
90
+ activesupport (>= 4.2.0)
91
+ nokogiri (>= 1.6)
88
92
  rails-html-sanitizer (1.0.3)
89
93
  loofah (~> 2.0)
90
- railties (5.0.2)
91
- actionpack (= 5.0.2)
92
- activesupport (= 5.0.2)
94
+ railties (5.1.1)
95
+ actionpack (= 5.1.1)
96
+ activesupport (= 5.1.1)
93
97
  method_source
94
98
  rake (>= 0.8.7)
95
99
  thor (>= 0.18.1, < 2.0)
96
- rake (11.3.0)
100
+ rake (10.5.0)
97
101
  redcarpet (3.4.0)
98
- responders (2.3.0)
99
- railties (>= 4.2.0, < 5.1)
100
- simple_form (3.4.0)
101
- actionpack (> 4, < 5.1)
102
- activemodel (> 4, < 5.1)
102
+ responders (2.4.0)
103
+ actionpack (>= 4.2.0, < 5.3)
104
+ railties (>= 4.2.0, < 5.3)
105
+ simple_form (3.5.0)
106
+ actionpack (> 4, < 5.2)
107
+ activemodel (> 4, < 5.2)
108
+ slim (3.0.8)
109
+ temple (>= 0.7.6, < 0.9)
110
+ tilt (>= 1.3.3, < 2.1)
103
111
  sprockets (3.7.1)
104
112
  concurrent-ruby (~> 1.0)
105
113
  rack (> 1, < 3)
@@ -107,8 +115,10 @@ GEM
107
115
  actionpack (>= 4.0)
108
116
  activesupport (>= 4.0)
109
117
  sprockets (>= 3.0.0)
118
+ temple (0.8.0)
110
119
  thor (0.19.4)
111
120
  thread_safe (0.3.6)
121
+ tilt (2.0.7)
112
122
  tzinfo (1.2.3)
113
123
  thread_safe (~> 0.1)
114
124
  websocket-driver (0.6.5)
@@ -120,7 +130,9 @@ PLATFORMS
120
130
 
121
131
  DEPENDENCIES
122
132
  bundler (~> 1.6)
123
- rake
133
+ minitest (~> 5.0)
134
+ minitest-rails
135
+ rake (~> 10.0)
124
136
  simple_form_markdown_editor!
125
137
 
126
138
  BUNDLED WITH
@@ -1,35 +1,47 @@
1
1
  module SimpleFormMarkdownEditor
2
2
  class PreviewsController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
+
4
5
  respond_to :html
5
6
 
6
7
  def preview
7
8
  respond_to do |format|
8
- format.html { render text: text_preview }
9
+ format.html { render plain: text_preview }
9
10
  end
10
11
  end
11
12
 
12
- private # =============================================================
13
+ private
13
14
 
14
15
  # overwrite this in your own controller
15
16
  def text_preview
16
- Renderer.call(text, { render_class: render_class, extensions: extensions })
17
+ Renderer.call(text, { render_class: render_class, extensions: extensions.to_h })
17
18
  end
18
19
 
19
20
  def text
20
- params[:text].presence || ""
21
+ preview_params[:text] || ''
21
22
  end
22
23
 
23
24
  def options
24
- params.fetch(:options, {})
25
+ preview_params[:options]
25
26
  end
26
27
 
27
28
  def render_class
28
- options.fetch(:render_class, nil).to_s.safe_constantize
29
+ options[:render_class].present? ? options[:render_class].constantize : MarkdownEditorInput.configuration.render_class
29
30
  end
30
31
 
31
32
  def extensions
32
- options.fetch(:extensions, {})
33
+ options[:extensions] || MarkdownEditorInput.configuration.extensions
34
+ end
35
+
36
+ def render_options
37
+ options[:render_options] || MarkdownEditorInput.configuration.render_options
38
+ end
39
+
40
+ def preview_params
41
+ params.permit(:text)
42
+ params.permit(:options)
43
+ params[:options].permit!
44
+ params
33
45
  end
34
46
  end
35
47
  end
@@ -1,3 +1 @@
1
- //= require simple_form_markdown_editor/simple_form_markdown_editor_tabs
2
- //= require simple_form_markdown_editor/simple_form_markdown_editor_buttons
3
- //= require simple_form_markdown_editor/simple_form_markdown_editor_help
1
+ //= require_tree .
@@ -0,0 +1,48 @@
1
+ # https://github.com/jquery-boilerplate/jquery-boilerplate/
2
+ do ($ = jQuery, window, document) ->
3
+ pluginName = 'simple_form_markdown_editor__buttons'
4
+ defaults =
5
+ debug: false
6
+
7
+ class Plugin
8
+ constructor: (@element, options) ->
9
+ @settings = $.extend {}, defaults, options
10
+
11
+ @$element = $(@element)
12
+
13
+ @_defaults = defaults
14
+ @_name = pluginName
15
+
16
+ @init()
17
+
18
+ init: ->
19
+ @get_help_button().on 'click', (e) =>
20
+ @$element.trigger('toggle_help')
21
+
22
+ @get_command_buttons().on 'click', (e) =>
23
+ $button = $(e.currentTarget)
24
+ command = $button.attr('value')
25
+ @$element.trigger(type: 'execute_command', command: command)
26
+
27
+ # ---------------------------------------------------------------------
28
+
29
+ get_buttons: -> @$element.find('.<%= SimpleFormMarkdownEditor.dom_class(:button) %>')
30
+ get_command_buttons: -> @get_buttons().not(@get_help_button())
31
+ get_help_button: -> @get_buttons().filter("[value='help']")
32
+
33
+ # ---------------------------------------------------------------------
34
+
35
+ $.fn[pluginName] = (options) ->
36
+ args = arguments
37
+ if options is `undefined` or typeof options is "object"
38
+ @each ->
39
+ $.data this, "plugin_" + pluginName, new Plugin(this, options) unless $.data(this, "plugin_" + pluginName)
40
+
41
+ else if typeof options is "string" and options[0] isnt "_" and options isnt "init"
42
+ returns = undefined
43
+ @each ->
44
+ instance = $.data(this, "plugin_" + pluginName)
45
+ returns = instance[options].apply(instance, Array::slice.call(args, 1)) if instance instanceof Plugin and typeof instance[options] is "function"
46
+ $.data this, "plugin_" + pluginName, null if options is "destroy"
47
+
48
+ (if returns isnt `undefined` then returns else this)
@@ -0,0 +1,81 @@
1
+ # https://github.com/jquery-boilerplate/jquery-boilerplate/
2
+ do ($ = jQuery, window, document) ->
3
+ pluginName = 'simple_form_markdown_editor__editor'
4
+ defaults =
5
+ debug: false
6
+
7
+ class Plugin
8
+ constructor: (@element, options) ->
9
+ @settings = $.extend {}, defaults, options
10
+
11
+ @$element = $(@element)
12
+
13
+ @_defaults = defaults
14
+ @_name = pluginName
15
+
16
+ @init()
17
+
18
+ init: ->
19
+ @$element.on 'execute_command_definition', (e) =>
20
+ e.stopPropagation()
21
+ command = e.command
22
+ definition = e.definition
23
+ @execute_command_definition(command, definition)
24
+
25
+ # ---------------------------------------------------------------------
26
+
27
+ get_textarea: -> @$element.find 'textarea'
28
+ get_val: -> @get_textarea().val()
29
+ get_selection: ->
30
+ $e = @get_textarea()
31
+ {
32
+ start: $e[0].selectionStart
33
+ end: $e[0].selectionEnd
34
+ length: $e[0].selectionEnd - $e[0].selectionStart
35
+ text: $e.val().substring($e[0].selectionStart, $e[0].selectionEnd)
36
+ }
37
+
38
+ # ---------------------------------------------------------------------
39
+
40
+ execute_command_definition: (command, definition) ->
41
+ selection = @get_selection()
42
+ replacement = definition.replace('%{str}', selection.text)
43
+ caret_pos = replacement.indexOf('|')
44
+ start = selection.start
45
+ end = selection.start + replacement.length
46
+ if caret_pos > -1
47
+ replacement = replacement.replace(/\|/g, '')
48
+ start = selection.start + caret_pos
49
+ end = selection.start + caret_pos
50
+ @replace_selection(replacement)
51
+ @set_selection(start, end)
52
+
53
+ set_selection: (start, end) ->
54
+ $e = @get_textarea()
55
+ $e.focus()
56
+ $e[0].selectionStart = start
57
+ $e[0].selectionEnd = end
58
+
59
+ replace_selection: (string) ->
60
+ $e = @get_textarea()
61
+ start = $e[0].selectionStart
62
+ end = $e[0].selectionEnd
63
+ val = $e.val()
64
+ $e.val(val.substring(0, start) + string + val.substring(end, val.length))
65
+
66
+ # ---------------------------------------------------------------------
67
+
68
+ $.fn[pluginName] = (options) ->
69
+ args = arguments
70
+ if options is `undefined` or typeof options is "object"
71
+ @each ->
72
+ $.data this, "plugin_" + pluginName, new Plugin(this, options) unless $.data(this, "plugin_" + pluginName)
73
+
74
+ else if typeof options is "string" and options[0] isnt "_" and options isnt "init"
75
+ returns = undefined
76
+ @each ->
77
+ instance = $.data(this, "plugin_" + pluginName)
78
+ returns = instance[options].apply(instance, Array::slice.call(args, 1)) if instance instanceof Plugin and typeof instance[options] is "function"
79
+ $.data this, "plugin_" + pluginName, null if options is "destroy"
80
+
81
+ (if returns isnt `undefined` then returns else this)
@@ -0,0 +1,86 @@
1
+ # https://github.com/jquery-boilerplate/jquery-boilerplate/
2
+ do ($ = jQuery, window, document) ->
3
+ pluginName = 'simple_form_markdown_editor__help'
4
+ defaults =
5
+ debug: false
6
+ section_is_active_class: '<%= SimpleFormMarkdownEditor.dom_class(:help, :section, :is_active) %>'
7
+ sub_section_is_active_class: '<%= SimpleFormMarkdownEditor.dom_class(:help, :sub_section, :is_active) %>'
8
+ sub_section_item_is_active_class: '<%= SimpleFormMarkdownEditor.dom_class(:help, :sub_section, :item, :is_active) %>'
9
+ help_text_is_active_class: '<%= SimpleFormMarkdownEditor.dom_class(:help, :text, :is_active) %>'
10
+
11
+ class Plugin
12
+ constructor: (@element, options) ->
13
+ @settings = $.extend {}, defaults, options
14
+
15
+ @$element = $(@element)
16
+
17
+ @_defaults = defaults
18
+ @_name = pluginName
19
+
20
+ @init()
21
+
22
+ init: ->
23
+ $initial_section = @get_sections().first()
24
+ @set_section($initial_section)
25
+
26
+ @$element.on 'click', @get_sections().selector, (e) =>
27
+ e.preventDefault()
28
+ $section = $(e.currentTarget)
29
+ @set_section($section)
30
+
31
+ @$element.on 'click', @get_sub_section_items().selector, (e) =>
32
+ e.preventDefault()
33
+ $sub_section_item = $(e.currentTarget)
34
+ @set_sub_section_item($sub_section_item)
35
+
36
+ # ---------------------------------------------------------------------
37
+
38
+ get_help_text: (sub_section_name) -> @get_help_texts().filter("[data-sub-section='#{sub_section_name}']")
39
+ get_help_texts: -> @$element.find('.<%= SimpleFormMarkdownEditor.dom_class(:help, :text) %>')
40
+ get_sections: -> @$element.find('.<%= SimpleFormMarkdownEditor.dom_class(:help, :section) %>')
41
+ get_sub_section: (section_name) -> @get_sub_sections().filter("[data-section='#{section_name}']")
42
+ get_sub_section_items: -> @$element.find('.<%= SimpleFormMarkdownEditor.dom_class(:help, :sub_section, :item) %>')
43
+ get_sub_sections: -> @$element.find('.<%= SimpleFormMarkdownEditor.dom_class(:help, :sub_section) %>')
44
+
45
+ # ---------------------------------------------------------------------
46
+
47
+ set_section: ($section) ->
48
+ $section.siblings().removeClass(@settings.section_is_active_class)
49
+ $section.addClass(@settings.section_is_active_class)
50
+ section_name = $section.data('section')
51
+ $sub_section = @get_sub_section(section_name)
52
+ @set_sub_section($sub_section)
53
+
54
+ set_sub_section: ($sub_section) ->
55
+ $sub_section.siblings().removeClass(@settings.sub_section_is_active_class)
56
+ $sub_section.addClass(@settings.sub_section_is_active_class)
57
+ $sub_section_item = $sub_section.find('.<%= SimpleFormMarkdownEditor.dom_class(:help, :sub_section, :item) %>').first()
58
+ @set_sub_section_item($sub_section_item)
59
+
60
+ set_sub_section_item: ($sub_section_item) ->
61
+ $sub_section_item.siblings().removeClass(@settings.sub_section_item_is_active_class)
62
+ $sub_section_item.addClass(@settings.sub_section_item_is_active_class)
63
+ sub_section_name = $sub_section_item.data('sub-section')
64
+ $help_text = @get_help_text(sub_section_name)
65
+ @set_help_text($help_text)
66
+
67
+ set_help_text: ($help_text) ->
68
+ $help_text.siblings().removeClass(@settings.help_text_is_active_class)
69
+ $help_text.addClass(@settings.help_text_is_active_class)
70
+
71
+ # ---------------------------------------------------------------------
72
+
73
+ $.fn[pluginName] = (options) ->
74
+ args = arguments
75
+ if options is `undefined` or typeof options is "object"
76
+ @each ->
77
+ $.data this, "plugin_" + pluginName, new Plugin(this, options) unless $.data(this, "plugin_" + pluginName)
78
+
79
+ else if typeof options is "string" and options[0] isnt "_" and options isnt "init"
80
+ returns = undefined
81
+ @each ->
82
+ instance = $.data(this, "plugin_" + pluginName)
83
+ returns = instance[options].apply(instance, Array::slice.call(args, 1)) if instance instanceof Plugin and typeof instance[options] is "function"
84
+ $.data this, "plugin_" + pluginName, null if options is "destroy"
85
+
86
+ (if returns isnt `undefined` then returns else this)