From d93548891d15f5b389776f04d86025353ebdf50f Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Mon, 4 May 2020 17:26:57 +0200 Subject: [PATCH] Remove obsolete render_theme_with_context --- app/helpers/theme_helper.rb | 53 ------------------------------------- 1 file changed, 53 deletions(-) diff --git a/app/helpers/theme_helper.rb b/app/helpers/theme_helper.rb index cf436ca3..c4a689f4 100644 --- a/app/helpers/theme_helper.rb +++ b/app/helpers/theme_helper.rb @@ -1,57 +1,4 @@ module ThemeHelper - def render_theme_with_context(context = {}) - klass = Class.new do - def initialize(hash = {}) - if hash.is_a? ApplicationRecord - x = [ - :primary_color, :primary_text, - :danger_color, :danger_text, - :success_color, :success_text, - :warning_color, :warning_text, - :info_color, :info_text, - :default_color, :default_text, - :panel_color, :panel_text, - :link_color, :background_color, - :background_text, :background_muted, - :input_color, :input_text, - :outline_color - ] - - x.each do |v| - next if hash[v].nil? - self.instance_variable_set "@#{v}", ('#' + ('0000000' + hash[v].to_s(16))[-6, 6]) - end - elsif hash.is_a? Hash - hash.each do |k, v| - next unless v.is_a? Integer - - self.instance_variable_set "@#{k}", ('#' + ('0000000' + hash[k].to_s(16))[-6, 6]) - end - end - end - - def render - style = if Rails.env == 'production' - :compressed - else - :compact - end.freeze - - css = if $__THEME_CSS_CACHE_V1.nil? - File.read Rails.root.join 'app/views/user/theme.css.scss.erb' - else - $__THEME_CSS_CACHE_V1 - end - - erb = ERB.new css - sass = Sass::Engine.new erb.result(binding), style: style, cache: false, load_paths: [], syntax: :scss - return sass.render.to_s - end - end - - return klass.new(context).render - end - def render_theme theme_attribute_map = { 'primary_color' => 'primary',