From c0e971701465e2444d8c08577686fab7a3ae374e Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Thu, 15 Nov 2018 12:45:31 +0200 Subject: [PATCH] Synchronize the recent changes in `openscied-lcms` application --- app/controllers/admin/documents_controller.rb | 6 ++-- app/controllers/application_controller.rb | 3 ++ app/entities/hierarchical_position.rb | 2 +- app/jobs/document_generate_pdf_job.rb | 6 ++-- app/jobs/material_generate_pdf_job.rb | 2 -- app/models/document.rb | 10 +++---- app/models/resource.rb | 14 +++++---- app/presenters/content_presenter.rb | 2 +- app/presenters/material_presenter.rb | 11 ++++--- app/views/devise/confirmations/new.html.erb | 17 ++++++----- app/views/devise/passwords/edit.html.erb | 19 ++++++------ app/views/devise/passwords/new.html.erb | 23 +++++++-------- app/views/devise/registrations/new.html.erb | 29 ++++++++++--------- lcms-engine.gemspec | 2 +- lib/concerns/doc_template/template.rb | 6 ++-- lib/doc_template.rb | 4 +++ lib/doc_template/document.rb | 4 +-- lib/doc_template/objects/sections_metadata.rb | 2 +- lib/doc_template/tables/base.rb | 4 +-- .../tags/activity_metadata_section_tag.rb | 8 +++-- .../tags/activity_metadata_type_tag.rb | 20 +++++-------- lib/lcms/engine/engine.rb | 5 +++- 22 files changed, 105 insertions(+), 94 deletions(-) diff --git a/app/controllers/admin/documents_controller.rb b/app/controllers/admin/documents_controller.rb index d55cc92a..b2667538 100644 --- a/app/controllers/admin/documents_controller.rb +++ b/app/controllers/admin/documents_controller.rb @@ -23,7 +23,7 @@ def create @document = reimport_lesson if @document.save - redirect_to AdminController.document_path(@document.document.id), + redirect_to AdminController.document_path(@document.document), notice: t('.success', name: @document.document.name) else render :new, alert: t('.error') @@ -79,7 +79,9 @@ def gdoc_files link = form_params[:link] if link.match?(%r{/drive/(.*/)?folders/}) folder_id = ::Lt::Google::Api::Drive.folder_id_for(link) - ::Lt::Google::Api::Drive.new(google_credentials).list_file_ids_in(folder_id) + ::Lt::Google::Api::Drive.new(google_credentials) + .list_file_ids_in(folder_id) + .map { |id| Lt::Lcms::Lesson::Downloader::Gdoc.gdoc_file_url(id) } else [link] end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c858a8e9..90f20ce0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,6 +18,9 @@ class ApplicationController < ActionController::Base render 'pages/not_found', status: :not_found end + # engine helpers to generate PDF + helper Openscied::Core::PdfHelper + protected # Raise translation missing errors in controllers too diff --git a/app/entities/hierarchical_position.rb b/app/entities/hierarchical_position.rb index 9932b4ba..c9b44639 100644 --- a/app/entities/hierarchical_position.rb +++ b/app/entities/hierarchical_position.rb @@ -64,7 +64,7 @@ def position_for(type) val = if !resource.persisted? && resource.send(type) resource.level_position else - resource.self_and_ancestors.detect { |res| res.send type }&.level_position + resource.self_and_ancestors_not_persisted.detect { |res| res.send type }&.level_position end val ? val + 1 : 0 end diff --git a/app/jobs/document_generate_pdf_job.rb b/app/jobs/document_generate_pdf_job.rb index c106f4f3..c9e01157 100644 --- a/app/jobs/document_generate_pdf_job.rb +++ b/app/jobs/document_generate_pdf_job.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative 'concerns/retry_simple' - class DocumentGeneratePdfJob < Lcms::Engine::ApplicationJob include ResqueJob @@ -11,8 +9,8 @@ class DocumentGeneratePdfJob < Lcms::Engine::ApplicationJob PDF_EXPORTERS = { 'full' => DocumentExporter::PDF::Document, - 'sm' => DocumentExporter::PDF::StudentMaterial, - 'tm' => DocumentExporter::PDF::TeacherMaterial + 'sm' => DocumentExporter::PDF::StudentMaterial, + 'tm' => DocumentExporter::PDF::TeacherMaterial }.freeze def perform(doc, options) diff --git a/app/jobs/material_generate_pdf_job.rb b/app/jobs/material_generate_pdf_job.rb index d823b27a..5a2b6158 100644 --- a/app/jobs/material_generate_pdf_job.rb +++ b/app/jobs/material_generate_pdf_job.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative 'concerns/retry_simple' - class MaterialGeneratePDFJob < Lcms::Engine::ApplicationJob include ResqueJob diff --git a/app/models/document.rb b/app/models/document.rb index 2096d411..94a1ac96 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -11,7 +11,6 @@ class Document < Lcms::Engine::ApplicationRecord before_save :set_resource_from_metadata store_accessor :foundational_metadata - store_accessor :metadata serialize :toc, DocTemplate::Objects::TOCMetadata scope :actives, -> { where(active: true) } @@ -19,7 +18,7 @@ class Document < Lcms::Engine::ApplicationRecord scope :failed, -> { where(reimported: false) } - scope :where_metadata, ->(key, val) { where('documents.metadata @> hstore(:key, :val)', key: key, val: val) } + scope :where_metadata, ->(key, val) { where('documents.metadata ->> ? = ?', key, val) } scope :order_by_curriculum, lambda { select('documents.*, resources.hierarchical_position') @@ -36,13 +35,14 @@ class Document < Lcms::Engine::ApplicationRecord scope :filter_by_grade, ->(grade) { where_metadata(:grade, grade) } scope :filter_by_unit, lambda { |u| - where("(lower(documents.metadata -> 'unit') = :u OR lower(documents.metadata -> 'topic') = :u)", u: u.to_s.downcase) + where("(lower(documents.metadata ->> 'unit') = :u OR lower(documents.metadata ->> 'topic') = :u)", + u: u.to_s.downcase) } scope :filter_by_module, lambda { |mod| sql = <<-SQL - (documents.metadata @> hstore('subject', 'math') AND documents.metadata @> hstore('unit', :mod)) - OR (documents.metadata @> hstore('subject', 'ela') AND documents.metadata @> hstore('module', :mod)) + (documents.metadata ->> 'subject' <> 'ela' AND documents.metadata ->> 'unit' = :mod) + OR (documents.metadata ->> 'subject' = 'ela' AND documents.metadata ->> 'module' = :mod) SQL where(sql, mod: mod) } diff --git a/app/models/resource.rb b/app/models/resource.rb index 7afea17a..c2d8c141 100644 --- a/app/models/resource.rb +++ b/app/models/resource.rb @@ -64,6 +64,7 @@ class Resource < Lcms::Engine::ApplicationRecord validates :url, presence: true, url: true, if: %i(video? podcast?) scope :where_grade, ->(grades) { where_metadata_in :grade, grades } + scope :where_module, ->(modules) { where_metadata_in :module, modules } scope :where_subject, ->(subjects) { where_metadata_in :subject, subjects } scope :media, -> { where(resource_type: MEDIA_TYPES) } scope :generic_resources, -> { where(resource_type: GENERIC_TYPES) } @@ -271,15 +272,18 @@ def add_grade_author(author) grade.save end - def update_metadata + def self_and_ancestors_not_persisted # during create we can't call self_and_ancestors directly on the resource # because this query uses the associations on resources_hierarchies # which are only created after the resource is persisted - chain = [self] + parent&.self_and_ancestors.to_a + [self] + parent&.self_and_ancestors.to_a + end - meta = chain.each_with_object({}) do |r, obj| - obj[r.curriculum_type] = r.short_title - end.compact + def update_metadata + meta = self_and_ancestors_not_persisted + .each_with_object({}) do |r, obj| + obj[r.curriculum_type] = r.short_title + end.compact metadata.merge! meta if meta.present? end diff --git a/app/presenters/content_presenter.rb b/app/presenters/content_presenter.rb index ded11c67..0d92dde7 100644 --- a/app/presenters/content_presenter.rb +++ b/app/presenters/content_presenter.rb @@ -64,7 +64,7 @@ def padding_styles(align_type: 'padding') def render_content(context_type, options = {}) options[:parts_index] = document_parts_index rendered_layout = DocumentRenderer::Part.call(layout_content(context_type), options) - content = HtmlSanitizer.clean_content(rendered_layout, context_type) + content = DocTemplate.sanitizer.clean_content(rendered_layout, context_type) ReactMaterialsResolver.resolve(content, self) end end diff --git a/app/presenters/material_presenter.rb b/app/presenters/material_presenter.rb index fb95a857..19d27c1c 100644 --- a/app/presenters/material_presenter.rb +++ b/app/presenters/material_presenter.rb @@ -5,7 +5,6 @@ class MaterialPresenter < ContentPresenter attr_reader :parsed_document delegate :css_styles, :short_url, :subject, to: :lesson - delegate :sheet_type, to: :metadata delegate :parts, to: :parsed_document DEFAULT_TITLE = 'Material' @@ -15,17 +14,13 @@ def anchors end def base_filename(with_version: true) - name = identifier + name = metadata['identifier'] unless name =~ /^(math|ela)/i || pdf? name = "#{lesson.short_breadcrumb(join_with: '_', with_short_lesson: true)}_#{name}" end with_version ? "#{name}_v#{version.presence || 1}" : name end - def identifier - metadata['identifier'] - end - def cc_attribution metadata['cc_attribution'].presence || lesson&.cc_attribution end @@ -102,6 +97,10 @@ def render_content(context_type, options = {}) DocumentRenderer::Part.call(layout_content(context_type), options) end + def sheet_type + metadata['sheet_type'].to_s + end + def show_title? (metadata['show_title'].presence || 'yes').casecmp('yes').zero? end diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index df4e40a0..22e540a8 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,20 +1,21 @@ -
-
-
-

