formtastic-trix 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 180872d30d8388aeaf175049be711b364cc03b20
4
+ data.tar.gz: a5fb7b5d5dc86e835951bdc22b1c60451d5b78f4
5
+ SHA512:
6
+ metadata.gz: 8922e3efce7ea5288eeb94d08a6b2e7a4e30f866cd02c68ad448119fcf3af5a753f575bbfa0a55e841898dd7961b38c19f89709e0f4731e36ed607198eb2e4e0
7
+ data.tar.gz: f24823f6c9a70aa1d03a74ff52d1084486942b0c0673cf8e72234866bf7ac74eba1c5067f0d17b2b2954ee8665a9c0d10ba53f9b8bdebb180a7b81ce0f59cfc6
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Tim Glen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Formtastic::Trix
2
+ Trix is a text editor written for Basecamp. It's simple and cool and Formtastic needed a plugin for it.
3
+
4
+ ## Usage
5
+ Add `trix.css` to your `application.css` file and `trix.js` to your `application.js` file.
6
+
7
+ In your formtastic form, implement the Trix editor like so:
8
+ ```ruby
9
+ <%= semantic_form_for(@user) do |f| %>
10
+ <%= f.inputs do %>
11
+ <%= f.input :bio, as: :trix %>
12
+ <% end %>
13
+ <% end %>
14
+ ```
15
+
16
+ ## Installation
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'formtastic-trix'
21
+ ```
22
+
23
+ And then execute:
24
+ ```bash
25
+ $ bundle
26
+ ```
27
+
28
+ Or install it yourself as:
29
+ ```bash
30
+ $ gem install formtastic-trix
31
+ ```
32
+
33
+ ## Contributing
34
+ Contribution directions go here.
35
+
36
+ ## License
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Formtastic::Trix'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
@@ -0,0 +1,5 @@
1
+ module Formtastic
2
+ module Trix
3
+ # Your code goes here...
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ class TrixInput < Formtastic::Inputs::StringInput
2
+ include Base
3
+ include Base::Placeholder
4
+ def to_html
5
+ input_wrapping do
6
+ editor_tag_params = {
7
+ input: input_html_options[:id],
8
+ class: 'trix-content'
9
+ }
10
+ editor_tag = template.content_tag('trix-editor', '', editor_tag_params)
11
+ hidden_field = builder.hidden_field(method, input_html_options)
12
+ editor = template.content_tag('div', editor_tag + hidden_field, class: 'trix-editor-wrapper')
13
+ label_html + editor
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Formtastic
2
+ module Trix
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :formtastic_trix do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: formtastic-trix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tim Glen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: formtastic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: trix
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: rspec
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
+ description: A formtastic input for the Trix Editor - https://trix-editor.org/
56
+ email:
57
+ - tim@tagstudios.io
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE
63
+ - README.md
64
+ - Rakefile
65
+ - lib/formtastic/trix.rb
66
+ - lib/formtastic/trix/inputs/trix_input.rb
67
+ - lib/formtastic/trix/version.rb
68
+ - lib/tasks/formtastic/trix_tasks.rake
69
+ homepage: http://www.tagstudios.io
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.5.2
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: Trix Editor for Formtastic
93
+ test_files: []