Extract legacy parts of the codebase into its own module

This commit is contained in:
Liam Morley 2021-11-15 16:07:15 -05:00 committed by rebuilt
parent cf6e80ce6b
commit 413096dfe2
269 changed files with 5549 additions and 5279 deletions

View file

@ -1,3 +0,0 @@
%p= link_to 'Categories', categories_path
%p= link_to 'Questions', questions_path

View file

@ -1,2 +0,0 @@
%p
= school_category.category.path.map { |c| link_to(c.name, school_category_path(school_category.school, c, year: school_category.year)) }.join(' > ').html_safe

View file

@ -1,7 +1,7 @@
.row
.col
=# link_to(image_tag(@district.logo), @district) if @district.present?
%h2= link_to @school.name, school_path(@school, year: @year)
%h2= link_to @school.name, legacy_school_path(@school, year: @year)
= simple_format(@school.description)
- if @year.present?
%p
@ -12,9 +12,9 @@
- @years.sort.each do |year|
   
- if @school_category.present?
= link_to_unless(year == @year, "#{year - 1}-#{year}", school_category_path(@school_category.school, @school_category.category, year: year))
= link_to_unless(year == @year, "#{year - 1}-#{year}", legacy_school_legacy_category_path(@school_category.school, @school_category.category, year: year))
- else
= link_to_unless(year == @year, "#{year - 1}-#{year}", school_path(@school, year: year))
= link_to_unless(year == @year, "#{year - 1}-#{year}", legacy_school_path(@school, year: year))
- if @school.district.present?
%p
%strong District:

View file

@ -0,0 +1,3 @@
%p= link_to 'Categories', legacy_categories_path
%p= link_to 'Questions', legacy_questions_path

View file

@ -0,0 +1,2 @@
%p
= school_category.category.path.map { |c| link_to(c.name, legacy_school_legacy_category_path(school_category.school, c, year: school_category.year)) }.join(' > ').html_safe

View file

@ -1,4 +1,4 @@
= form_for(category) do |f|
= form_for(category, as: 'category') do |f|
- if category.errors.any?
#error_explanation
%h2

View file

@ -2,4 +2,4 @@
= render 'form', category: @category
= link_to 'Show', @category
|
= link_to 'Back', categories_path
= link_to 'Back', legacy_categories_path

View file

@ -18,7 +18,7 @@
%td= category.external_id
%td= category.parent_category_id
%td= link_to 'Show', category
%td= link_to 'Edit', edit_category_path(category)
%td= link_to 'Edit', edit_legacy_category_path(category)
%td= link_to 'Destroy', category, method: :delete, data: { confirm: 'Are you sure?' }
%br/
= link_to 'New Category', new_category_path
= link_to 'New Category', new_legacy_category_path

View file

@ -1,3 +1,3 @@
%h1 New Category
= render 'form', category: @category
= link_to 'Back', categories_path
= link_to 'Back', legacy_categories_path

View file

@ -6,7 +6,7 @@
.row
.col-12
%p
= render 'categories/breadcrumbs', school_category: @school_category
= render 'legacy/categories/breadcrumbs', school_category: @school_category
.row
.col-12
@ -29,7 +29,7 @@
.indicator-container.py-3
= render 'school_categories/indicator', info: @school_category
= render 'legacy/school_categories/indicator', info: @school_category
- else
.row.py-4
.col-12.text-center
@ -46,4 +46,4 @@
.row
= render @questions
= render "shared/performance_spectrum"
= render "legacy/shared/performance_spectrum"

View file

@ -1,4 +1,4 @@
= form_for(district) do |f|
= form_for(district, as: 'district') do |f|
- if district.errors.any?
#error_explanation
%h2

View file

