moved base class stuff to merged

This commit is contained in:
Torsten 2022-12-25 23:42:01 +02:00
parent ab05618c45
commit 6fef0adbe7
7 changed files with 13 additions and 17 deletions

1
.rspec
View File

@ -1 +0,0 @@
--require spec_helper

View File

@ -3,15 +3,19 @@ require "redcarpet"
module Merged
module MergedHelper
include OptionsHelper
@@renderer = nil
def renderer
return @@renderer unless @@renderer.nil?
options = {hard_wrap: true , autolink: true, no_intra_emphasis: true ,
safe_links_only: true, no_styles: true ,
link_attributes: { target: '_blank' }}
html = Redcarpet::Render::HTML.new(options)
@@renderer = Redcarpet::Markdown.new(html, options)
Redcarpet::Markdown.new(html, options)
end
def markdown(text)
text = text.text unless text.is_a?(String)
return "" if text.blank?
self.renderer.render(text).html_safe
end
def aspect_ratio image
@ -19,11 +23,6 @@ module Merged
"#{x} / #{y}"
end
def markdown(text)
text = text.text unless text.is_a?(String)
return "" if text.blank?
renderer.render(text).html_safe
end
def field_name(card)
name = card.header
name += "*" unless card.option("compulsory") == "no"

View File

@ -1,7 +1,5 @@
require "active_hash"
module ActiveYaml
Base.class_eval do
module Merged
class ActiveBase < ActiveYaml::Base
def save
super

View File

@ -1,7 +1,7 @@
require "mini_magick"
module Merged
class Image < ActiveYaml::Base
class Image < ActiveBase
set_root_path Rails.root

View File

@ -1,5 +1,5 @@
module Merged
class OptionDefinition < ActiveYaml::Base
class OptionDefinition < ActiveBase
set_root_path Engine.root + "config"
fields :name , :default , :description , :values , :type

View File

@ -1,5 +1,5 @@
module Merged
class Style < ActiveYaml::Base
class Style < ActiveBase
set_root_path Engine.root + "config"

View File

@ -4,7 +4,7 @@ module Merged
# they share the template idea, options , change tracking,
# and the fact that they persist in ActiveYaml
class ViewBase < ActiveYaml::Base
class ViewBase < ActiveBase
set_root_path Rails.root #ouside engines not necessary
include ActiveHash::Associations