-
-
Notifications
You must be signed in to change notification settings - Fork 315
/
engine.rb
48 lines (42 loc) · 1.45 KB
/
engine.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true
module Alchemy
class Engine < Rails::Engine
isolate_namespace Alchemy
engine_name "alchemy"
config.mount_at = "/"
initializer "alchemy.lookup_context" do
Alchemy::LOOKUP_CONTEXT = ActionView::LookupContext.new(Rails.root.join("app", "views", "alchemy"))
end
initializer "alchemy.dependency_tracker" do
[:erb, :slim, :haml].each do |handler|
ActionView::DependencyTracker.register_tracker(handler, CacheDigests::TemplateTracker)
end
end
initializer "alchemy.non_digest_assets" do
NonStupidDigestAssets.whitelist += [/^tinymce\//]
end
# Gutentag downcases all tgas before save.
# We support having tags with uppercase characters.
# The Gutentag search is case insensitive.
initializer "alchemy.gutentag_normalizer" do
Gutentag.normaliser = ->(value) { value.to_s }
end
# Custom Ransack sort arrows
initializer "alchemy.ransack" do
Ransack.configure do |config|
config.custom_arrows = {
up_arrow: '<i class="fa fas fa-xs fa-arrow-up"></i>',
down_arrow: '<i class="fa fas fa-xs fa-arrow-down"></i>',
}
end
end
initializer "alchemy.userstamp" do
if Alchemy.user_class
ActiveSupport.on_load(:active_record) do
Alchemy.user_class.model_stamper
Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
end
end
end
end
end