moved base class stuff to merged
This commit is contained in:
parent
ab05618c45
commit
6fef0adbe7
@ -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"
|
||||
|
@ -1,7 +1,5 @@
|
||||
require "active_hash"
|
||||
|
||||
module ActiveYaml
|
||||
Base.class_eval do
|
||||
module Merged
|
||||
class ActiveBase < ActiveYaml::Base
|
||||
|
||||
def save
|
||||
super
|
@ -1,7 +1,7 @@
|
||||
require "mini_magick"
|
||||
|
||||
module Merged
|
||||
class Image < ActiveYaml::Base
|
||||
class Image < ActiveBase
|
||||
|
||||
set_root_path Rails.root
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Merged
|
||||
class Style < ActiveYaml::Base
|
||||
class Style < ActiveBase
|
||||
|
||||
set_root_path Engine.root + "config"
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user