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 …
Tag: refactoring
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 …
Redmine Refactor #91: Pull Up set_flash_from_bulk_issue_save to ApplicationController
This is the final refactoring I want to do on IssueMovesController for now. Using pull up method, I moved the last duplicated method from IssueMovesController to ApplicationController. Before 1 2 3 4 5 6 class IssuesController unsaved_issue_ids.size, :total => issues.size, :ids => '#' + unsaved_issue_ids.join(', #')) end end endclass IssuesController unsaved_issue_ids.size, :total => issues.size, :ids …
Redmine Refactor #90: Pull Up Method to ApplicationController
Now, in order to finish up IssueMovesController, I need to refactor the duplicated methods that I copied from IssuesController. Pull up method is a great refactoring to use in this case. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class IssuesController < ApplicationController # Filter …