Phase 2: Split names_controller into smaller controllers (rebased)#259
Open
lmrodriguezr wants to merge 5 commits into
Open
Phase 2: Split names_controller into smaller controllers (rebased)#259lmrodriguezr wants to merge 5 commits into
lmrodriguezr wants to merge 5 commits into
Conversation
| def observe | ||
| @name.add_observer(current_user) | ||
| if params[:from] && RedirectSafely.safe?(params[:from]) | ||
| redirect_to(params[:from]) |
| def unobserve | ||
| @name.observers.delete(current_user) | ||
| if params[:from] && RedirectSafely.safe?(params[:from]) | ||
| redirect_to(params[:from]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements Phase 2 of the code reorganization plan for the SeqCode Registry. It splits the large
names_controller.rbinto smaller, focused controllers under theNames::namespace, improving maintainability and readability. This is a rebased version of PR #258, ensuring it is up-to-date with the latest changes inmain.📌 Changes Made
1. New Base Controller
app/controllers/names/base_controller.rb: Contains shared logic,before_actions, and private methods used by allNames::controllers. This includes:authenticate_can_edit!,authenticate_owner_or_curator!).set_name,set_tutorial).name_params,change_status,add_automatic_correspondence).2. New Split Controllers
All new controllers inherit from
Names::BaseControllerand handle specific groups of actions:Names::MainControllerindex,show,new,create,update,destroy,autocompleteNames::FilteringControlleruser,submitted,endorsed,draft,unranked,unknown_proposal,type_genomesNames::PublicationsControllerproposed_in,not_validly_proposed_in,emended_in,assigned_in,corrigendum_in,corrigendumNames::StatusControllerreturn,validate,endorse,claim,unclaim,demote,temporary_editableNames::UserActionsControllertransfer_user,transfer_user_commit,observe,unobserve,new_correspondenceNames::NetworkControllernetworkNames::WikiControllerwikiNames::UtilityControllerautocomplete,linkout,etymology_sandbox,syllabify,quality_checksNames::EditingControlleredit,edit_description,edit_notes,edit_rank,edit_links,edit_type,edit_redirect,autofill_etymology,edit_etymology,edit_parent3. Updated Routes
config/routes.rbfile has been updated to explicitly map actions to their respective controllers using thecontroller:option.index,show,new,create) are mapped toNames::MainControllerviacontroller: 'names/main'.submitted,validate) are explicitly mapped to their respective controllers (e.g.,controller: 'names/filtering').4. Removed Original Controller
app/controllers/names_controller.rbhas been deleted as it has been fully replaced by the newNames::controllers.🎯 Goals Achieved
names_controller.rb(500+ lines) is now split into smaller, focused controllers (~50-100 lines each).Names::BaseController.🔜 Next Steps
FastJSONAPI) for consistency./v1/names) and add request specs for all endpoints.📚 Related Issues/PRs
names_controller.rbfile.Reviewers: Please focus on the new controller structure and route mappings. The changes are backward-compatible and do not break existing functionality.