@ -1,4 +1,4 @@
= form_for(question_list) do |f|
= form_for(question_list, as: 'question_list') do |f|
- if question_list.errors.any?
#error_explanation
%h2
@ -17,6 +17,6 @@
= f.label :question_id_array, 'Questions'
%br/
.form-check.form-check-collection
= f.collection_check_boxes(:question_id_array, Question.all, :id, :text) { |c| c.label(class: 'form-check-label') { c.check_box(class: 'form-check-input') + " #{c.text}" } }
= f.collection_check_boxes(:question_id_array, Legacy::Question.all, :id, :text) { |c| c.label(class: 'form-check-label') { c.check_box(class: 'form-check-input') + " #{c.text}" } }
.form-group
= f.submit 'Save List', class: 'btn btn-primary'

View file

@ -2,4 +2,4 @@
= render 'form', question_list: @question_list
= link_to 'Show', @question_list
|
= link_to 'Back', question_lists_path
= link_to 'Back', legacy_question_lists_path

View file

@ -14,7 +14,7 @@
%td= question_list.description
%td= question_list.question_ids
%td= link_to 'Show', question_list
%td= link_to 'Edit', edit_question_list_path(question_list)
%td= link_to 'Edit', edit_legacy_question_list_path(question_list)
%td= link_to 'Destroy', question_list, method: :delete, data: { confirm: 'Are you sure?' }
%br/
= link_to 'New Question List', new_question_list_path
= link_to 'New Question List', new_legacy_question_list_path

View file

@ -7,9 +7,9 @@
= @question_list.description
%p
= link_to 'Edit', edit_question_list_path(@question_list)
= link_to 'Edit', edit_legacy_question_list_path(@question_list)
|
= link_to 'Back', question_lists_path
= link_to 'Back', legacy_question_lists_path
%br
%br

View file

@ -1,4 +1,4 @@
= form_for(question) do |f|
= form_for(question, as: 'question') do |f|
- if question.errors.any?
#error_explanation
%h2

View file

@ -1,6 +1,6 @@
- aggregated_responses = question.aggregated_responses_for_school(@school)
- return if aggregated_responses.nil?
- school_question = SchoolQuestion.for(@school, question).first
- school_question = Legacy::SchoolQuestion.for(@school, question).first
- valid_responses = school_question.nil? ? true : school_question.response_rate > 0.3 # || (aggregated_responses.count.to_f / @school.available_responders_for(question).to_f)) >= 0.3
.col-12.col-md-6.py-3
@ -11,7 +11,7 @@
- if valid_responses
.row.pt-2
.col-4.indicator-container.centered
= render 'school_categories/indicator', info: aggregated_responses, small: true
= render 'legacy/school_categories/indicator', info: aggregated_responses, small: true
.col-8
%p
@ -48,7 +48,7 @@
Raw Data
.collapse{id: "histogram#{question.id}"}
= render 'shared/histogram', data: aggregated_responses
= render 'legacy/shared/histogram', data: aggregated_responses
%p.collapse{id: "raw-data#{question.id}"}
= aggregated_responses.responses.map(&:answer_index_with_reverse).join(', ')

View file

@ -2,4 +2,4 @@
= render 'form', question: @question
= link_to 'Show', @question
|
= link_to 'Back', questions_path
= link_to 'Back', legacy_questions_path

View file

@ -22,7 +22,7 @@
%td= question.option5
%td= link_to(question.category.name, question.category)
%td= link_to 'Show', question
%td= link_to 'Edit', edit_question_path(question)
%td= link_to 'Edit', edit_legacy_question_path(question)
%td= link_to 'Destroy', question, method: :delete, data: { confirm: 'Are you sure?' }
%br/
= link_to 'New Question', new_question_path
= link_to 'New Question', new_legacy_question_path

View file

@ -1,3 +1,3 @@
%h1 New Question
= render 'form', question: @question
= link_to 'Back', questions_path
= link_to 'Back', legacy_questions_path

View file

@ -21,13 +21,13 @@
%strong Category:
 
- if @question.category.present?
= render partial: 'categories/full_path', locals: {category: @question.category}
= render partial: 'legacy/categories/full_path', locals: {category: @question.category}
- else
No Category
= link_to 'Edit', edit_question_path(@question)
= link_to 'Edit', edit_legacy_question_path(@question)
|
= link_to 'Back', questions_path
= link_to 'Back', legacy_questions_path
%br

