concord-consortium / rigse

Concord Consortium Portal (somewhat like an LMS)
MIT License
9 stars 11 forks source link

Remove dependency on prototype #457

Open natevick opened 6 years ago

natevick commented 6 years ago

From @benjaminwood on April 10, 2018 0:0

Based on usage I have observed, this will be a large undertaking.

However, if the goal is to move the app forward/modernize it, then prototype has to go.

Copied from original issue: hintmedia/rigse#5

benjaminwood commented 6 years ago

Usage found by regex search

COUNT    | LINE
-----------------------------------------------------
      27 | remote_form_for
      14 | visual_effect
      12 | link_to_remote
       7 | link_to_function
       7 | sortable_element
       6 | drop_receiving_element
       4 | button_to_remote
       3 | draggable_element
       2 | observe_form
       1 | remote_function
-----------------------------------------------------
      83 | TOTAL

#remote_form_for

  - app/views/admin/clients/_remote_form.html.haml:1
  - app/views/admin/commons_licenses/_remote_form.html.haml:1
  - app/views/admin/external_reports/_remote_form.html.haml:1
  - app/views/admin/projects/_remote_form.html.haml:1
  - app/views/admin/settings/_remote_form.html.haml:1
  - app/views/admin/tags/_remote_form.html.haml:1
  - app/views/author_notes/_remote_form.html.haml:1
  - app/views/dataservice/blobs/_remote_form.html.haml:1
  - app/views/dataservice/bundle_contents/_remote_form.html.haml:1
  - app/views/dataservice/bundle_loggers/_remote_form.html.haml:1
  - app/views/dataservice/console_contents/_remote_form.html.haml:1
  - app/views/dataservice/console_loggers/_remote_form.html.haml:1
  - app/views/embeddable/image_questions/_remote_form.html.haml:1
  - app/views/embeddable/multiple_choices/_remote_form.html.haml:1
  - app/views/embeddable/open_responses/_remote_form.html.haml:1
  - app/views/external_activities/_basic_form.html.haml:1
  - app/views/external_activities/_remote_form.html.haml:1
  - app/views/materials_collections/_remote_form.html.haml:1
  - app/views/portal/clazzes/_remote_form.html.haml:1
  - app/views/portal/clazzes/_remote_form_student_roster.html.haml:1
  - app/views/portal/districts/_remote_form.html.haml:1
  - app/views/portal/grades/_remote_form.html.haml:1
  - app/views/portal/grade_levels/_remote_form.html.haml:1
  - app/views/portal/learners/_remote_form.html.haml:1
  - app/views/portal/schools/_remote_form.html.haml:1
  - app/views/portal/students/_register.html.haml:1
  - app/views/teacher_notes/_remote_form.html.haml:1

#visual_effect

  - app/controllers/author_notes_controller.rb:55
  - app/controllers/author_notes_controller.rb:60
  - app/controllers/author_notes_controller.rb:78
  - app/controllers/images_controller.rb:90
  - app/controllers/portal/clazzes_controller.rb:443
  - app/controllers/portal/students_controller.rb:393
  - app/controllers/portal/students_controller.rb:404
  - app/controllers/teacher_notes_controller.rb:46
  - app/controllers/teacher_notes_controller.rb:51
  - app/helpers/application_helper.rb:623
  - app/views/author_notes/_remote_form.html.haml:1
  - app/views/external_activities/create.js.rjs:17
  - app/views/external_activities/create.js.rjs:8
  - app/views/teacher_notes/_remote_form.html.haml:1

#link_to_remote

  - app/helpers/application_helper.rb:679
  - app/views/embeddable/multiple_choices/_remote_form.html.haml:29
  - app/views/home/_notice.html.haml:11
  - app/views/home/_notice.html.haml:38
  - app/views/home/_notice.html.haml:9
  - app/views/portal/bookmarks/_show.html.haml:4
  - app/views/portal/students/_table_for_clazz.html.haml:33
  - app/views/portal/teachers/_list_for_clazz.html.haml:15
  - app/views/search/_material_unassigned_clazzes.html.haml:95
  - app/views/search/_material_unassigned_collections.html.haml:88
  - app/views/shared/_page_header.html.haml:4
  - lib/clipboard.rb:84

