textile_editor_helper 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +13 -0
- data/README.md +8 -4
- data/Rakefile +1 -1
- data/lib/helpers/default.rb +1 -1
- data/lib/helpers/formtastic.rb +6 -8
- data/lib/textile_editor_helper/version.rb +1 -1
- data/test/formtastic_test.rb +1 -3
- data/test/simple_form_test.rb +1 -3
- data/test/support_methods.rb +0 -3
- data/test/test_helper.rb +3 -2
- data/test/textile_editor_helper_test.rb +4 -6
- data/textile_editor_helper.gemspec +2 -9
- metadata +6 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6506ce701499ed38ed83ed367c9f6bbf3b04b6a9
|
4
|
+
data.tar.gz: a5d9c2488e74357e9be9336aa499a4def45cf273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06131e8dacc60c8d99363172f7ca92a3f52f8cd0c717dc6b6e13ad1caa62884f633cabe1a6ef80c82ef6451b20a32505365e2fcc8420d83af0028b3fadc7c518
|
7
|
+
data.tar.gz: 8e24862b754ada4684e1b08ab3d2e877f1f38fac191328f383aa6c410628346c986a1af8598d9c2794b2331bc40e9ac65919248aa2a3d4ef667ff9f75826ad1e
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
repo_token: zcW14XEiLyTOBzLVU0RCfEcXhWIzqItFA
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -12,3 +12,12 @@
|
|
12
12
|
* Fixed some generator bugs.
|
13
13
|
* Refactored tests and helpers to make sure there is no duplicated coda
|
14
14
|
* Load and require simple_form and formtastic helpers and dependencies only when the gems are found.
|
15
|
+
|
16
|
+
## Version 0.1.2
|
17
|
+
|
18
|
+
* Rails 3.2 is no longer supported. But people can use the older version of the gem.
|
19
|
+
* Rails 4.1.4 or greater is supported.
|
20
|
+
* Updated Cucumber tests.
|
21
|
+
* Consistently use Asset pipeline as images previously used the public dir.
|
22
|
+
* There are no known issues after dependency upgrades. The gem works for simple_form and formtastic.
|
23
|
+
* Ruby 1.8 is no longer supported.
|
data/Gemfile
CHANGED
@@ -3,3 +3,16 @@ source 'http://rubygems.org'
|
|
3
3
|
gem "rake"
|
4
4
|
# Specify your gem's dependencies in textile_editor_helper.gemspec
|
5
5
|
gemspec
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem 'rails', '>= 4.1.4'
|
9
|
+
gem 'formtastic'
|
10
|
+
gem 'simple_form'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :development, :test do
|
14
|
+
gem 'coveralls', require: false
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'minitest'
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[![Build Status](https://secure.travis-ci.org/katgironpe/textile_editor_helper.png)](http://travis-ci.org/katgironpe/textile_editor_helper)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/katgironpe/textile_editor_helper.png)](https://codeclimate.com/github/katgironpe/textile_editor_helper)
|
6
6
|
[![Dependency Status](https://gemnasium.com/katgironpe/textile_editor_helper.svg)](https://gemnasium.com/katgironpe/textile_editor_helper)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/katgironpe/textile_editor_helper/badge.png)](https://coveralls.io/r/katgironpe/textile_editor_helper)
|
7
8
|
|
8
9
|
Textile Editor Helper is a plugin for Ruby on Rails to add a Textile toolbar above textareas.
|
9
10
|
|
@@ -16,9 +17,10 @@ To use Textile Editor Helper you must use the jQuery JavaScript library.
|
|
16
17
|
|
17
18
|
Follow best practices like adding JS files at the bottom of the page (before closing body tag).
|
18
19
|
|
19
|
-
Rails versions older than 4.1.4 are not supported.
|
20
|
+
Rails versions older than 4.1.4 are probably not supported by the current version.
|
21
|
+
Ruby 1.8 is not supported.
|
20
22
|
|
21
|
-
If this broke something, please use:
|
23
|
+
If this broke something or you need to use it for an older version, please use:
|
22
24
|
|
23
25
|
```ruby
|
24
26
|
gem 'textile_editor_helper', '0.0.31'
|
@@ -27,7 +29,7 @@ gem 'textile_editor_helper', '0.0.31'
|
|
27
29
|
Otherwise, this should work:
|
28
30
|
|
29
31
|
```ruby
|
30
|
-
gem 'textile_editor_helper', '0.1.
|
32
|
+
gem 'textile_editor_helper', '0.1.2'
|
31
33
|
```
|
32
34
|
|
33
35
|
## Rails Quickstart
|
@@ -79,6 +81,7 @@ To use the Textile Editor Helper with a specific text area, you can choose betwe
|
|
79
81
|
|
80
82
|
**Just like writing a text area tag!**
|
81
83
|
|
84
|
+
|
82
85
|
At the end of your form put in the following code:
|
83
86
|
|
84
87
|
|
@@ -136,10 +139,11 @@ The project is now maintained by <a href="http://c.kat.pe" target="_blank">Kathe
|
|
136
139
|
|
137
140
|
## Notes from maintainer
|
138
141
|
|
139
|
-
I am no longer using Textile as much as Markdown.
|
142
|
+
Due to some practical reasons, I am no longer using Textile as much as Markdown.
|
140
143
|
I found this helpful before but no longer really use it.
|
141
144
|
I still find time to maintain for those who do.
|
142
145
|
|
146
|
+
|
143
147
|
## Inspired by
|
144
148
|
|
145
149
|
|
data/Rakefile
CHANGED
data/lib/helpers/default.rb
CHANGED
@@ -133,7 +133,7 @@ module ActionView::Helpers
|
|
133
133
|
# textile_editor_tag 'comment', nil, :class => 'comment_input'
|
134
134
|
# # => <textarea class="comment_input" id="comment" name="comment"></textarea>
|
135
135
|
def textile_editor_tag(name, content = nil, options = {})
|
136
|
-
text_area_tag(name, content, options.merge(:
|
136
|
+
text_area_tag(name, content, options.merge(class: 'textile_editor'))
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
data/lib/helpers/formtastic.rb
CHANGED
@@ -4,10 +4,10 @@ module Formtastic
|
|
4
4
|
module Helpers
|
5
5
|
module FormHelper
|
6
6
|
def textile_editor_initialize
|
7
|
-
|
8
|
-
TextileEditorInitialize.textile_editor_initialize
|
9
|
-
else
|
7
|
+
if request.xhr?
|
10
8
|
[].join("\n").html_safe
|
9
|
+
else
|
10
|
+
TextileEditorInitialize.textile_editor_initialize
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -18,12 +18,11 @@ module Formtastic
|
|
18
18
|
class TextileEditorInput
|
19
19
|
include Base
|
20
20
|
include Base::Placeholder
|
21
|
-
|
22
21
|
def input_html_options
|
23
22
|
{
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
23
|
+
cols: builder.default_text_area_width,
|
24
|
+
rows: builder.default_text_area_height,
|
25
|
+
class: 'textile_editor'
|
27
26
|
}.merge(super)
|
28
27
|
end
|
29
28
|
|
@@ -33,7 +32,6 @@ module Formtastic
|
|
33
32
|
builder.text_area(method, input_html_options)
|
34
33
|
end
|
35
34
|
end
|
36
|
-
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
data/test/formtastic_test.rb
CHANGED
@@ -3,8 +3,7 @@ require_relative '../lib/helpers/formtastic'
|
|
3
3
|
require_relative '../lib/helpers/textile_editor_initialize'
|
4
4
|
require_relative 'abstract_unit'
|
5
5
|
|
6
|
-
class FormtasticTest
|
7
|
-
|
6
|
+
class FormtasticTest < Minitest::Test
|
8
7
|
include SimpleForm::ActionViewExtensions::FormHelper
|
9
8
|
include SimpleForm::Inputs
|
10
9
|
include SupportMethods
|
@@ -17,5 +16,4 @@ class FormtasticTest < MiniTest::Unit::TestCase
|
|
17
16
|
actual = textile_editor_initialize()
|
18
17
|
assert_equal expected_initialize_output, actual
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
data/test/simple_form_test.rb
CHANGED
@@ -3,8 +3,7 @@ require_relative '../lib/helpers/simple_form'
|
|
3
3
|
require_relative 'abstract_unit'
|
4
4
|
require_relative '../lib/helpers/textile_editor_initialize'
|
5
5
|
|
6
|
-
class SimpleFormTest
|
7
|
-
|
6
|
+
class SimpleFormTest < Minitest::Test
|
8
7
|
include SimpleForm::ActionViewExtensions::FormHelper
|
9
8
|
include SimpleForm::Inputs
|
10
9
|
include SupportMethods
|
@@ -17,5 +16,4 @@ class SimpleFormTest < MiniTest::Unit::TestCase
|
|
17
16
|
actual = textile_editor_initialize()
|
18
17
|
assert_equal expected_initialize_output, actual
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
data/test/support_methods.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module SupportMethods
|
2
|
-
|
3
2
|
def setup
|
4
3
|
@controller = Class.new do
|
5
4
|
attr_reader :url_for_options
|
@@ -25,7 +24,6 @@ module SupportMethods
|
|
25
24
|
|
26
25
|
def config
|
27
26
|
Class.new do
|
28
|
-
|
29
27
|
class << self
|
30
28
|
def perform_caching
|
31
29
|
true
|
@@ -50,5 +48,4 @@ module SupportMethods
|
|
50
48
|
|
51
49
|
end
|
52
50
|
end
|
53
|
-
|
54
51
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,8 +4,7 @@ require_relative '../lib/helpers/default'
|
|
4
4
|
require_relative '../lib/helpers/textile_editor_initialize'
|
5
5
|
require 'ostruct'
|
6
6
|
|
7
|
-
class TextileEditorHelperTest
|
8
|
-
|
7
|
+
class TextileEditorHelperTest < Minitest::Test
|
9
8
|
include ActionView::Helpers::TextHelper
|
10
9
|
include ActionView::Helpers::AssetTagHelper
|
11
10
|
include ActionView::Helpers::TagHelper
|
@@ -16,7 +15,7 @@ class TextileEditorHelperTest < MiniTest::Unit::TestCase
|
|
16
15
|
|
17
16
|
def create_editor(object, field, options={})
|
18
17
|
output = textile_editor(object, field, options)
|
19
|
-
assert_equal text_area(object, field, options.merge(:
|
18
|
+
assert_equal text_area(object, field, options.merge(class: "textile_editor")), output
|
20
19
|
end
|
21
20
|
|
22
21
|
def expected_initialize_output
|
@@ -39,8 +38,8 @@ class TextileEditorHelperTest < MiniTest::Unit::TestCase
|
|
39
38
|
b = '<button id="test_button" title="Hello world">Hello</button>'
|
40
39
|
button_data = ["TextileEditor.buttons.push(""#{b}"");" ]
|
41
40
|
actual = textile_editor_button('Hello',
|
42
|
-
:
|
43
|
-
:
|
41
|
+
id: 'test_button',
|
42
|
+
title: 'Hello world'
|
44
43
|
)
|
45
44
|
|
46
45
|
assert_equal button_data, actual
|
@@ -49,5 +48,4 @@ class TextileEditorHelperTest < MiniTest::Unit::TestCase
|
|
49
48
|
output = textile_editor_initialize()
|
50
49
|
assert_equal expected_initialize_output, output
|
51
50
|
end
|
52
|
-
|
53
51
|
end
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ['bridgeutopia@gmail.com']
|
7
7
|
gem.description = %q{Textile Editor Helper is a gem for Ruby on Rails 4.1.4 > to add a Textile toolbar above textareas.}
|
8
8
|
gem.summary = %q{Textile Editor Helper}
|
9
|
-
gem.homepage = 'https://github.com/
|
9
|
+
gem.homepage = 'https://github.com/katgironpe/textile_editor_helper'
|
10
10
|
|
11
11
|
gem.executables = Dir["bin/*"].map { |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.strip.split("\n")
|
@@ -15,12 +15,5 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ['lib']
|
16
16
|
gem.version = TextileEditorHelper::VERSION
|
17
17
|
|
18
|
-
|
19
|
-
gem.add_development_dependency 'rails', '>= 4.1.4'
|
20
|
-
gem.add_development_dependency 'simple_form'
|
21
|
-
gem.add_development_dependency 'formtastic'
|
22
|
-
gem.add_development_dependency 'thor'
|
23
|
-
gem.add_development_dependency 'minitest'
|
24
|
-
gem.add_development_dependency 'cucumber'
|
25
|
-
gem.add_development_dependency 'rspec'
|
18
|
+
gem.add_runtime_dependency 'thor'
|
26
19
|
end
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textile_editor_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katherine Pe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1.4
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1.4
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: simple_form
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: formtastic
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
13
|
- !ruby/object:Gem::Dependency
|
56
14
|
name: thor
|
57
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,49 +17,7 @@ dependencies:
|
|
59
17
|
- - ">="
|
60
18
|
- !ruby/object:Gem::Version
|
61
19
|
version: '0'
|
62
|
-
type: :
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: cucumber
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
20
|
+
type: :runtime
|
105
21
|
prerelease: false
|
106
22
|
version_requirements: !ruby/object:Gem::Requirement
|
107
23
|
requirements:
|
@@ -116,6 +32,7 @@ executables: []
|
|
116
32
|
extensions: []
|
117
33
|
extra_rdoc_files: []
|
118
34
|
files:
|
35
|
+
- ".coveralls.yml"
|
119
36
|
- ".gitignore"
|
120
37
|
- CHANGELOG.md
|
121
38
|
- Gemfile
|
@@ -167,7 +84,7 @@ files:
|
|
167
84
|
- vendor/assets/javascripts/textile-editor-config.js
|
168
85
|
- vendor/assets/javascripts/textile-editor.js
|
169
86
|
- vendor/assets/stylesheets/textile-editor.css
|
170
|
-
homepage: https://github.com/
|
87
|
+
homepage: https://github.com/katgironpe/textile_editor_helper
|
171
88
|
licenses: []
|
172
89
|
metadata: {}
|
173
90
|
post_install_message:
|
@@ -202,3 +119,4 @@ test_files:
|
|
202
119
|
- test/support_methods.rb
|
203
120
|
- test/test_helper.rb
|
204
121
|
- test/textile_editor_helper_test.rb
|
122
|
+
has_rdoc:
|