View file

@ -1,4 +1,4 @@
= form_for([@school, @recipient_list]) do |f|
= form_for([@school, @recipient_list], as: 'recipient_list') do |f|
- if @recipient_list.errors.any?
#error_explanation
%h2

View file

@ -13,7 +13,7 @@
%td= recipient_list.description
%td= recipient_list.recipient_ids
%td= link_to 'Show', [recipient_list.school, recipient_list]
%td= link_to 'Edit', edit_school_recipient_list_path(recipient_list.school, recipient_list)
%td= link_to 'Edit', edit_legacy_school_legacy_recipient_list_path(recipient_list.school, recipient_list)
%td= link_to 'Destroy', [recipient_list.school, recipient_list], :confirm => 'Are you sure?', :method => :delete
%br/
= link_to 'New Recipient list', new_school_recipient_list_path(@school)
= link_to 'New Recipient list', new_legacy_school_legacy_recipient_list_path(@school)

View file

@ -1,6 +1,6 @@
%p
%b School:
= link_to @school.name, school_admin_path(@school)
= link_to @school.name, legacy_school_admin_path(@school)
%p
%b Name:
= @recipient_list.name
@ -9,13 +9,13 @@
= @recipient_list.description
%p
= link_to 'Edit', edit_school_recipient_list_path(@recipient_list.school, @recipient_list)
= link_to 'Edit', edit_legacy_school_legacy_recipient_list_path(@recipient_list.school, @recipient_list)
|
= link_to 'Back', @recipient_list.school
%br
%br
%p
%b Recipients:
- @recipient_list.recipients.each do |recipient|

View file

@ -1,4 +1,4 @@
= form_for([@school, recipient]) do |f|
= form_for([@school, recipient], as: 'recipient') do |f|
- if recipient.errors.any?
#error_explanation
%h2

View file

@ -0,0 +1,5 @@
%h1 Editing Recipient
= render 'form', recipient: @recipient
= link_to 'Show', legacy_school_legacy_recipient_path(@school, @recipient)
|
= link_to 'Back', legacy_school_path(@school)

View file

@ -1,7 +1,7 @@
.row
.offset-sm-2.col-sm-8
%h3 Import Recipients To This School
= form_tag import_school_recipients_path(@school), multipart: true do
= form_tag import_legacy_school_legacy_recipients_path(@school), multipart: true do
%br
.form-group
= file_field_tag :file, class: 'form-control-file'

View file

@ -26,8 +26,8 @@
%td= recipient.income
%td= recipient.opted_out
%td= recipient.school_id
%td= link_to 'Show', school_recipient_path(@school, recipient)
%td= link_to 'Edit', edit_school_recipient_path(@school, recipient)
%td= link_to 'Destroy', school_recipient_path(@school, recipient), method: :delete, data: { confirm: 'Are you sure?' }
%td= link_to 'Show', legacy_school_legacy_recipient_path(@school, recipient)
%td= link_to 'Edit', edit_legacy_school_legacy_recipient_path(@school, recipient)
%td= link_to 'Destroy', legacy_school_legacy_recipient_path(@school, recipient), method: :delete, data: { confirm: 'Are you sure?' }
%br/
= link_to 'New Recipient', new_school_recipient_path(@school)
= link_to 'New Recipient', new_legacy_school_legacy_recipient_path(@school)

View file

@ -2,7 +2,7 @@
.col
%p
%strong School:
= link_to @school.name, school_admin_path(@school)
= link_to @school.name, legacy_school_admin_path(@school)
%p
%strong Recipient:
= @recipient.name
@ -55,10 +55,9 @@
%strong Next Attempt At:
= recipient_schedule.next_attempt_at.in_time_zone('Eastern Time (US & Canada)').strftime('%m-%e-%y %H:%M')
= link_to 'Edit', edit_school_recipient_path(@school, @recipient)
= link_to 'Edit', edit_legacy_school_legacy_recipient_path(@school, @recipient)
|
= link_to 'Back', school_path(@school)
= link_to 'Back', legacy_school_path(@school)
%br

