lcms-engine 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +11 -15
- data/Dockerfile +0 -1
- data/README.md +13 -4
- data/app/assets/javascripts/lcms/engine/admin/application.js +2 -6
- data/app/assets/javascripts/lcms/engine/application.js +2 -2
- data/app/assets/javascripts/lcms/engine/initializers/{google_analytics.js → analytics.js} +0 -0
- data/app/assets/javascripts/lcms/engine/initializers/lessons.js +1 -1
- data/app/assets/stylesheets/lcms/engine/admin.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/application.scss +4 -3
- data/app/assets/stylesheets/lcms/engine/components/_curriculum-cards.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/_curriculum-map.scss +4 -4
- data/app/assets/stylesheets/lcms/engine/components/_media-resources.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/_panel-dsc.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/components/_resource.scss +6 -6
- data/app/assets/stylesheets/lcms/engine/pages/_home.scss +4 -4
- data/app/assets/stylesheets/lcms/engine/pdf.scss +1 -1
- data/app/assets/stylesheets/lcms/engine/themes/_settings.scss +419 -116
- data/app/assets/stylesheets/lcms/engine/utils/_mixins.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/vendors/foundation_and_overrides-pdf.scss +0 -1
- data/app/assets/stylesheets/lcms/engine/vendors/foundation_and_overrides.scss +13 -2
- data/app/controllers/lcms/engine/admin/admin_controller.rb +0 -2
- data/app/controllers/lcms/engine/admin/association_picker_controller.rb +10 -9
- data/app/controllers/lcms/engine/admin/documents_controller.rb +17 -14
- data/app/controllers/lcms/engine/admin/materials_controller.rb +19 -23
- data/app/controllers/lcms/engine/admin/resource_picker_controller.rb +2 -2
- data/app/controllers/lcms/engine/admin/resources_controller.rb +45 -79
- data/app/controllers/lcms/engine/admin/sketch_compilers_controller.rb +2 -2
- data/app/controllers/lcms/engine/application_controller.rb +0 -15
- data/app/entities/lcms/engine/pagination.rb +14 -5
- data/app/forms/lcms/engine/material_form.rb +0 -1
- data/app/helpers/lcms/engine/application_helper.rb +2 -6
- data/app/helpers/lcms/engine/view_helper.rb +1 -3
- data/app/interactors/lcms/engine/explore_curriculum_interactor.rb +1 -1
- data/app/javascript/components/admin/ImportStatus.jsx +1 -1
- data/app/javascript/components/admin/association-picker/AssociationPickerResults.jsx +1 -1
- data/app/javascript/components/admin/picker/pickerWindowWrapper.jsx +0 -1
- data/app/models/lcms/engine/access_code.rb +1 -1
- data/app/models/lcms/engine/application_record.rb +9 -0
- data/app/models/lcms/engine/author.rb +1 -1
- data/app/models/lcms/engine/copyright_attribution.rb +1 -1
- data/app/models/lcms/engine/curriculum.rb +1 -1
- data/app/models/lcms/engine/document.rb +3 -3
- data/app/models/lcms/engine/document_bundle.rb +2 -2
- data/app/models/lcms/engine/document_part.rb +1 -1
- data/app/models/lcms/engine/download.rb +3 -3
- data/app/models/lcms/engine/download_category.rb +1 -1
- data/app/models/lcms/engine/leadership_post.rb +1 -1
- data/app/models/lcms/engine/material.rb +2 -2
- data/app/models/lcms/engine/material_part.rb +1 -1
- data/app/models/lcms/engine/page.rb +1 -1
- data/app/models/lcms/engine/reading_assignment_author.rb +1 -1
- data/app/models/lcms/engine/reading_assignment_text.rb +1 -1
- data/app/models/lcms/engine/resource.rb +4 -12
- data/app/models/lcms/engine/resource_additional_resource.rb +1 -1
- data/app/models/lcms/engine/resource_download.rb +1 -1
- data/app/models/lcms/engine/resource_reading_assignment.rb +1 -1
- data/app/models/lcms/engine/resource_related_resource.rb +1 -1
- data/app/models/lcms/engine/resource_standard.rb +1 -1
- data/app/models/lcms/engine/search/elastic_search_document.rb +1 -1
- data/app/models/lcms/engine/settings.rb +1 -1
- data/app/models/lcms/engine/social_thumbnail.rb +1 -1
- data/app/models/lcms/engine/staff_member.rb +1 -1
- data/app/models/lcms/engine/standard.rb +1 -1
- data/app/models/lcms/engine/standard_link.rb +1 -1
- data/app/models/lcms/engine/user.rb +3 -3
- data/app/presenters/lcms/engine/content_presenter.rb +1 -1
- data/app/queries/lcms/engine/admin_documents_query.rb +1 -1
- data/app/queries/lcms/engine/admin_materials_query.rb +1 -1
- data/app/serializers/lcms/engine/association_item_serializer.rb +0 -1
- data/app/serializers/lcms/engine/curriculum_resource_serializer.rb +0 -2
- data/app/serializers/lcms/engine/document_material_serializer.rb +0 -1
- data/app/serializers/lcms/engine/material_serializer.rb +0 -1
- data/app/serializers/lcms/engine/previews_material_serializer.rb +0 -1
- data/app/serializers/lcms/engine/resource_details_serializer.rb +0 -2
- data/app/serializers/lcms/engine/resource_instruction_serializer.rb +0 -2
- data/app/serializers/lcms/engine/resource_picker_serializer.rb +0 -2
- data/app/serializers/lcms/engine/resource_serializer.rb +0 -2
- data/app/serializers/lcms/engine/search_document_serializer.rb +0 -2
- data/app/services/lcms/engine/document_build_service.rb +1 -0
- data/app/services/lcms/engine/html_sanitizer.rb +2 -2
- data/app/services/lcms/engine/s3_service.rb +1 -1
- data/app/uploaders/social_thumbnail_uploader.rb +0 -4
- data/app/views/layouts/lcms/engine/admin.html.erb +1 -1
- data/app/views/lcms/engine/admin/access_codes/index.html.erb +10 -8
- data/app/views/lcms/engine/admin/documents/index.html.erb +2 -2
- data/app/views/lcms/engine/admin/materials/index.html.erb +2 -2
- data/app/views/lcms/engine/admin/pages/index.html.erb +3 -3
- data/app/views/lcms/engine/admin/standards/index.html.erb +9 -7
- data/app/views/lcms/engine/admin/users/index.html.erb +16 -14
- data/app/views/lcms/engine/resources/_children_list.html.erb +1 -1
- data/app/views/lcms/engine/shared/_social_sharing_menu.html.erb +4 -4
- data/config/initializers/carrier_wave.rb +0 -1
- data/config/locales/admin/en.yml +0 -2
- data/db/migrate/20200422130652_add_reimported_at_to_documents.rb +7 -0
- data/lcms-engine.gemspec +73 -87
- data/lib/doc_template/document.rb +2 -2
- data/lib/doc_template/tables/activity.rb +2 -1
- data/lib/doc_template/tables/base.rb +0 -4
- data/lib/doc_template/tables/section.rb +2 -1
- data/lib/doc_template/tags/link_tag.rb +1 -1
- data/lib/doc_template/xpath_functions.rb +1 -3
- data/lib/document_exporter/base.rb +1 -2
- data/lib/document_exporter/docx.rb +0 -1
- data/lib/generators/lcms/engine/install/install_generator.rb +1 -4
- data/lib/generators/lcms/engine/install/templates/config/lcms.yml +1 -1
- data/lib/lcms/engine/engine.rb +0 -16
- data/lib/lcms/engine/migration.rb +2 -0
- data/lib/lcms/engine/version.rb +1 -1
- data/lib/lt/lcms/metadata/context.rb +7 -5
- data/spec/controllers/admin/admin_controller_spec.rb +1 -1
- data/spec/controllers/admin/association_picker_controller_spec.rb +2 -2
- data/spec/controllers/admin/curriculums_controller_spec.rb +1 -2
- data/spec/controllers/admin/documents_controller_spec.rb +12 -41
- data/spec/controllers/admin/materials_controller_spec.rb +7 -67
- data/spec/controllers/admin/pages_controller_spec.rb +2 -2
- data/spec/controllers/admin/resource_bulk_edit_controller_spec.rb +3 -3
- data/spec/controllers/admin/sketch_compilers_controller_spec.rb +5 -4
- data/spec/controllers/admin/standards_controller_spec.rb +12 -9
- data/spec/controllers/admin/users_controller_spec.rb +2 -2
- data/spec/controllers/admin/welcome_controller_spec.rb +1 -1
- data/spec/controllers/documents_controller_spec.rb +3 -3
- data/spec/controllers/enhance_instruction_controller_spec.rb +1 -1
- data/spec/controllers/explore_curriculum_controller_spec.rb +2 -2
- data/spec/controllers/find_lessons_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +9 -12
- data/spec/controllers/resources_controller_spec.rb +2 -2
- data/spec/controllers/search_controller_spec.rb +1 -1
- data/spec/dummy/bin/spring +2 -2
- data/spec/dummy/config/application.rb +3 -3
- data/spec/dummy/config/environments/test.rb +2 -5
- data/spec/dummy/config/lcms-admin.yml +3 -3
- data/spec/dummy/config/webpack/development.js +5 -0
- data/spec/dummy/config/webpack/environment.js +3 -0
- data/spec/dummy/config/webpack/production.js +5 -0
- data/spec/dummy/config/webpack/test.js +5 -0
- data/spec/dummy/config/webpacker.yml +96 -0
- data/spec/dummy/db/schema.rb +251 -275
- data/spec/factories/document_bundles.rb +1 -1
- data/spec/factories/standard_links.rb +2 -0
- data/spec/factories/taggings.rb +1 -0
- data/spec/models/document_bundle_spec.rb +0 -6
- data/spec/models/resource_spec.rb +0 -33
- data/spec/rails_helper.rb +0 -1
- data/spec/requests/admin/curriculum_spec.rb +17 -0
- data/spec/services/document_build_service_spec.rb +76 -62
- data/spec/services/html_sanitizer_spec.rb +0 -34
- data/spec/support/capybara.rb +1 -3
- data/spec/support/concerns/searchable.rb +2 -0
- data/spec/support/database_cleaner.rb +5 -16
- data/spec/support/devise.rb +2 -0
- data/yarn.lock +442 -530
- metadata +183 -439
- data/Gemfile.lock +0 -752
- data/config/initializers/active_record.rb +0 -3
- data/spec/controllers/admin/resources_controller_spec.rb +0 -84
- data/spec/fixtures/tables/activity-metadata-3activities.html +0 -1
- data/spec/fixtures/tables/document-metadata-2paragpraphs.html +0 -97
- data/spec/fixtures/tables/document-metadata-2spans.html +0 -96
- data/spec/fixtures/tables/document-metadata.html +0 -96
- data/spec/lib/doc_template/tables/activity_spec.rb +0 -28
- data/spec/lib/doc_template/tables/metadata_spec.rb +0 -40
- data/spec/lib/doc_template/tables/shared_examples/remove_table.rb +0 -11
- data/spec/support/fixture_helper.rb +0 -16
@@ -78,9 +78,9 @@
|
|
78
78
|
|
79
79
|
@mixin txt-heading($element) {
|
80
80
|
@include txt-heading-base($element);
|
81
|
-
@each $size, $headers in $header-
|
81
|
+
@each $size, $headers in $header-styles {
|
82
82
|
@include breakpoint($size) {
|
83
|
-
$font-size: map-get($headers, $element);
|
83
|
+
$font-size: map-get(map-get($headers, $element), 'font-size');
|
84
84
|
font-size: rem-calc($font-size);
|
85
85
|
}
|
86
86
|
}
|
@@ -1,9 +1,18 @@
|
|
1
|
+
@charset "utf-8";
|
2
|
+
|
1
3
|
@import 'foundation';
|
4
|
+
|
5
|
+
// If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
|
6
|
+
//
|
2
7
|
@import 'motion-ui/motion-ui';
|
3
8
|
|
4
9
|
// We include everything by default. To slim your CSS, remove components you don't use.
|
10
|
+
|
5
11
|
@include foundation-global-styles;
|
12
|
+
//@include foundation-xy-grid-classes;
|
13
|
+
//@include foundation-grid;
|
6
14
|
@include foundation-flex-grid;
|
15
|
+
@include foundation-flex-classes;
|
7
16
|
@include foundation-typography;
|
8
17
|
@include foundation-forms;
|
9
18
|
@include foundation-button;
|
@@ -13,13 +22,14 @@
|
|
13
22
|
@include foundation-breadcrumbs;
|
14
23
|
@include foundation-button-group;
|
15
24
|
@include foundation-callout;
|
25
|
+
@include foundation-card;
|
16
26
|
@include foundation-close-button;
|
17
27
|
@include foundation-menu;
|
18
28
|
@include foundation-menu-icon;
|
19
29
|
@include foundation-drilldown-menu;
|
20
30
|
@include foundation-dropdown;
|
21
31
|
@include foundation-dropdown-menu;
|
22
|
-
@include foundation-
|
32
|
+
@include foundation-responsive-embed;
|
23
33
|
@include foundation-label;
|
24
34
|
@include foundation-media-object;
|
25
35
|
@include foundation-off-canvas;
|
@@ -38,7 +48,8 @@
|
|
38
48
|
@include foundation-top-bar;
|
39
49
|
@include foundation-visibility-classes;
|
40
50
|
@include foundation-float-classes;
|
41
|
-
|
51
|
+
|
52
|
+
// If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
|
42
53
|
|
43
54
|
@include motion-ui-transitions;
|
44
55
|
@include motion-ui-animations;
|
@@ -13,7 +13,7 @@ module Lcms
|
|
13
13
|
def index
|
14
14
|
@items = association_items
|
15
15
|
@items = @items.where('name ilike ?', "%#{params[:q]}%") if index_params[:q].present?
|
16
|
-
@items = @items.paginate(page:
|
16
|
+
@items = @items.paginate(page: params[:page], per_page: 10).order('name asc')
|
17
17
|
|
18
18
|
respond_to do |format|
|
19
19
|
format.json { render json: pagination.serialize(@items, AssociationItemSerializer) }
|
@@ -23,19 +23,20 @@ module Lcms
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def pagination
|
26
|
-
@pagination ||= Pagination.new
|
26
|
+
@pagination ||= Pagination.new params
|
27
27
|
end
|
28
28
|
|
29
29
|
def index_params
|
30
|
-
@index_params ||=
|
31
|
-
|
32
|
-
|
30
|
+
@index_params ||=
|
31
|
+
begin
|
32
|
+
expected_params = params.permit(:association, :q).to_h.symbolize_keys
|
33
|
+
index_p = { q: nil }.merge(expected_params)
|
33
34
|
|
34
|
-
|
35
|
+
raise StandardError unless VALID_ASSOCIATIONS.include?(index_p[:association])
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
index_p[:association] = index_p[:association].to_sym
|
38
|
+
index_p
|
39
|
+
end
|
39
40
|
end
|
40
41
|
|
41
42
|
def association_items
|
@@ -18,13 +18,9 @@ module Lcms
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def create
|
21
|
-
if
|
22
|
-
|
23
|
-
|
24
|
-
return bulk_import(file_ids) && render(:import) if file_ids.any?
|
25
|
-
|
26
|
-
flash.now[:alert] = t '.empty_folder'
|
27
|
-
return render(:new)
|
21
|
+
if gdoc_files.size > 1
|
22
|
+
bulk_import gdoc_files
|
23
|
+
return render :import
|
28
24
|
end
|
29
25
|
|
30
26
|
@document = reimport_lesson
|
@@ -32,7 +28,7 @@ module Lcms
|
|
32
28
|
redirect_to AdminController.document_path(@document.document),
|
33
29
|
notice: t('.success', name: @document.document.name)
|
34
30
|
else
|
35
|
-
render :new
|
31
|
+
render :new, alert: t('.error')
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
@@ -81,17 +77,24 @@ module Lcms
|
|
81
77
|
@documents = Document.where(id: ids)
|
82
78
|
end
|
83
79
|
|
84
|
-
def
|
85
|
-
|
86
|
-
|
87
|
-
.
|
88
|
-
|
80
|
+
def gdoc_files
|
81
|
+
@gdoc_files ||= begin
|
82
|
+
link = form_params[:link]
|
83
|
+
if link.match?(%r{/drive/(.*/)?folders/})
|
84
|
+
folder_id = ::Lt::Google::Api::Drive.folder_id_for(link)
|
85
|
+
::Lt::Google::Api::Drive.new(google_credentials)
|
86
|
+
.list_file_ids_in(folder_id)
|
87
|
+
.map { |id| Lt::Lcms::Lesson::Downloader::Gdoc.gdoc_file_url(id) }
|
88
|
+
else
|
89
|
+
[link]
|
90
|
+
end
|
91
|
+
end
|
89
92
|
end
|
90
93
|
|
91
94
|
def form_params
|
92
95
|
@form_params ||=
|
93
96
|
begin
|
94
|
-
data = params.require(:document_form).permit(:link, :link_fs, :reimport, :with_materials)
|
97
|
+
data = params.require(:document_form).permit(:link, :link_fs, :reimport, :with_materials).to_h
|
95
98
|
data.delete(:with_materials) if data[:with_materials].to_i.zero?
|
96
99
|
data
|
97
100
|
end
|
@@ -16,21 +16,12 @@ module Lcms
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def create
|
19
|
-
|
20
|
-
|
21
|
-
if form_params[:link].match?(RE_GOOGLE_FOLDER)
|
22
|
-
# Import all from a folder
|
23
|
-
file_ids = gdoc_files_from form_params[:link]
|
24
|
-
return bulk_import(file_ids) && render(:import) if file_ids.any?
|
25
|
-
|
26
|
-
flash.now[:alert] = t '.empty_folder'
|
27
|
-
return render(:new)
|
28
|
-
end
|
19
|
+
return bulk_import(gdoc_files) && render(:import) if gdoc_files.size > 1
|
29
20
|
|
21
|
+
@material_form = DocumentGenerator.material_form.new(form_params)
|
30
22
|
if @material_form.save
|
31
23
|
material = @material_form.material
|
32
|
-
redirect_to AdminController.material_path(material),
|
33
|
-
notice: t('.success', name: material.name)
|
24
|
+
redirect_to AdminController.material_path(material.id), notice: t('.success', name: material.name)
|
34
25
|
else
|
35
26
|
render :new
|
36
27
|
end
|
@@ -83,17 +74,22 @@ module Lcms
|
|
83
74
|
params.require(:material_form).permit(:link, :source_type)
|
84
75
|
end
|
85
76
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
77
|
+
def gdoc_files
|
78
|
+
@gdoc_files ||= begin
|
79
|
+
link = form_params[:link]
|
80
|
+
return [link] unless link =~ %r{/drive/(.*/)?folders/}
|
81
|
+
|
82
|
+
folder_id = ::Lt::Google::Api::Drive.folder_id_for(link)
|
83
|
+
if form_params[:source_type] == 'pdf'
|
84
|
+
mime_type = Lt::Lcms::Lesson::Downloader::PDF::MIME_TYPE
|
85
|
+
::Lt::Google::Api::Drive.new(google_credentials)
|
86
|
+
.list_file_ids_in(folder_id, mime_type: mime_type)
|
87
|
+
.map { |id| Lt::Lcms::Lesson::Downloader::PDF.gdoc_file_url(id) }
|
88
|
+
else
|
89
|
+
::Lt::Google::Api::Drive.new(google_credentials)
|
90
|
+
.list_file_ids_in(folder_id)
|
91
|
+
.map { |id| Lt::Lcms::Lesson::Downloader::Gdoc.gdoc_file_url(id) }
|
92
|
+
end
|
97
93
|
end
|
98
94
|
end
|
99
95
|
end
|
@@ -24,7 +24,7 @@ module Lcms
|
|
24
24
|
def index_params
|
25
25
|
@index_params ||= begin
|
26
26
|
default_params = { type: nil, subject: nil, grade: nil, q: nil }
|
27
|
-
expected_params = params.
|
27
|
+
expected_params = params.permit(:type, :subject, :grade, :q).to_h.symbolize_keys
|
28
28
|
index_p = default_params.merge(expected_params)
|
29
29
|
|
30
30
|
grade_ok = index_p[:grade].blank? || Filterbar::GRADES.include?(index_p[:grade])
|
@@ -38,7 +38,7 @@ module Lcms
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def pagination
|
41
|
-
@pagination ||= Pagination.new
|
41
|
+
@pagination ||= Pagination.new params
|
42
42
|
end
|
43
43
|
|
44
44
|
def grade_name
|
@@ -40,7 +40,9 @@ module Lcms
|
|
40
40
|
|
41
41
|
def export_to_lti_cc
|
42
42
|
# TODO: Later may need to extend this check to allow unit export as well
|
43
|
-
|
43
|
+
unless @resource.module?
|
44
|
+
return redirect_back fallback_location: admin_resources_path, notice: 'Unsupported resource type'
|
45
|
+
end
|
44
46
|
|
45
47
|
data = LtiExporter.perform @resource
|
46
48
|
filename = "#{@resource.slug.parameterize}.zip"
|
@@ -79,80 +81,6 @@ module Lcms
|
|
79
81
|
redirect_to :admin_resources, notice: t('.success', resource_id: @resource.id)
|
80
82
|
end
|
81
83
|
|
82
|
-
protected
|
83
|
-
|
84
|
-
def form_params_arrays
|
85
|
-
download_categories_settings =
|
86
|
-
DownloadCategory.select(:title).map do |category|
|
87
|
-
{ category.title.parameterize => %i(show_long_description show_short_description) }
|
88
|
-
end
|
89
|
-
{
|
90
|
-
additional_resource_ids: [],
|
91
|
-
common_core_standard_ids: [],
|
92
|
-
download_categories_settings: download_categories_settings,
|
93
|
-
resource_downloads_attributes: [
|
94
|
-
:_destroy,
|
95
|
-
:description,
|
96
|
-
:id,
|
97
|
-
:download_category_id, { download_attributes: %i(description file main filename_cache id title) }
|
98
|
-
],
|
99
|
-
related_resource_ids: [],
|
100
|
-
standard_ids: [],
|
101
|
-
new_standard_names: [],
|
102
|
-
topic_ids: [],
|
103
|
-
tag_ids: [],
|
104
|
-
content_source_ids: [],
|
105
|
-
reading_assignment_text_ids: [],
|
106
|
-
new_topic_names: [],
|
107
|
-
new_tag_names: [],
|
108
|
-
new_content_source_names: [],
|
109
|
-
**form_params_arrays_override
|
110
|
-
}
|
111
|
-
end
|
112
|
-
|
113
|
-
#
|
114
|
-
# The result of this method will be splatted into +form_params_ararys+
|
115
|
-
# and will be injected into the final +form_params+ call.
|
116
|
-
#
|
117
|
-
# Should be used to extend the list of permitted parameters
|
118
|
-
#
|
119
|
-
# @return [Hash]
|
120
|
-
def form_params_arrays_override
|
121
|
-
{}
|
122
|
-
end
|
123
|
-
|
124
|
-
def form_params_simple
|
125
|
-
%i(
|
126
|
-
curriculum_type
|
127
|
-
directory
|
128
|
-
parent_id
|
129
|
-
tree
|
130
|
-
description
|
131
|
-
hidden
|
132
|
-
resource_type
|
133
|
-
short_title
|
134
|
-
subtitle
|
135
|
-
title
|
136
|
-
teaser
|
137
|
-
url
|
138
|
-
time_to_teach
|
139
|
-
ell_appropriate
|
140
|
-
image_file
|
141
|
-
opr_description
|
142
|
-
).concat(form_params_simple_override)
|
143
|
-
end
|
144
|
-
|
145
|
-
#
|
146
|
-
# The result of this method will be added to +form_params_simple+
|
147
|
-
# and will be injected into the final +form_params+ call.
|
148
|
-
#
|
149
|
-
# Should be used to extend the list of permitted parameters
|
150
|
-
#
|
151
|
-
# @return [Array]
|
152
|
-
def form_params_simple_override
|
153
|
-
[]
|
154
|
-
end
|
155
|
-
|
156
84
|
private
|
157
85
|
|
158
86
|
def can_bundle?(resource)
|
@@ -161,7 +89,6 @@ module Lcms
|
|
161
89
|
.detect { |type| resource.send "#{type}?" }
|
162
90
|
.present?
|
163
91
|
end
|
164
|
-
|
165
92
|
helper_method :can_bundle?
|
166
93
|
|
167
94
|
def find_resource
|
@@ -172,13 +99,51 @@ module Lcms
|
|
172
99
|
params.fetch(:q, {}).fetch(:grades, []).select(&:present?)
|
173
100
|
end
|
174
101
|
|
102
|
+
# rubocop:disable Metrics/MethodLength
|
175
103
|
def form_params
|
176
104
|
@form_params ||=
|
177
105
|
begin
|
106
|
+
download_categories_settings =
|
107
|
+
DownloadCategory.select(:title).map do |category|
|
108
|
+
{ category.title.parameterize => %i(show_long_description show_short_description) }
|
109
|
+
end
|
178
110
|
ps = params.require(:resource).permit(
|
179
|
-
|
180
|
-
|
181
|
-
|
111
|
+
:curriculum_type,
|
112
|
+
:directory,
|
113
|
+
:parent_id,
|
114
|
+
:tree,
|
115
|
+
:description,
|
116
|
+
:hidden,
|
117
|
+
:resource_type,
|
118
|
+
:short_title,
|
119
|
+
:subtitle,
|
120
|
+
:title,
|
121
|
+
:teaser,
|
122
|
+
:url,
|
123
|
+
:time_to_teach,
|
124
|
+
:ell_appropriate,
|
125
|
+
:image_file,
|
126
|
+
:opr_description,
|
127
|
+
additional_resource_ids: [],
|
128
|
+
common_core_standard_ids: [],
|
129
|
+
download_categories_settings: download_categories_settings,
|
130
|
+
resource_downloads_attributes: [
|
131
|
+
:_destroy,
|
132
|
+
:description,
|
133
|
+
:id,
|
134
|
+
:download_category_id, { download_attributes: %i(description file main filename_cache id title) }
|
135
|
+
],
|
136
|
+
related_resource_ids: [],
|
137
|
+
standard_ids: [],
|
138
|
+
new_standard_names: [],
|
139
|
+
topic_ids: [],
|
140
|
+
tag_ids: [],
|
141
|
+
content_source_ids: [],
|
142
|
+
reading_assignment_text_ids: [],
|
143
|
+
new_topic_names: [],
|
144
|
+
new_tag_names: [],
|
145
|
+
new_content_source_names: []
|
146
|
+
).to_h
|
182
147
|
if ps[:download_categories_settings].present?
|
183
148
|
ps[:download_categories_settings].transform_values! do |settings|
|
184
149
|
settings.transform_values! { |x| x == '1' }
|
@@ -188,6 +153,7 @@ module Lcms
|
|
188
153
|
ps
|
189
154
|
end
|
190
155
|
end
|
156
|
+
# rubocop:enable Metrics/MethodLength
|
191
157
|
|
192
158
|
def metadata(directory)
|
193
159
|
return {} unless @resource.present?
|
@@ -15,9 +15,9 @@ module Lcms
|
|
15
15
|
|
16
16
|
if response.success?
|
17
17
|
url = DocumentExporter::Gdoc::Base.url_for JSON.parse(response.body)['id']
|
18
|
-
|
18
|
+
redirect_back fallback_location: new_admin_sketch_compiler_path, notice: t('.success', url: url)
|
19
19
|
else
|
20
|
-
|
20
|
+
redirect_back fallback_location: new_admin_sketch_compiler_path, alert: t('.compile_error')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -6,12 +6,6 @@ module Lcms
|
|
6
6
|
# store location to use at after sign in or other devise callbacks
|
7
7
|
include LocationStorable
|
8
8
|
|
9
|
-
protect_from_forgery with: :exception
|
10
|
-
|
11
|
-
# NOTE: Temporary disabled
|
12
|
-
# require auth for accessing the pilot
|
13
|
-
# before_action :pilot_authentication if Rails.env.production? || Rails.env.production_swap?
|
14
|
-
|
15
9
|
before_action :authenticate_user!, unless: :pdf_request?
|
16
10
|
|
17
11
|
before_action :check_user_has_survey_filled_in, if: :user_signed_in?, unless: :devise_controller?
|
@@ -54,15 +48,6 @@ module Lcms
|
|
54
48
|
def after_sign_out_path_for(resource_or_scope)
|
55
49
|
session_path(resource_or_scope)
|
56
50
|
end
|
57
|
-
|
58
|
-
# NOTE: Temporary disabled
|
59
|
-
# def pilot_authentication
|
60
|
-
# return unless request.format.html?
|
61
|
-
#
|
62
|
-
# authenticate_or_request_with_http_basic('Administration') do |username, password|
|
63
|
-
# username == ENV['HTTP_AUTH_NAME'] && password == ENV['HTTP_AUTH_PASS']
|
64
|
-
# end
|
65
|
-
# end
|
66
51
|
end
|
67
52
|
end
|
68
53
|
end
|