To wrap up this week’s refactoring of IssuesController, I used merge method to merge the #update_form action into #new. The #update_form method is an Ajax endpoint that is used to refresh an issue form’s fields. For example, when an issue form changes from Bug to Feature it needs to load the fields for a Feature. …
Redmine Refactor #95: Extract ContextMenusController from IssuesController
Using extract class on the IssuesController, I was able to create another controller called ContextMenusController. This controller will handle Redmine’s right click context menu that is used on the issues list. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 …
Redmine Refactor #94: Extract PreviewsController from IssuesController
Today I used extract class on IssuesController once again, this time to create PreviewsController. For the same reasons as yesterday, putting all of the preview actions together into a single controller will make things easier to maintain and might even give me some code reuse. Before 1 2 3 4 5 6 7 8 9 …
Redmine Refactor #93: Extract Controller from IssuesController
Continuing on the IssuesController refactoring, I used extract class to create a new controller for the #auto_complete action. This action is used to search for issues that match the text from a user. Redmine has several auto_complete actions scattered throughout different controllers that I’ve been wanting to unite into a single controller. Now AutoCompletesController can …
Redmine Refactor #92: Move Method #reply to JournalsController
Looking over the public methods in IssuesController now, I see that the #reply method is out of place. It’s used to quote a new reply on an issue but it does this via a journal. Since Redmine already has a JournalsController that is used when a journal is edited, it makes more sense to move …