View file

@ -1,4 +1,4 @@
= form_for([@schedule.school, @schedule]) do |f|
= form_for([@schedule.school, @schedule], as: 'schedule') do |f|
- if @schedule.errors.any?
#error_explanation
%h2
@ -46,6 +46,6 @@
.form-group
= f.label :question_list_id
%br/
= f.collection_select :question_list_id, QuestionList.all, :id, :name, class: 'form-control'
= f.collection_select :question_list_id, Legacy::QuestionList.all, :id, :name, class: 'form-control'
.form-group
= f.submit 'Save Schedule', class: 'btn btn-primary'

View file

@ -2,4 +2,4 @@
= render 'form'
= link_to 'Show', [@schedule.school, @schedule]
|
= link_to 'Back', school_schedules_path(@schedule.school)
= link_to 'Back', legacy_school_legacy_schedules_path(@schedule.school)

View file

@ -7,7 +7,7 @@
= @schedule.description
%p
%b School:
= link_to(@school.name, school_admin_path(@school))
= link_to(@school.name, legacy_school_admin_path(@school))
%p
%b Frequency hours:
= frequency_description(@schedule.frequency_hours)
@ -30,6 +30,6 @@
%b Question list:
= link_to(@schedule.question_list.name, @schedule.question_list)
= link_to 'Edit', edit_school_schedule_path(@schedule.school, @schedule)
= link_to 'Edit', edit_legacy_school_legacy_schedule_path(@schedule.school, @schedule)
|
= link_to 'Back', school_schedules_path(@schedule.school)
= link_to 'Back', legacy_school_legacy_schedules_path(@schedule.school)

View file

@ -1,4 +1,4 @@
json.array!(@school_recipient_lists) do |school_recipient_list|
json.extract! school_recipient_list, :id, :name, :description, :recipient_ids
json.url school_recipient_list_url(school_recipient_list, format: :json)
json.url legacy_school_legacy_recipient_list_url(school_recipient_list, format: :json)
end

View file

@ -1,11 +1,11 @@
.col-12.col-sm-6.py-3
.school_category.short.p-2
%h4.title.text-center.pt-3
= link_to(school_category.category.name, school_category_path(school_category.school, school_category.category, year: school_category.year))
= link_to(school_category.category.name, legacy_school_legacy_category_path(school_category.school, school_category.category, year: school_category.year))
- if !school_category.new_record? && (school_category.school.district.name != "Boston" || (school_category.valid_child_count || 1) > 0)
.indicator-container.short
= render 'school_categories/indicator', info: school_category
= render 'legacy/school_categories/indicator', info: school_category
.description.px-2.pt-3.pb-2.mt-2
- if false #(measurements = school_category.questions.measurements.for_school(school_measure.school)).present?

View file

@ -1,4 +1,4 @@
= form_for(school) do |f|
= form_for(school, as: 'school') do |f|
- if school.errors.any?
#error_explanation
%h2

View file