#link_to_function

  - app/helpers/application_helper.rb:615
  - app/helpers/application_helper.rb:622
  - app/helpers/application_helper.rb:688
  - app/helpers/js_helper.rb:20
  - app/views/author_notes/_show.html.haml:7
  - app/views/shared/_activity_trail.html.haml:27
  - app/views/teacher_notes/_show.html.haml:7

#sortable_element

  - app/views/external_activities/_show.html.haml:6
  - app/views/materials_collections/_materials_in_collection.html.haml:23
  - app/views/shared/_accordion_nav.html.haml:34
  - app/views/shared/_accordion_nav.html.haml:35
  - app/views/shared/_general_accordion_nav.html.haml:62
  - app/views/shared/_general_accordion_nav.html.haml:64
  - app/views/shared/_offering_for_teacher.html.haml:26

#drop_receiving_element

  - app/views/portal/clazzes/edit_offerings.html.haml:14
  - app/views/portal/clazzes/edit_offerings.html.haml:15
  - app/views/portal/offerings/_list_for_clazz.html.haml:10
  - app/views/portal/offerings/_list_for_clazz.html.haml:11
  - app/views/portal/offerings/_list_for_clazz.html.haml:12
  - app/views/portal/offerings/_list_for_clazz.html.haml:13

#button_to_remote

  - app/helpers/portal/student_clazzes_helper.rb:42
  - app/helpers/portal/teachers_helper.rb:32
  - app/views/portal/bookmarks/generic_bookmark/_button.html.haml:1
  - app/views/portal/bookmarks/padlet_bookmark/_button.html.haml:1

#draggable_element

  - app/views/external_activities/_runnable_list.html.haml:45
  - app/views/shared/_runnable.html.haml:12
  - app/views/shared/_runnables_listing.html.haml:36

#observe_form

  - app/views/external_activities/index.html.haml:3
  - app/views/images/index.html.haml:3

#remote_function

  - app/helpers/application_helper.rb:203

Regex used to find the above usage:

egrep -won -R 'remote_function|update_page|update_page_tag|visual_effect|sortable_element|sortable_element_js|draggable_element|draggable_element_js|drop_receiving_element|drop_receiving_element_js|button_to_remote|submit_to_remote|link_to_remote|form_remote_tag|remote_form_for|form_remote_for|evaluate_remote_response|observe_field|observe_form|periodically_call_remote|button_to_function|link_to_function|remote_function|update_page|update_page_tag' ./

Last week we implemented some code that deprecates relevant prototype helper methods: https://github.com/concord-consortium/rigse/pull/561

Deprecation warnings generated by the test suite (~50% of total):

COUNT    | LINE
-----------------------------------------------------
       8 | link_to_remote
       8 | remote_form_for
       7 | remote_function
       5 | sortable_element
       4 | link_to_function
       3 | update_page
       2 | button_to_remote
       1 | button_to_function
       1 | form_remote_tag
       1 | observe_form
       1 | sortable_element_js
       1 | visual_effect
-----------------------------------------------------
      42 | TOTAL
benjaminwood commented 6 years ago

Additionally, we have identified usage or RJS (be it in .rjs files or controllers):

