rails_admin_simplemde 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/rails_admin/ra.simplemde.coffee +6 -0
- data/app/assets/stylesheets/rails_admin/ra.simplemde.sass +4 -0
- data/app/views/rails_admin/main/_simplemde.html.haml +9 -0
- data/app/views/rails_admin/main/_simplemde_ml.html.haml +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rails_admin_simplemde/engine.rb +10 -0
- data/lib/rails_admin_simplemde/field.rb +42 -0
- data/lib/rails_admin_simplemde/version.rb +3 -0
- data/lib/rails_admin_simplemde.rb +8 -0
- data/rails_admin_simplemde.gemspec +34 -0
- data/release.sh +6 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d8656952957610924acd2168061bf67c88d8177
|
4
|
+
data.tar.gz: 856d2c317e2af68a9e3c349cac1d23682c2e00b6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4433c8c974132915f048dca6b42a7885cfdd827fb9f368bc358014eeffbf5ffb98b1dae77776e6c3ba7177702c20ae7cc76571789b572a12c1151b6190c491c4
|
7
|
+
data.tar.gz: 8d239c7f09b87577a073a7e00846ee56e9440992f61314458f681a5f175d99d057fc3cb9f2d7bd59f6bb7628706e166475e7d9fb35871db3bbe6fb7e2b3db481
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rails_admin_simplemde
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Alexander Kiseliev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# RailsAdminSimplemde
|
2
|
+
|
3
|
+
RailsAdmin field with [simplemde_rails](https://github.com/ack43/simplemde_rails) support.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails_admin_simplemde'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails_admin_simplemde
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Add in app/models/%model_name%.rb:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
rails_admin do
|
27
|
+
field :markdown_content, :simplemde
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ack/rails_admin_simplemde.
|
data/Rakefile
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#= require 'simplemde/simplemde.min'
|
2
|
+
|
3
|
+
$(document).on "rails_admin.dom_ready", ->
|
4
|
+
$('.form-group.simplemde_type textarea[data-simplemde]').each ->
|
5
|
+
unless $(this).data('rails_admin_simplemde')
|
6
|
+
$(this).data('rails_admin_simplemde', new SimpleMDE({ element: this }))
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= stylesheet_link_tag 'rails_admin/ra.simplemde'
|
2
|
+
= javascript_include_tag 'rails_admin/ra.simplemde'
|
3
|
+
|
4
|
+
:ruby
|
5
|
+
js_data = {
|
6
|
+
}
|
7
|
+
_html_attributes = field.html_attributes.reverse_merge(data: { simplemde: 'true', options: js_data.to_json, value: field.name })
|
8
|
+
|
9
|
+
= form.text_area field.name, _html_attributes
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rails_admin_simplemde"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
module RailsAdminSimplemde
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace RailsAdmin
|
4
|
+
|
5
|
+
initializer "RailsAdminSimplemde precompile hook" do |app|
|
6
|
+
app.config.assets.precompile += ['rails_admin/ra.simplemde.js', 'rails_admin/ra.simplemde.css']
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rails_admin/config/fields/types/text'
|
2
|
+
|
3
|
+
module RailsAdmin
|
4
|
+
module Config
|
5
|
+
module Fields
|
6
|
+
module Types
|
7
|
+
class Simplemde < RailsAdmin::Config::Fields::Types::Text
|
8
|
+
# Register field type for the type loader
|
9
|
+
RailsAdmin::Config::Fields::Types::register(self)
|
10
|
+
include RailsAdmin::Engine.routes.url_helpers
|
11
|
+
|
12
|
+
register_instance_option :tabbed do
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
register_instance_option :html_attributes do
|
17
|
+
{
|
18
|
+
spellcheck: true
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
############ localize ######################
|
23
|
+
register_instance_option :translations_field do
|
24
|
+
(name.to_s + '_translations').to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
register_instance_option :localized? do
|
28
|
+
@abstract_model.model.public_instance_methods.include?(translations_field)
|
29
|
+
end
|
30
|
+
|
31
|
+
register_instance_option :allowed_methods do
|
32
|
+
localized? ? [translations_field] : [name]
|
33
|
+
end
|
34
|
+
|
35
|
+
register_instance_option :partial do
|
36
|
+
localized? ? :simplemde_ms : :simplemde
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails_admin_simplemde/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rails_admin_simplemde"
|
8
|
+
spec.version = RailsAdminSimplemde::VERSION
|
9
|
+
spec.authors = ["Alexander Kiseliev"]
|
10
|
+
spec.email = ["dev@redrocks.pro"]
|
11
|
+
|
12
|
+
spec.summary = %q{SimplemdeRails field for RailsAdmin}
|
13
|
+
spec.description = %q{SimplemdeRails field for RailsAdmin.}
|
14
|
+
spec.homepage = 'https://github.com/ack43/rails_admin_simplemde'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# else
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
# end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
|
32
|
+
spec.add_dependency "rails_admin", ">= 0.8.1"
|
33
|
+
spec.add_dependency "simplemde_rails", "~> 0.1"
|
34
|
+
end
|
data/release.sh
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_admin_simplemde
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Kiseliev
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails_admin
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.8.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplemde_rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
69
|
+
description: SimplemdeRails field for RailsAdmin.
|
70
|
+
email:
|
71
|
+
- dev@redrocks.pro
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".ruby-gemset"
|
78
|
+
- ".ruby-version"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- app/assets/javascripts/rails_admin/ra.simplemde.coffee
|
84
|
+
- app/assets/stylesheets/rails_admin/ra.simplemde.sass
|
85
|
+
- app/views/rails_admin/main/_simplemde.html.haml
|
86
|
+
- app/views/rails_admin/main/_simplemde_ml.html.haml
|
87
|
+
- bin/console
|
88
|
+
- bin/setup
|
89
|
+
- lib/rails_admin_simplemde.rb
|
90
|
+
- lib/rails_admin_simplemde/engine.rb
|
91
|
+
- lib/rails_admin_simplemde/field.rb
|
92
|
+
- lib/rails_admin_simplemde/version.rb
|
93
|
+
- rails_admin_simplemde.gemspec
|
94
|
+
- release.sh
|
95
|
+
homepage: https://github.com/ack43/rails_admin_simplemde
|
96
|
+
licenses: []
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.6.12
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: SimplemdeRails field for RailsAdmin
|
118
|
+
test_files: []
|