lcms-engine 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.env.docker +1 -1
- data/.rubocop.yml +8 -7
- data/.ruby-version +1 -1
- data/CHANGELOG.md +16 -1
- data/Dockerfile +1 -1
- data/Gemfile.lock +223 -184
- data/README.md +3 -2
- data/app/controllers/concerns/lcms/engine/reimportable.rb +11 -1
- data/app/controllers/lcms/engine/admin/admin_controller.rb +1 -1
- data/app/controllers/lcms/engine/admin/documents_controller.rb +19 -4
- data/app/controllers/lcms/engine/admin/materials_controller.rb +12 -3
- data/app/controllers/lcms/engine/admin/standards_controller.rb +6 -1
- data/app/controllers/lcms/engine/admin/users_controller.rb +6 -1
- data/app/entities/lcms/engine/grades.rb +17 -6
- data/app/entities/lcms/engine/media_embed.rb +1 -1
- data/app/entities/lcms/engine/roman_numerals.rb +1 -1
- data/app/forms/lcms/engine/document_form.rb +19 -14
- data/app/forms/lcms/engine/material_form.rb +3 -2
- data/app/helpers/admin/components_helper.rb +2 -2
- data/app/helpers/lcms/engine/view_helper.rb +1 -1
- data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +1 -1
- data/app/javascript/components/admin/ImportStatus.jsx +7 -3
- data/app/javascript/components/admin/MultiSelectedOperation.jsx +1 -0
- data/app/javascript/components/admin/association-picker/AssociationPicker.jsx +1 -0
- data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +1 -0
- data/app/javascript/components/admin/association-picker/AssociationPickerWindow.jsx +1 -0
- data/app/javascript/components/admin/curriculum/CurriculumEditor.jsx +1 -0
- data/app/javascript/components/admin/resource-picker/ResourcePicker.jsx +1 -0
- data/app/jobs/concerns/lcms/engine/nested_resque_job.rb +1 -4
- data/app/jobs/lcms/engine/document_generate_gdoc_job.rb +2 -2
- data/app/jobs/lcms/engine/document_generate_job.rb +1 -1
- data/app/jobs/lcms/engine/document_parse_job.rb +1 -1
- data/app/models/lcms/engine/component.rb +3 -3
- data/app/models/lcms/engine/download.rb +1 -1
- data/app/models/lcms/engine/search/document.rb +4 -3
- data/app/presenters/lcms/engine/document_presenter.rb +2 -2
- data/app/queries/lcms/engine/admin_documents_query.rb +1 -1
- data/app/serializers/lcms/engine/previews_material_serializer.rb +1 -0
- data/app/services/lcms/engine/document_build_service.rb +4 -0
- data/app/services/lcms/engine/html_sanitizer.rb +5 -5
- data/app/services/lcms/engine/lessons_gdoc_bundler.rb +1 -1
- data/app/services/lcms/engine/material_build_service.rb +6 -2
- data/app/services/lcms/engine/material_preview_generator.rb +2 -2
- data/app/services/lcms/engine/react_materials_resolver.rb +3 -2
- data/app/views/lcms/engine/admin/batch_reimports/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/curriculums/edit.html.erb +1 -3
- data/app/views/lcms/engine/admin/documents/_materials_links.html.erb +2 -2
- data/app/views/lcms/engine/admin/documents/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/documents/index.html.erb +2 -2
- data/app/views/lcms/engine/admin/documents/new.html.erb +1 -1
- data/app/views/lcms/engine/admin/materials/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/admin/materials/index.html.erb +4 -4
- data/app/views/lcms/engine/admin/resource_bulk_edits/new.html.erb +1 -1
- data/app/views/lcms/engine/admin/resources/_fields.html.erb +3 -0
- data/app/views/lcms/engine/admin/resources/_search_form.html.erb +1 -1
- data/app/views/lcms/engine/documents/gdoc/_agenda.html.erb +1 -1
- data/app/views/lcms/engine/documents/show.html.erb +1 -1
- data/app/views/lcms/engine/materials/show.html.erb +1 -1
- data/app/views/lcms/engine/resources/_download.html.erb +2 -2
- data/app/views/lcms/engine/resources/_unit_bundles.html.erb +2 -2
- data/config/locales/admin/en.yml +1 -1
- data/db/schema.rb +1 -1
- data/lcms-engine.gemspec +12 -10
- data/lib/doc_template.rb +1 -1
- data/lib/doc_template/objects/agenda_metadata.rb +1 -1
- data/lib/doc_template/objects/metadata_helpers.rb +1 -1
- data/lib/doc_template/objects/toc_metadata.rb +2 -2
- data/lib/doc_template/tables/base.rb +3 -2
- data/lib/doc_template/tags/activity_metadata_type_tag.rb +1 -1
- data/lib/doc_template/tags/answer_space_tag.rb +1 -1
- data/lib/doc_template/tags/base_tag.rb +3 -3
- data/lib/doc_template/tags/columns_tag.rb +1 -1
- data/lib/doc_template/tags/def_tag.rb +1 -1
- data/lib/doc_template/tags/expand_tag.rb +1 -0
- data/lib/doc_template/tags/heading_tag.rb +1 -1
- data/lib/doc_template/tags/inset_tag.rb +2 -2
- data/lib/doc_template/tags/latex_tag.rb +1 -1
- data/lib/doc_template/tags/page_break_tag.rb +1 -1
- data/lib/doc_template/tags/pd_tag.rb +4 -4
- data/lib/doc_template/tags/section_tag.rb +2 -2
- data/lib/doc_template/tags/standard_tag.rb +3 -3
- data/lib/doc_template/tags/table_preserve_alignment_tag.rb +1 -1
- data/lib/document_exporter/gdoc/base.rb +1 -1
- data/lib/document_renderer/part.rb +3 -3
- data/lib/elasticsearch/persistence/repository/response/results.rb +1 -1
- data/lib/lcms/engine/engine.rb +1 -1
- data/lib/lcms/engine/version.rb +1 -1
- data/lib/lt/lcms/metadata/base_service.rb +2 -1
- data/lib/lt/lcms/metadata/context.rb +2 -2
- data/lib/lt/lcms/metadata/service.rb +3 -1
- data/lib/resque_job.rb +3 -6
- data/lib/standard_importer.rb +4 -4
- data/lib/tasks/cloud66.rake +6 -4
- data/lib/tasks/document.rake +3 -3
- data/lib/tasks/google.rake +1 -1
- data/package.json +1 -0
- data/spec/controllers/admin/association_picker_controller_spec.rb +6 -8
- data/spec/controllers/admin/documents_controller_spec.rb +3 -1
- data/spec/controllers/admin/materials_controller_spec.rb +1 -1
- data/spec/controllers/admin/resources_controller_spec.rb +2 -2
- data/spec/dummy/.env.docker +5 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/puma.rb +3 -3
- data/spec/entities/grades_spec.rb +12 -0
- data/spec/features/admin/lessons/add_lesson_spec.rb +3 -3
- data/spec/features/admin/materials/add_material_spec.rb +3 -3
- data/spec/forms/document_form_spec.rb +11 -1
- data/spec/lib/doc_template/tables/shared_examples/remove_table.rb +1 -1
- data/spec/rails_helper.rb +19 -2
- data/spec/services/document_build_service_spec.rb +1 -1
- data/yarn.lock +145 -170
- metadata +81 -34
@@ -29,10 +29,7 @@ module Lcms
|
|
29
29
|
[].tap do |result|
|
30
30
|
self::NESTED_JOBS.each do |job_klass|
|
31
31
|
Resque.redis.scan_each(match: "#{job_klass.constantize.result_key(jid)}*") do |key|
|
32
|
-
res = Resque.redis.
|
33
|
-
Resque.redis.get key
|
34
|
-
Resque.redis.del key
|
35
|
-
end.first
|
32
|
+
res = Resque.redis.get key
|
36
33
|
result << JSON.parse(res) rescue res
|
37
34
|
end
|
38
35
|
end
|
@@ -10,8 +10,8 @@ module Lcms
|
|
10
10
|
|
11
11
|
GDOC_EXPORTERS = {
|
12
12
|
'full' => DocumentExporter::Gdoc::Document,
|
13
|
-
'sm'
|
14
|
-
'tm'
|
13
|
+
'sm' => DocumentExporter::Gdoc::StudentMaterial,
|
14
|
+
'tm' => DocumentExporter::Gdoc::TeacherMaterial
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
before_perform do |job|
|
@@ -56,7 +56,7 @@ module Lcms
|
|
56
56
|
# Checks if there are jobs queued or running for current document
|
57
57
|
# and any of its materials
|
58
58
|
#
|
59
|
-
def materials_generating?
|
59
|
+
def materials_generating? # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
60
60
|
document.materials.each do |material|
|
61
61
|
queued = Resque.peek(queue_name, 0, 0)
|
62
62
|
.map { |job| job['args'].first }
|
@@ -31,7 +31,7 @@ module Lcms
|
|
31
31
|
def reimport_document(link)
|
32
32
|
form = DocumentForm.new({ link: link }, import_retry: true)
|
33
33
|
@result = if form.save
|
34
|
-
{ ok: true, link: link, model: form.document }
|
34
|
+
{ ok: true, link: link, model: form.document, warnings: form.service_errors }
|
35
35
|
else
|
36
36
|
{ ok: false, link: link, errors: form.errors[:link] }
|
37
37
|
end
|
@@ -53,9 +53,9 @@ module Lcms
|
|
53
53
|
Elasticsearch::Persistence::Repository::Response::Results.new(
|
54
54
|
repo,
|
55
55
|
hits: {
|
56
|
-
total:
|
56
|
+
total: resp[:total],
|
57
57
|
max_score: resp[:max_score],
|
58
|
-
hits:
|
58
|
+
hits: resp[:results]
|
59
59
|
}
|
60
60
|
).paginate(resp.slice(:page, :per_page))
|
61
61
|
end
|
@@ -73,7 +73,7 @@ module Lcms
|
|
73
73
|
# can define how to deserialize the results
|
74
74
|
def repo
|
75
75
|
@repo ||= Elasticsearch::Persistence::Repository.new do
|
76
|
-
def deserialize(document)
|
76
|
+
def deserialize(document)
|
77
77
|
Component.new(document)
|
78
78
|
end
|
79
79
|
end
|
@@ -7,7 +7,7 @@ module Lcms
|
|
7
7
|
zip: 'application/zip',
|
8
8
|
pdf: 'application/pdf',
|
9
9
|
excel: %w(application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet),
|
10
|
-
powerpoint: %w(application/vnd.ms-powerpoint application/vnd.openxmlformats-officedocument.presentationml.presentation), # rubocop:disable
|
10
|
+
powerpoint: %w(application/vnd.ms-powerpoint application/vnd.openxmlformats-officedocument.presentationml.presentation), # rubocop:disable Layout/LineLength
|
11
11
|
doc: %w(application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document)
|
12
12
|
}.freeze
|
13
13
|
S3_URL = 'http://k12-content.s3-website-us-east-1.amazonaws.com/'
|
@@ -31,10 +31,11 @@ module Lcms
|
|
31
31
|
|
32
32
|
class << self
|
33
33
|
def build_from(model)
|
34
|
-
|
34
|
+
case model
|
35
|
+
when Lcms::Engine::Resource
|
35
36
|
new(**attrs_from_resource(model))
|
36
37
|
|
37
|
-
|
38
|
+
when Lcms::Engine::ExternalPage
|
38
39
|
new(**attrs_from_page(model))
|
39
40
|
|
40
41
|
else
|
@@ -68,7 +69,7 @@ module Lcms
|
|
68
69
|
if model.is_a?(Lcms::Engine::Resource) && model.generic?
|
69
70
|
rtype = model[:resource_type] || 0
|
70
71
|
# for generic resource use the min grade, instead the avg
|
71
|
-
grade_pos = model.grades.list.map { |g| Lcms::Engine::Grades
|
72
|
+
grade_pos = model.grades.list.map { |g| Lcms::Engine::Grades.grades.index(g) }.compact.min || 0
|
72
73
|
last_pos = model.grades.list.size
|
73
74
|
else
|
74
75
|
rtype = 0
|
@@ -131,7 +131,7 @@ module Lcms
|
|
131
131
|
Lcms::Engine::ReactMaterialsResolver.resolve(content, self)
|
132
132
|
end
|
133
133
|
|
134
|
-
# rubocop:disable Metrics/
|
134
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
135
135
|
def short_breadcrumb(join_with: ' / ', with_short_lesson: false, with_subject: true, unit_level: false)
|
136
136
|
unless unit_level
|
137
137
|
lesson_abbr =
|
@@ -149,7 +149,7 @@ module Lcms
|
|
149
149
|
lesson_abbr
|
150
150
|
].compact.join(join_with)
|
151
151
|
end
|
152
|
-
# rubocop:enable Metrics/
|
152
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
153
153
|
|
154
154
|
def short_title
|
155
155
|
assessment? ? doc_type : "Lesson #{lesson}"
|
@@ -20,7 +20,7 @@ module Lcms
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
def apply_filters # rubocop:disable Metrics/AbcSize
|
23
|
+
def apply_filters # rubocop:disable Metrics/AbcSize
|
24
24
|
@scope = @scope.actives unless q.inactive == '1'
|
25
25
|
@scope = @scope.failed if q.only_failed == '1'
|
26
26
|
@scope = @scope.filter_by_term(q.search_term) if q.search_term.present?
|
@@ -5,6 +5,7 @@ module Lcms
|
|
5
5
|
class PreviewsMaterialSerializer < ActiveModel::Serializer
|
6
6
|
attributes :activity, :color, :content_type, :data, :for_group, :lesson, :subject
|
7
7
|
attr_reader :document
|
8
|
+
|
8
9
|
delegate :content_type, :subject, to: :document
|
9
10
|
|
10
11
|
def initialize(props, document)
|
@@ -7,8 +7,11 @@ module Lcms
|
|
7
7
|
class DocumentBuildService
|
8
8
|
EVENT_BUILT = 'document:built'
|
9
9
|
|
10
|
+
attr_reader :errors
|
11
|
+
|
10
12
|
def initialize(credentials, opts = {})
|
11
13
|
@credentials = credentials
|
14
|
+
@errors = []
|
12
15
|
@options = opts
|
13
16
|
end
|
14
17
|
|
@@ -19,6 +22,7 @@ module Lcms
|
|
19
22
|
@content = download url
|
20
23
|
@expand_document = expand
|
21
24
|
@template = DocTemplate::Template.parse @content
|
25
|
+
@errors = @template.metadata_service.errors
|
22
26
|
|
23
27
|
create_document
|
24
28
|
clear_preview_link
|
@@ -5,10 +5,10 @@ require 'sanitize'
|
|
5
5
|
module Lcms
|
6
6
|
module Engine
|
7
7
|
class HtmlSanitizer # rubocop:disable Metrics/ClassLength
|
8
|
-
LIST_STYLE_RE = /\.lst-(\S+)[^{}]+>\s*(?:li:before)\s*{\s*content[^{}]+counter\(lst-ctn-\1,([^)]+)\)
|
8
|
+
LIST_STYLE_RE = /\.lst-(\S+)[^{}]+>\s*(?:li:before)\s*{\s*content[^{}]+counter\(lst-ctn-\1,([^)]+)\)/.freeze
|
9
9
|
CLEAN_ELEMENTS = %w(a div h1 h2 h3 h4 h5 h6 p table).join(',')
|
10
10
|
GDOC_REMOVE_EMPTY_SELECTOR = '.o-ld-activity'
|
11
|
-
LINK_UNDERLINE_REGEX = /text-decoration\s*:\s*underline/i
|
11
|
+
LINK_UNDERLINE_REGEX = /text-decoration\s*:\s*underline/i.freeze
|
12
12
|
SKIP_P_CHECK = %w(ul ol table).freeze
|
13
13
|
STRIP_ELEMENTS = %w(a div h1 h2 h3 h4 h5 h6 p span table).freeze
|
14
14
|
|
@@ -169,7 +169,7 @@ module Lcms
|
|
169
169
|
].freeze
|
170
170
|
private_constant :FONT_STYLES_RE
|
171
171
|
|
172
|
-
BORDER_RE = /border-\w+-width:\s*0\w
|
172
|
+
BORDER_RE = /border-\w+-width:\s*0\w+;?/.freeze
|
173
173
|
private_constant :BORDER_RE
|
174
174
|
|
175
175
|
BORDER_REPLACE_RE = {
|
@@ -186,7 +186,7 @@ module Lcms
|
|
186
186
|
].freeze
|
187
187
|
private_constant :SUB_SUP_RE
|
188
188
|
|
189
|
-
SUB_SUP_STYLE_RE = /vertical-align:\s*(sub|super);?/i
|
189
|
+
SUB_SUP_STYLE_RE = /vertical-align:\s*(sub|super);?/i.freeze
|
190
190
|
private_constant :SUB_SUP_STYLE_RE
|
191
191
|
|
192
192
|
def add_css_class(el, *classes)
|
@@ -242,7 +242,7 @@ module Lcms
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def fix_table_styles(nodes, param, selector)
|
245
|
-
attr_regex = /(^|;\s*)#{param}\s*:\s*([\w
|
245
|
+
attr_regex = /(^|;\s*)#{param}\s*:\s*([\w.]+)\s*($|;)*/
|
246
246
|
nodes.css(selector).each do |node|
|
247
247
|
node[param] = node['style'].match(attr_regex)&.[](2)
|
248
248
|
end
|
@@ -67,7 +67,7 @@ module Lcms
|
|
67
67
|
|
68
68
|
def dirname(res)
|
69
69
|
subject = res.subject.casecmp('math').zero? ? 'Math' : 'ELA'
|
70
|
-
Breadcrumbs.new(res).short_pieces[1
|
70
|
+
Breadcrumbs.new(res).short_pieces[1..].unshift(subject).join('-')
|
71
71
|
end
|
72
72
|
|
73
73
|
def drive_id(url)
|
@@ -7,10 +7,13 @@ module Lcms
|
|
7
7
|
module Engine
|
8
8
|
class MaterialBuildService
|
9
9
|
EVENT_BUILT = 'material:built'
|
10
|
-
PDF_EXT_RE = /\.pdf
|
10
|
+
PDF_EXT_RE = /\.pdf$/.freeze
|
11
|
+
|
12
|
+
attr_reader :errors
|
11
13
|
|
12
14
|
def initialize(credentials, opts = {})
|
13
15
|
@credentials = credentials
|
16
|
+
@errors = []
|
14
17
|
@options = opts
|
15
18
|
end
|
16
19
|
|
@@ -25,7 +28,7 @@ module Lcms
|
|
25
28
|
|
26
29
|
attr_reader :credentials, :material, :downloader, :options, :url
|
27
30
|
|
28
|
-
def build_from_pdf
|
31
|
+
def build_from_pdf # rubocop:disable Metrics/AbcSize
|
29
32
|
@downloader = ::Lt::Lcms::Lesson::Downloader::PDF.new(credentials, url)
|
30
33
|
create_material
|
31
34
|
title = @downloader.file.name.sub(PDF_EXT_RE, '')
|
@@ -60,6 +63,7 @@ module Lcms
|
|
60
63
|
create_material
|
61
64
|
content = @downloader.download.content
|
62
65
|
template = DocTemplate::Template.parse(content, type: :material)
|
66
|
+
@errors = template.metadata_service.errors
|
63
67
|
|
64
68
|
metadata = template.metadata_service.options_for(:default)[:metadata]
|
65
69
|
material.update!(
|
@@ -6,8 +6,8 @@ module Lcms
|
|
6
6
|
# Generates and uploads PDF/GDoc files for material
|
7
7
|
#
|
8
8
|
class MaterialPreviewGenerator
|
9
|
-
GDOC_RE = %r{docs.google.com/document/d/([^/]*)}i
|
10
|
-
GDOC_BROKEN_RE = %r{/open\?id=$}i
|
9
|
+
GDOC_RE = %r{docs.google.com/document/d/([^/]*)}i.freeze
|
10
|
+
GDOC_BROKEN_RE = %r{/open\?id=$}i.freeze
|
11
11
|
PDF_S3_FOLDER = 'temp-materials-pdf'
|
12
12
|
|
13
13
|
attr_reader :error, :url
|
@@ -14,8 +14,9 @@ module Lcms
|
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def replace_react(node, document)
|
17
|
+
def replace_react(node, document) # rubocop:disable Metrics/PerceivedComplexity
|
18
18
|
node.remove && return if (data = node.attr('data-react-props')).blank?
|
19
|
+
|
19
20
|
raw_props = if data.match?(/^\d+(?:,\s*\d+)*$/)
|
20
21
|
# comma separated list of numbers, i.e: '123' or '123,432' or '123, 42, 12'
|
21
22
|
{ 'material_ids' => data.split(',').map(&:strip), 'activity' => {} }
|
@@ -25,7 +26,7 @@ module Lcms
|
|
25
26
|
node.remove && return if (raw_props['material_ids']).empty?
|
26
27
|
|
27
28
|
props = PreviewsMaterialSerializer.new(raw_props, document)
|
28
|
-
node.remove && return if props.data
|
29
|
+
node.remove && return if props.data && props.data.empty?
|
29
30
|
|
30
31
|
node.replace(component(props, document))
|
31
32
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css"/>
|
1
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
|
2
2
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
|
3
3
|
|
4
4
|
<% set_page_title 'Curriculum Tree Manager' %>
|
5
5
|
|
6
6
|
<div class="o-page">
|
7
7
|
|
8
|
-
<h1 class="text-center">Import Curriculum Tree</h1>
|
9
|
-
|
10
8
|
<% if @curriculum.present? %>
|
11
9
|
<h1 class="text-center">Curriculum Tree</h1>
|
12
10
|
<div class="row">
|
@@ -3,10 +3,10 @@
|
|
3
3
|
<% urls = material_urls(m, lesson) %>
|
4
4
|
<li class="u-text--small">
|
5
5
|
<% if urls[:gdoc].present? %>
|
6
|
-
<a class="lessons-table__materials--file" href="<%= urls[:gdoc] %>" target="_blank"> <i class="
|
6
|
+
<a class="lessons-table__materials--file" href="<%= urls[:gdoc] %>" target="_blank"> <i class="fab fa-google"></i></a>
|
7
7
|
<% end %>
|
8
8
|
<% if urls[:pdf].present? %>
|
9
|
-
<a class="lessons-table__materials--file" href="<%= urls[:pdf] %>" target="_blank"> <i class="
|
9
|
+
<a class="lessons-table__materials--file" href="<%= urls[:pdf] %>" target="_blank"> <i class="far fa-file-pdf"></i></a>
|
10
10
|
<% end %>
|
11
11
|
<%= link_to(m.identifier, m, target: '_blank') %>
|
12
12
|
</li>
|
@@ -16,12 +16,12 @@
|
|
16
16
|
<%= react_component 'admin/MultiSelectedOperation', {
|
17
17
|
text: t('.reimport_selected'),
|
18
18
|
operation: 'reimport',
|
19
|
-
path: reimport_selected_admin_documents_path(query:
|
19
|
+
path: reimport_selected_admin_documents_path(query: @query_params),
|
20
20
|
btn_style: 'primary' } %>
|
21
21
|
<%= react_component 'admin/MultiSelectedOperation', {
|
22
22
|
text: t('.delete_selected'),
|
23
23
|
operation: 'delete',
|
24
|
-
path: delete_selected_admin_documents_path(query:
|
24
|
+
path: delete_selected_admin_documents_path(query: @query_params),
|
25
25
|
btn_style: 'alert'} %>
|
26
26
|
|
27
27
|
<%= link_to t('.new_lesson'), :new_admin_document, class: 'button primary' %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="o-page">
|
2
2
|
<h2 class=text-center><%= t('.page_title') %></h2>
|
3
3
|
|
4
|
-
<%= simple_form_for @document, url: [:admin, :documents] do |f| %>
|
4
|
+
<%= simple_form_for @document || DocumentForm.new, url: [:admin, :documents] do |f| %>
|
5
5
|
<%= f.input :link, error: f.object.errors[:link].first.try(:html_safe), label: t('ui.url') %>
|
6
6
|
<%= f.button :submit, t('.submit') %>
|
7
7
|
<% end %>
|
@@ -31,7 +31,7 @@
|
|
31
31
|
required: false,
|
32
32
|
as: :select,
|
33
33
|
include_blank: true,
|
34
|
-
collection: Lcms::Engine::Grades
|
34
|
+
collection: Lcms::Engine::Grades.grades_abbrevs.zip(Lcms::Engine::Grades.grades.map(&:humanize)).last(4),
|
35
35
|
label_method: :last,
|
36
36
|
value_method: :first %>
|
37
37
|
</div>
|
@@ -16,12 +16,12 @@
|
|
16
16
|
<%= react_component 'admin/MultiSelectedOperation', {
|
17
17
|
text: t('.reimport_selected'),
|
18
18
|
operation: 'reimport',
|
19
|
-
path: reimport_selected_admin_materials_path(query:
|
19
|
+
path: reimport_selected_admin_materials_path(query: @query_params),
|
20
20
|
btn_style: 'primary' } %>
|
21
21
|
<%= react_component 'admin/MultiSelectedOperation', {
|
22
22
|
text: t('.delete_selected'),
|
23
23
|
operation: 'delete',
|
24
|
-
path: delete_selected_admin_materials_path(query:
|
24
|
+
path: delete_selected_admin_materials_path(query: @query_params),
|
25
25
|
btn_style: 'alert'} %>
|
26
26
|
<%# link_to t('.new_material_pdf'), new_admin_material_path(source_type: 'pdf'), class: 'button primary' %>
|
27
27
|
<%= link_to t('.new_material'), :new_admin_material, class: 'button primary' %>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
<% material.documents.each do |lesson| %>
|
71
71
|
<% lesson = ::Lcms::Engine::DocumentGenerator.document_presenter.new lesson %>
|
72
72
|
<li class="u-text--small">
|
73
|
-
<a href="<%= lesson.file_url%>" target="_blank" class="materials-table__lessons--file"><i class="
|
73
|
+
<a href="<%= lesson.file_url%>" target="_blank" class="materials-table__lessons--file"><i class="fab fa-google"></i></a>
|
74
74
|
<%= link_to lesson.title, ::Lcms::Engine::Admin::AdminController.document_path(lesson, request.query_parameters), target: '_blank' %>
|
75
75
|
</li>
|
76
76
|
<% end %>
|
@@ -78,7 +78,7 @@
|
|
78
78
|
<td class="u-txt--small"><%= material.reimported_at.to_s.presence || material.updated_at.to_s %>
|
79
79
|
<td class="materials-table__btns text-left">
|
80
80
|
<%= render partial: 'lcms/engine/admin/materials/reimport', locals: { material: material } %>
|
81
|
-
<%= button_to t('ui.delete'), admin_material_path(material, query:
|
81
|
+
<%= button_to t('ui.delete'), admin_material_path(material, query: @query_params), class: 'button small alert', data: { confirm: t('ui.are_you_sure') }, form_class: 'inline', method: :delete %>
|
82
82
|
<% unless material.pdf? %>
|
83
83
|
<%# link_to material.pdf_preview_title, preview_pdf_material_path(material), class: 'button warning', target: '_blank' %>
|
84
84
|
<%# link_to material.gdoc_preview_title, preview_gdoc_material_path(material), class: 'button warning', target: '_blank' %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
<%= f.association :standards, as: :select, input_html: { class: 'selectize', multiple: true } %>
|
11
11
|
|
12
|
-
<%= f.input :grades, collection: Lcms::Engine::Grades
|
12
|
+
<%= f.input :grades, collection: Lcms::Engine::Grades.grades, as: :select, value_method: :humanize, input_html: { class: 'selectize', id: 'grades_select', multiple: true } %>
|
13
13
|
|
14
14
|
<%= f.input :tag_list, collection: Lcms::Engine::Tag.where_context('tags').select(:id, :name).distinct(:name), as: :select, value_method: :name, input_html: { class: 'selectize', id: 'subjects_select', multiple: true } %>
|
15
15
|
|
@@ -14,6 +14,9 @@
|
|
14
14
|
|
15
15
|
<%= f.input :opr_description, label: t('lcms.engine.admin.resources.form.opr_description'), wrapper_html: {class: (resource.unit? ? '': 'c-hidden')} %>
|
16
16
|
|
17
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css"/>
|
18
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
|
19
|
+
|
17
20
|
<%= react_component('admin/curriculum/DirectoryPicker', directory_picker_props(resource)) %>
|
18
21
|
|
19
22
|
<%= f.input :time_to_teach %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= simple_form_for @query, url: :admin_resources, html: { class: 'form-inline well admin-resource-search', method: :get } do |f| %>
|
2
2
|
|
3
3
|
<div class='row align-justify'>
|
4
|
-
<%= f.input :grades, as: :select, collection: Lcms::Engine::Grades
|
4
|
+
<%= f.input :grades, as: :select, collection: Lcms::Engine::Grades.grades, input_html: { class: 'selectize resource-search-select', multiple: true }, label: t('.grades'), label_method: :humanize, required: false, wrapper_html: { class: 'resource-search-wrap' } %>
|
5
5
|
|
6
6
|
<%= f.input :resource_standards_standard_id_in, as: :select, collection: Lcms::Engine::Standard.all, input_html: { class: 'selectize resource-search-select', multiple: true }, label: t('.standards'), required: false, wrapper_html: { class: 'resource-search-wrap' } %>
|
7
7
|
|