2017-01-12 15:43:09 -05:00
|
|
|
class Plugin::Theme
|
|
|
|
attr_reader :color_scheme
|
|
|
|
|
|
|
|
def initialize(plugin, name)
|
|
|
|
@plugin = plugin
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
|
|
|
|
def css(name)
|
|
|
|
@plugin.register_asset("stylesheets/#{name}.scss")
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_color_scheme(scheme)
|
|
|
|
@color_scheme = scheme
|
|
|
|
end
|
|
|
|
|
|
|
|
def register_public
|
|
|
|
public_dir = "#{@plugin.directory}/public"
|
|
|
|
if File.exist?(public_dir)
|
2017-01-18 18:05:56 -05:00
|
|
|
Rails.application.config.before_initialize do |app|
|
|
|
|
app.middleware.insert_before(
|
2017-01-18 18:22:03 -05:00
|
|
|
::Rack::Runtime,
|
2017-01-18 18:05:56 -05:00
|
|
|
::ActionDispatch::Static,
|
|
|
|
public_dir
|
|
|
|
)
|
2017-01-12 15:43:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|