Resend confirmation instructions

+
+
+
+

Resend confirmation instructions

+
<%= form_for(resource, as: resource_name, url: user_confirmation_path, html: { method: :post }) do |f| %> - <%= f.email_field :email, autofocus: true, class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:access_code].present? ? ' o-od-input-error' : ''), placeholder: 'Enter your email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> + <%= f.email_field :email, autofocus: true, class: 'o-input-placehoder--medium-gray' + (resource.errors[:access_code].present? ? ' o-input-error' : ''), placeholder: 'Enter your email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> <% if resource.errors[:email].present? %> - <% end %> - <%= f.submit 'Resend confirmation instructions', class: 'o-od-btn o-od-btn--xs-full o-od-btn--primary' %> + <%= f.submit 'Resend confirmation instructions', class: 'o-btn o-btn--xs-full o-btn--yellow o-btn--xs-full' %> <% end %> -
+
<%= link_to 'Back to Login', new_user_session_path %>
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 673363e9..3096e474 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,23 +1,24 @@ -
-
-
-

Change your password

+
+
+
+

Change your password

+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> <%= f.hidden_field :reset_password_token %> - <%= f.password_field :password, autocomplete: 'off', autofocus: true, class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:password].present? ? ' o-od-input-error' : ''), placeholder: 'Enter new password' %> + <%= f.password_field :password, autocomplete: 'off', autofocus: true, class: 'o-input-placehoder--medium-gray' + (resource.errors[:password].present? ? ' o-input-error' : ''), placeholder: 'Enter new password' %> <% if resource.errors[:password].present? %> - <% end %> - <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:password_confirmation].present? ? ' o-od-input-error' : ''), placeholder: 'Confirm new password' %> + <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'o-input-placehoder--medium-gray' + (resource.errors[:password_confirmation].present? ? ' o-input-error' : ''), placeholder: 'Confirm new password' %> <% if resource.errors[:password_confirmation].present? %> - <% end %> - <%= f.submit 'Change my password', class: 'o-od-btn o-od-btn--xs-full o-od-btn--primary' %> + <%= f.submit 'Change my password', class: 'o-btn o-btn--xs-full o-btn--yellow o-btn--xs-full' %> <% end %>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index d8448fe2..f492b305 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,24 +1,23 @@ -
-
-
-