@ -7,17 +7,17 @@
%strong District:
= @school.district_id
%p= link_to "Add Recipient", new_school_recipient_path(@school)
%p= link_to "Add Recipient", new_legacy_school_legacy_recipient_path(@school)
%p= link_to "Bulk Add Recipients", import_school_recipients_path(@school)
%p= link_to "Bulk Add Recipients", import_legacy_school_legacy_recipients_path(@school)
%p= link_to "Create Recipient List", new_school_recipient_list_path(@school)
%p= link_to "Create Recipient List", new_legacy_school_legacy_recipient_list_path(@school)
%p= link_to "Create A Question List", new_question_list_path()
%p= link_to "Create A Question List", new_legacy_question_list_path()
%p= link_to "Create A Schedule", new_school_schedule_path(@school)
%p= link_to "Create A Schedule", new_legacy_school_legacy_schedule_path(@school)
= link_to 'Edit', edit_school_path(@school)
= link_to 'Edit', edit_legacy_school_path(@school)
|
= link_to 'Back', root_path
@ -46,8 +46,8 @@
%td= link_to schedule.name, [@school, schedule]
%td= schedule.start_date
%td= schedule.end_date
%td= link_to('Edit', edit_school_schedule_path(@school, schedule))
%td= link_to('Delete', school_schedule_path(@school, schedule), method: :delete, data: {confirm: 'Are you sure you want to delete this schedule?'})
%td= link_to('Edit', edit_legacy_school_legacy_schedule_path(@school, schedule))
%td= link_to('Delete', legacy_school_legacy_schedule_path(@school, schedule), method: :delete, data: {confirm: 'Are you sure you want to delete this schedule?'})
%br
%br
@ -71,8 +71,8 @@
%tr.recipient
%td= link_to recipient_list.name, [@school, recipient_list]
%td= recipient_list.description
%td= link_to('Edit', edit_school_recipient_list_path(@school, recipient_list))
%td= link_to('Delete', school_recipient_list_path(@school, recipient_list), method: :delete, data: {confirm: 'Are you sure you want to delete this list?'})
%td= link_to('Edit', edit_legacy_school_legacy_recipient_list_path(@school, recipient_list))
%td= link_to('Delete', legacy_school_legacy_recipient_list_path(@school, recipient_list), method: :delete, data: {confirm: 'Are you sure you want to delete this list?'})
%br
%br
@ -100,8 +100,8 @@
%td= recipient.phone
%td= recipient.attempts_count
%td= recipient.responses_count
%td= link_to('Edit', edit_school_recipient_path(@school, recipient))
%td= link_to('Delete', school_recipient_path(@school, recipient), method: :delete, data: {confirm: 'Are you sure you want to delete this recipient?'})
%td= link_to('Edit', edit_legacy_school_legacy_recipient_path(@school, recipient))
%td= link_to('Delete', legacy_school_legacy_recipient_path(@school, recipient), method: :delete, data: {confirm: 'Are you sure you want to delete this recipient?'})
%br
%br
@ -111,7 +111,7 @@
%small
= link_to('show/hide', '#question_lists', data: {toggle: 'collapse'}, 'aria-expanded': 'false', 'aria-controls': 'collapseExample')
#question_lists.collapse
- if QuestionList.count == 0
- if Legacy::QuestionList.count == 0
%p
%strong None Yet
- else
@ -121,9 +121,9 @@
%th Name
%th Description
%th{colspan: 2} Actions
- QuestionList.all.each do |question_list|
- Legacy::QuestionList.all.each do |question_list|
%tr.question_list
%td= link_to question_list.name, question_list
%td= question_list.description
%td= link_to('Edit', edit_question_list_path(question_list))
%td= link_to('Delete', question_list_path(question_list), method: :delete, data: {confirm: 'Are you sure you want to delete this question list?'})
%td= link_to('Edit', edit_legacy_question_list_path(question_list))
%td= link_to('Delete', legacy_question_list_path(question_list), method: :delete, data: {confirm: 'Are you sure you want to delete this question list?'})

View file

@ -2,4 +2,4 @@
= render 'form', school: @school
= link_to 'Show', @school
|
= link_to 'Back', schools_path
= link_to 'Back', legacy_schools_path

View file

@ -3,4 +3,4 @@
%h3 Create A New School
= render 'form', school: @school
%br
%p= link_to 'Back', schools_path
%p= link_to 'Back', legacy_schools_path

View file

@ -24,4 +24,4 @@
.row
= render @school_categories.sort { |a, b| a.root_index <=> b.root_index }
= render "shared/performance_spectrum"
= render "legacy/shared/performance_spectrum"

View file

@ -16,4 +16,4 @@
- current_user.schools.each do |school|
%tr.school
%td= link_to school.name, school
%td= link_to('Admin', school_admin_path(school))
%td= link_to('Admin', legacy_school_admin_path(school))

View file

@ -1,5 +0,0 @@
%h1 Editing Recipient
= render 'form', recipient: @recipient
= link_to 'Show', school_recipient_path(@school, @recipient)
|
= link_to 'Back', school_path(@school)