godmin-medium 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: 404a944312d86578673746712bda49720e935129
4
+ data.tar.gz: a31113457253a6ce684666040469728d8aae42b6
5
+ SHA512:
6
+ metadata.gz: 89b87ab6992fa955d7275fefb023952c49ecce83a2ed8ad48eebb0a3e63c0bf0106bed82d217925780104b295937cd6106b564ad94f838e1e80d47d23fe04c48
7
+ data.tar.gz: 0123dd31f66bde6d8dd69172497475bcac515a613a40ff148c7ad283093dd44e25fda5321116a47c9fcde14482a39a495f7aeffc0406e1a5fa95d0b1ff15a54e
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ### 0.1.0 - 2015-04-23
4
+ Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in godmin-medium.gemspec
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 Varvet
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,52 @@
1
+ # Godmin Medium
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/godmin-medium-editor.svg)](https://rubygems.org/gems/godmin-medium-editor)
4
+
5
+ Godmin Medium is a [MediumEditor](https://github.com/daviferreira/medium-editor) component for [Godmin](https://github.com/varvet/godmin) that adds an `f.medium_area` to forms.
6
+
7
+ ## Installation
8
+
9
+ Add the gem to the application's `Gemfile`:
10
+ ```ruby
11
+ gem "godmin-medium"
12
+ ```
13
+
14
+ Or to the admin engine's `gemspec`:
15
+ ```ruby
16
+ s.add_dependency "godmin-medium", "~> 0.1.0"
17
+ ```
18
+
19
+ Require it in your `app/assets/javascripts/application.js`, just after the `require godmin` line:
20
+
21
+ ```js
22
+ //= require godmin
23
+ //= require godmin-medium
24
+ ```
25
+
26
+ And finally, do the same with your `app/assets/stylesheets/application.css`:
27
+ ```scss
28
+ *= require godmin
29
+ *= require godmin-medium
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Use the medium editor area in your form like so:
35
+
36
+ ```erb
37
+ <%= form_for @resource do |f| %>
38
+ <%= f.text_field :title %>
39
+ <%= f.medium_area :body, {
40
+ buttons: ['bold', 'italic', 'underline', 'strikethrough', 'quote', 'anchor']
41
+ } %>
42
+ <%= f.submit %>
43
+ <% end %>
44
+ ```
45
+
46
+ ## Contributors
47
+
48
+ https://github.com/varvet/godmin-medium-editor/graphs/contributors
49
+
50
+ ## License
51
+
52
+ Godmin Medium is licensed under the MIT license. See the separate MIT-LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,38 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require godmin-medium/medium-editor
14
+
15
+ window.Godmin = window.Godmin || {};
16
+
17
+ Godmin.Medium = (function() {
18
+ function initialize() {
19
+ initializeState();
20
+ }
21
+
22
+ function initializeState() {
23
+ initializeMedium($('[data-behavior~=medium-editor]'));
24
+ }
25
+
26
+ function initializeMedium($el) {
27
+ var editor = new MediumEditor($el, $el.data("options"));
28
+ $(editor.elements).css("height", "auto");
29
+ }
30
+
31
+ return {
32
+ initialize: initialize
33
+ };
34
+ })();
35
+
36
+ $(function() {
37
+ Godmin.Medium.initialize();
38
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require godmin-medium/medium-editor
14
+ *= require godmin-medium/themes/bootstrap
15
+ */
@@ -0,0 +1,26 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "godmin/medium/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "godmin-medium"
9
+ gem.version = Godmin::Medium::VERSION
10
+ gem.authors = ["Varvet"]
11
+ gem.email = ["info@varvet.se"]
12
+ gem.homepage = "https://github.com/varvet/godmin-medium"
13
+ gem.summary = "Medium for the Godmin admin engine for Rails 4+"
14
+ gem.description = "Medium for the Godmin admin engine for Rails 4+"
15
+ gem.license = "MIT"
16
+
17
+ gem.files = `git ls-files -z`.split("\x0")
18
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.add_dependency "godmin", "~> 0.9", ">= 0.9.7"
23
+
24
+ gem.add_development_dependency "bundler", "~> 1.7"
25
+ gem.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,6 @@
1
+ module Godmin
2
+ module Medium
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ module Godmin
2
+ module Medium
3
+ module Helper
4
+ def medium_area(attribute, options = {}, html_options = {})
5
+ text_area(attribute, html_options.deep_merge(data: {
6
+ behavior: "medium-editor",
7
+ options: options
8
+ }))
9
+ end
10
+ end
11
+ end
12
+
13
+ FormBuilders::FormBuilder.send(:include, Medium::Helper)
14
+ end
@@ -0,0 +1,5 @@
1
+ module Godmin
2
+ module Medium
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require "godmin/medium/version"
2
+ require "godmin/medium/engine"
3
+ require "godmin/medium/helper"
4
+
5
+ module Godmin
6
+ module Medium
7
+ # Your code goes here...
8
+ end
9
+ end