Forgot your password?

+
+
+
+

Forgot your password?

+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= f.email_field :email, autofocus: true, class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:access_code].present? ? ' o-od-input-error' : ''), placeholder: 'Enter your email' %> + <%= f.email_field :email, autofocus: true, class: 'o-input-placehoder--medium-gray' + (resource.errors[:access_code].present? ? ' o-input-error' : ''), placeholder: 'Enter your email' %> <% if resource.errors[:email].present? %> - <% end %> - <%= f.submit 'Send me reset password instructions', class: 'o-od-btn o-od-btn--xs-full o-od-btn--primary' %> + <%= f.submit 'Send me reset password instructions', class: 'o-btn o-btn--xs-full o-btn--yellow o-btn--xs-full' %> <% end %> - <% if false %> -
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %> -
- <% end %> +
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %> +
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 89c983f3..1f31cfe6 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,37 +1,38 @@ -
-
-
-

Register

+
+
+
+

Register

+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= f.text_field :access_code, autofocus: true, class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:access_code].present? ? ' o-od-input-error' : ''), placeholder: 'Enter access code', value: @code %> + <%= f.text_field :access_code, autofocus: true, class: 'o-input-placehoder--medium-gray' + (resource.errors[:access_code].present? ? ' o-input-error' : ''), placeholder: 'Enter access code', value: @code %> <% if resource.errors[:access_code].present? %> - <% end %> - <%= f.email_field :email, class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:email].present? ? ' o-od-input-error' : ''), placeholder: 'Enter email address' %> + <%= f.email_field :email, class: 'o-input-placehoder--medium-gray' + (resource.errors[:email].present? ? ' o-input-error' : ''), placeholder: 'Enter email address' %> <% if resource.errors[:email].present? %> - <% end %> - <%= f.password_field :password, autocomplete: 'off', class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:password].present? ? ' o-od-input-error' : ''), placeholder: 'Enter a password' %> + <%= f.password_field :password, autocomplete: 'off', class: 'o-input-placehoder--medium-gray' + (resource.errors[:password].present? ? ' o-input-error' : ''), placeholder: 'Enter a password' %> <% if resource.errors[:password].present? %> - <% end %> - <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'o-od-input-placeholder--medium-gray' + (resource.errors[:password_confirmation].present? ? ' o-od-input-error' : ''), placeholder: 'Confirm your password' %> + <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'o-input-placehoder--medium-gray' + (resource.errors[:password_confirmation].present? ? ' o-input-error' : ''), placeholder: 'Confirm your password' %> <% if resource.errors[:password_confirmation].present? %> - <% end %> - <%= f.submit 'Register', class: 'o-od-btn o-od-btn--xs-full o-od-btn--primary' %> + <%= f.submit 'Register', class: 'o-btn o-btn--xs-full o-btn--yellow o-btn--xs-full' %> <% end %> -
+
<%= link_to 'Back to Login', new_user_session_path %>
diff --git a/lcms-engine.gemspec b/lcms-engine.gemspec index bf547190..6f29ca89 100644 --- a/lcms-engine.gemspec +++ b/lcms-engine.gemspec @@ -37,5 +37,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'bundler-audit', '~> 0.6.0' s.add_development_dependency 'overcommit', '~> 0.46' s.add_development_dependency 'rspec-rails', '~> 3.8' - s.add_development_dependency 'rubocop', '~> 0.59' + s.add_development_dependency 'rubocop', '~> 0.59.2' end diff --git a/lib/concerns/doc_template/template.rb b/lib/concerns/doc_template/template.rb index f57a2733..0777b5cf 100644 --- a/lib/concerns/doc_template/template.rb +++ b/lib/concerns/doc_template/template.rb @@ -57,8 +57,8 @@ def metadata def parse(source) doc = Nokogiri::HTML(source) # get css styles from head to keep classes for lists (preserve list-style-type) - doc = HtmlSanitizer.process_list_styles doc - @css_styles = HtmlSanitizer.sanitize_css(doc.xpath('//html/head/style/text()').to_s) + doc = DocTemplate.sanitizer.process_list_styles doc + @css_styles = DocTemplate.sanitizer.sanitize_css(doc.xpath('//html/head/style/text()').to_s) # initial content sanitization body_node = ::DocTemplate @@ -108,7 +108,7 @@ def remove_part(type, context_type) def render(options = {}) type = options.fetch(:context_type, ::DocTemplate.context_types.first) - HtmlSanitizer.post_processing(@documents[type]&.render.presence || '', options) + DocTemplate.sanitizer.post_processing(@documents[type]&.render.presence || '', options) end module ClassMethods diff --git a/lib/doc_template.rb b/lib/doc_template.rb index 32bc86a3..811a5e30 100644 --- a/lib/doc_template.rb +++ b/lib/doc_template.rb @@ -45,6 +45,10 @@ def document_contexts def material_contexts @material_contexts ||= Array.wrap(config['material_contexts']).presence || DEFAULTS[:materials_contexts] end + + def sanitizer + @sanitizer ||= config['sanitizer'].constantize + end end end diff --git a/lib/doc_template/document.rb b/lib/doc_template/document.rb index 9072c5e4..0c915801 100644 --- a/lib/doc_template/document.rb +++ b/lib/doc_template/document.rb @@ -52,13 +52,13 @@ def add_custom_nodes return unless @opts[:metadata].try(:subject).to_s.casecmp('ela').zero? return unless ela_teacher_guidance_allowed? - HtmlSanitizer.strip_content(@nodes) + DocTemplate.sanitizer.strip_content(@nodes) @nodes.prepend_child ela_teacher_guidance(@opts[:metadata], @opts[:context_type]) end def ela_teacher_guidance(metadata, _context_type) @data = metadata - @data.preparation = HtmlSanitizer.strip_html_element(@data.preparation) + @data.preparation = DocTemplate.sanitizer.strip_html_element(@data.preparation) template = File.read ELA_TG_TEMPLATE ERB.new(template).result(binding) end diff --git a/lib/doc_template/objects/sections_metadata.rb b/lib/doc_template/objects/sections_metadata.rb index 2d9b241a..97e9458a 100644 --- a/lib/doc_template/objects/sections_metadata.rb +++ b/lib/doc_template/objects/sections_metadata.rb @@ -42,7 +42,7 @@ def self.build_from(data, template_type) copy = Marshal.load Marshal.dump(data) sections = copy.map do |metadata| metadata[:template_type] = template_type - metadata[:summary] = HtmlSanitizer.strip_html_element(metadata[:summary]) + metadata[:summary] = DocTemplate.sanitizer.strip_html_element(metadata[:summary]) metadata.transform_keys { |k| k.to_s.gsub('section-', '').underscore } end new(set_index(children: sections)) diff --git a/lib/doc_template/tables/base.rb b/lib/doc_template/tables/base.rb index 447eb360..d2089074 100644 --- a/lib/doc_template/tables/base.rb +++ b/lib/doc_template/tables/base.rb @@ -3,7 +3,7 @@ module DocTemplate module Tables class Base - SPLIT_REGEX = /[,;(\r?\n)]/ + SPLIT_REGEX = /[,;(\r\n|\n)]/i attr_reader :data @@ -42,7 +42,7 @@ def fetch_materials(data, key) def fetch(table) {}.tap do |result| table.xpath('.//tr[position() > 1]').each do |row| - key = row.at_xpath('./td[1]')&.text.to_s.strip.downcase + key = row.at_xpath('./td[1]')&.text.to_s.squish.downcase next if key.blank? value = if self.class::HTML_VALUE_FIELDS.include? key diff --git a/lib/doc_template/tags/activity_metadata_section_tag.rb b/lib/doc_template/tags/activity_metadata_section_tag.rb index 5b289a3b..467923a9 100644 --- a/lib/doc_template/tags/activity_metadata_section_tag.rb +++ b/lib/doc_template/tags/activity_metadata_section_tag.rb @@ -33,7 +33,7 @@ def parse(node, opts = {}) before_materials: before_materials, # TODO: check maybe it's ok to move it somewhere else, # fixed at #692 bc with new section we always have some garbage before activity - content: HtmlSanitizer.strip_html(content), + content: DocTemplate.sanitizer.strip_html(content), foundational_skills: opts[:foundational_skills], placeholder: placeholder_id, react_props: { @@ -60,10 +60,12 @@ def parse_foundational # Extend object to store `lesson_objective` (#162) section.class.attribute :lesson_objective, String - section.lesson_objective = HtmlSanitizer.strip_html_element(opts[:foundational_metadata].lesson_objective) + section.lesson_objective = DocTemplate.sanitizer + .strip_html_element(opts[:foundational_metadata].lesson_objective) # Extend object to store `lesson_standard` (#386) section.class.attribute :lesson_standard, String - section.lesson_standard = HtmlSanitizer.strip_html_element(opts[:foundational_metadata].lesson_standard) + section.lesson_standard = DocTemplate.sanitizer + .strip_html_element(opts[:foundational_metadata].lesson_standard) opts[:sections].add_break opts[:foundational_skills] = true end diff --git a/lib/doc_template/tags/activity_metadata_type_tag.rb b/lib/doc_template/tags/activity_metadata_type_tag.rb index fe7eae54..da53d562 100644 --- a/lib/doc_template/tags/activity_metadata_type_tag.rb +++ b/lib/doc_template/tags/activity_metadata_type_tag.rb @@ -22,25 +22,21 @@ def parse(node, opts = {}) @activity = @metadata.find_by_anchor(opts[:value]) @anchor = @activity.anchor - content = content_until_break node + content = DocTemplate.sanitizer.strip_html(content_until_break(node)) content = parse_nested content.to_s, opts - params = build_params(content) - - @content = parse_template params, template_name(opts) - @materials = @activity.try(:material_ids) || [] - replace_tag node - self - end - - def build_params(content) params = { activity: @activity, - content: HtmlSanitizer.strip_html_element(content), + content: DocTemplate.sanitizer.strip_html_element(content), placeholder: placeholder_id } # Extend basic params set with additional which can be customized params.merge! extended_parse_params + + @content = parse_template params, template_name(opts) + @materials = @activity.try(:material_ids) || [] + replace_tag node + self end private @@ -57,7 +53,7 @@ def extended_parse_params def extended_params_default if @activity.respond_to?(:activity_guidance) - @activity[:activity_guidance] = HtmlSanitizer.strip_html_element(@activity[:activity_guidance]) + @activity[:activity_guidance] = DocTemplate.sanitizer.strip_html_element(@activity[:activity_guidance]) end { diff --git a/lib/lcms/engine/engine.rb b/lib/lcms/engine/engine.rb index 9bcd892d..ce505865 100644 --- a/lib/lcms/engine/engine.rb +++ b/lib/lcms/engine/engine.rb @@ -19,7 +19,10 @@ class Engine < ::Rails::Engine # TODO: Re-enable namespaces once engine extraction is more stable. # isolate_namespace Lcms::Engine - config.autoload_paths += Dir[config.root.join('lib')] + config.autoload_paths += [ + config.root.join('lib'), + config.root.join('app', 'jobs', 'concerns') + ] config.assets.precompile += %w(*.svg *.ico)