#page.replace_html

  - app/controllers/author_notes_controller.rb:54
  - app/controllers/author_notes_controller.rb:59
  - app/controllers/materials_collections_controller.rb:119
  - app/controllers/portal/clazzes_controller.rb:399
  - app/controllers/portal/clazzes_controller.rb:402
  - app/controllers/portal/clazzes_controller.rb:405
  - app/controllers/portal/clazzes_controller.rb:442
  - app/controllers/portal/clazzes_controller.rb:444
  - app/controllers/portal/clazzes_controller.rb:447
  - app/controllers/portal/clazzes_controller.rb:485
  - app/controllers/portal/clazzes_controller.rb:489
  - app/controllers/portal/clazzes_controller.rb:618
  - app/controllers/portal/clazzes_controller.rb:619
  - app/controllers/portal/students_controller.rb:167
  - app/controllers/portal/students_controller.rb:170
  - app/controllers/search_controller.rb:230
  - app/controllers/search_controller.rb:241
  - app/controllers/search_controller.rb:256
  - app/controllers/search_controller.rb:276
  - app/controllers/search_controller.rb:279
  - app/controllers/search_controller.rb:98
  - app/controllers/teacher_notes_controller.rb:45
  - app/controllers/teacher_notes_controller.rb:50
  - app/helpers/application_helper.rb:624
  - app/views/portal/school_selector/update.rjs:1
  - app/views/portal/student_clazzes/destroy.js.rjs:12
  - app/views/portal/student_clazzes/destroy.js.rjs:6
  - app/views/portal/student_clazzes/destroy.js.rjs:9

#page.remove

  - app/controllers/portal/bookmarks_controller.rb:63
  - app/controllers/portal/students_controller.rb:391
  - app/controllers/portal/students_controller.rb:399
  - app/views/embeddable/image_questions/destroy.js.rjs:3
  - app/views/embeddable/multiple_choices/destroy.js.rjs:3
  - app/views/embeddable/open_responses/destroy.js.rjs:3
  - app/views/images/destroy.rjs:1
  - app/views/portal/clazzes/destroy.js.rjs:3
  - app/views/portal/clazzes/destroy.js.rjs:7
  - app/views/portal/districts/destroy.js.rjs:7
  - app/views/portal/schools/destroy.js.rjs:7
  - app/views/portal/student_clazzes/destroy.js.rjs:3

#page.insert_html

  - app/controllers/images_controller.rb:89
  - app/controllers/portal/bookmarks_controller.rb:25
  - app/controllers/portal/bookmarks_controller.rb:44
  - app/controllers/portal/clazzes_controller.rb:324
  - app/controllers/portal/clazzes_controller.rb:357
  - app/controllers/portal/students_controller.rb:392
  - app/controllers/portal/students_controller.rb:400
  - app/views/embeddable/multiple_choices/add_choice.js.rjs:1
  - app/views/external_activities/create.js.rjs:16
  - app/views/external_activities/create.js.rjs:4

#page.replace

  - app/controllers/portal/clazzes_controller.rb:407
  - app/controllers/portal/clazzes_controller.rb:445
  - app/controllers/portal/clazzes_controller.rb:490
  - app/controllers/portal/students_controller.rb:172
  - app/views/portal/student_clazzes/destroy.js.rjs:15

#page.show

  - app/controllers/portal/bookmarks_controller.rb:65

#page.sortable

  - app/views/external_activities/create.js.rjs:9

#page.reload

  - spec/models/page_spec.rb:40

#page.redirect_to

  - app/views/external_activities/destroy.js.rjs

Regex used to perform this search:

egrep -won -R 'page\.(literal|select|insert_html|replace_html|replace|remove|show|hide|toggle|alert|redirect_to|reload|call|assign|delay|visual_effect|sortable|draggable|drop_receiving)' ./

Summary of .rjs files:

benjaminwood commented 6 years ago

@scytacki I think this covers the usage of prototype/rjs that we need to worry about. Does it appear complete to you? Any known usage that we have not accounted for here? Let me know.

The next step will be to discuss how we're going to replace/handle each scenario.

benjaminwood commented 6 years ago

Also found some usage of page << content like the following that will need to be addressed:

https://github.com/concord-consortium/rigse/blob/c43b8ab53e71d64c6e2083eb9859190b94fa7ac4/app/controllers/portal/students_controller.rb#L157-L173

emilywatkins commented 6 years ago

FYI, I'm creating a series of issues labeled prototype separated by location/action rather than usage type