avo-markdown_field 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f5a244196eeeb78ec3ea3da1416c4b97891cdeb0fecee52bc7393635f06d472c
4
+ data.tar.gz: 044db7995043bc04e43144f39511f7ba91282650ec217cd2fadf534cba7f38d7
5
+ SHA512:
6
+ metadata.gz: 617d16105c3d95840f68775b4c31365727e9354a9bf6b9a0ba37f245ff85cd766e0b652e373f7befac2fd991d3f19a06e81444bea85d36a44a588bd53d70a224
7
+ data.tar.gz: '098f8b1ff436a625d2eb6e60b0c68274d2b4027519db8921827b7ec4e49cdc289345785c70a92e8238e5326ae7b0e0ccabd564bbe72a42d44b137aa375b76f12'
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # Avo Markdown Field
2
+
3
+ A simple markdown field which is using the ['marksmith'](https://github.com/avo-hq/marksmith) editor for [avo-hq/avo](https://github.com/avo-hq/avo), a Rails Admin Panel and Internal Tool Builder.
4
+
5
+ Docs available at [https://docs.avohq.io/3.0/fields/markdown.html](https://docs.avohq.io/3.0/fields/markdown.html)
6
+
7
+ ## Usage
8
+
9
+ ```ruby
10
+ field :body, as: :markdown
11
+ ```
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
+ <%= @form.marksmith @field.id,
3
+ extra_preview_params: {
4
+ resource_class: @resource.class.name,
5
+ field_id: field.id,
6
+ }
7
+ %>
8
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Fields::MarkdownField::EditComponent < Avo::Fields::EditComponent
4
+ end
@@ -0,0 +1,3 @@
1
+ <%= field_wrapper **field_wrapper_args, full_width: true do %>
2
+ <%= render partial: "marksmith/shared/rendered_body", locals: { body: Marksmith::Renderer.new.renderer.render(@field.value) } %>
3
+ <% end %>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Avo::Fields::MarkdownField::ShowComponent < Avo::Fields::ShowComponent
4
+ end
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ require "avo/markdown_field/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "avo-markdown_field"
7
+ spec.version = Avo::MarkdownField::VERSION
8
+ spec.summary = "Marksmith field for Avo."
9
+ spec.description = "Marksmith field for Avo."
10
+ spec.authors = ["Adrian Marin"]
11
+ spec.email = "adrian@adrianthedev.com"
12
+
13
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
14
+ Dir["{app,lib}/**/*", "Rakefile", "README.md", "avo-markdown_field.gemspec"]
15
+ end
16
+ spec.files.reject! { |file_name| %w[app/javascript].any? { |rejected_file| file_name.include? rejected_file } }
17
+
18
+ spec.homepage = "https://avohq.io"
19
+
20
+ spec.add_dependency "marksmith"
21
+ end
@@ -0,0 +1,23 @@
1
+ require_relative "fields/markdown_field"
2
+
3
+ module Avo
4
+ module MarkdownField
5
+ class Engine < Rails::Engine
6
+ isolate_namespace Avo::MarkdownField
7
+
8
+ initializer "avo-markdown_field.init" do |app|
9
+ app.routes.append do
10
+ mount Marksmith::Engine => "/marksmith"
11
+ end
12
+
13
+ ActiveSupport.on_load(:avo_boot) do
14
+ Avo.plugin_manager.register :markdown
15
+
16
+ Avo.plugin_manager.register_field :markdown, Avo::MarkdownField::Fields::MarkdownField
17
+
18
+ Avo.asset_manager.add_stylesheet "marksmith"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ module Avo
2
+ module MarkdownField
3
+ module Fields
4
+ class MarkdownField < Avo::Fields::BaseField
5
+ def initialize(id, **args, &block)
6
+ super(id, **args, &block)
7
+
8
+ hide_on :index
9
+ end
10
+
11
+ def view_component_namespace
12
+ "Avo::Fields::MarkdownField"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Avo
2
+ module MarkdownField
3
+ VERSION = "0.0.5" unless const_defined?(:VERSION)
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require "zeitwerk"
2
+ require "avo"
3
+ require "avo/markdown_field/version"
4
+ require "avo/markdown_field/engine"
5
+ require "marksmith"
6
+
7
+ loader = Zeitwerk::Loader.for_gem_extension(Avo)
8
+ loader.setup
9
+
10
+ module Avo
11
+ module MarkdownField
12
+ # Your code goes here...d
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: avo-markdown_field
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Adrian Marin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: marksmith
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Marksmith field for Avo.
28
+ email: adrian@adrianthedev.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - README.md
34
+ - Rakefile
35
+ - app/components/avo/fields/markdown_field/edit_component.html.erb
36
+ - app/components/avo/fields/markdown_field/edit_component.rb
37
+ - app/components/avo/fields/markdown_field/show_component.html.erb
38
+ - app/components/avo/fields/markdown_field/show_component.rb
39
+ - avo-markdown_field.gemspec
40
+ - lib/avo/markdown_field.rb
41
+ - lib/avo/markdown_field/engine.rb
42
+ - lib/avo/markdown_field/fields/markdown_field.rb
43
+ - lib/avo/markdown_field/version.rb
44
+ homepage: https://avohq.io
45
+ licenses: []
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.4.10
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Marksmith field for Avo.
66
+ test_files: []