Opened 9 years ago
Last modified 3 years ago
#15112 assigned enhancement
Application-Controller-Pattern: Provide an example for shared methods of different page-level controllers
Reported by: | Paul Christopher | Owned by: | dylan |
---|---|---|---|
Priority: | low | Milestone: | 1.14 |
Component: | Documentation | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Description
The tutorial on the application controller pattern (http://dojotoolkit.org/documentation/tutorials/1.7/recipes/app_controller/) is a very good and helpful one. I tried to use it in my first project so as to improve code structure and readability. But soon I came up with one limitation of that pattern: My application consists of several pages (and thus several separate page-level controllers). However there are some functions/methods which are always the same on each page (e.g. for initialization of the top navigation). I.e.: There are some "static" methods shared by all controllers. At the moment I have copied and pasted these functions. But that is surely not the way to go: If I have to change the code, I need to change it in all controllers.
Solution
Yet unclear - for me as Dojo newbie - how to implement this. I tried to introduce a _BaseController class, and all page controllers inherit from this base controller class now. This gives me the full power of class inheritance and the usual way to call functions (using this.myFunc() instead of just myFunc()).
Attachments (1)
Change History (7)
Changed 9 years ago by
Attachment: | [CLA][ENHANCEMENT]applicationController.js added |
---|
comment:1 Changed 9 years ago by
Owner: | set to Sam Foster |
---|---|
Status: | new → assigned |
comment:2 Changed 5 years ago by
Milestone: | tbd → 1.11 |
---|---|
Owner: | changed from Sam Foster to dylan |
comment:3 Changed 5 years ago by
Priority: | undecided → low |
---|
I hope to get to this ticket in time for 1.11 (setting a deadline of end of January). If not, this will get moved to 1.12.
comment:4 Changed 5 years ago by
Milestone: | 1.11 → 1.12 |
---|
Ok, after massive triage, ended up with about 80 tickets for 1.11 and 400 or so for 1.12. That's a bit unrealistic, so first I changed all 1.12 to 1.13 (with the plan to move some forward to the new 1.12. Now, I'm moving some of the 1.11 tickets that are less likely to get done this month without help to 1.11. Feel free to help out in January if you want to see this ticket land in 1.11.
comment:5 Changed 4 years ago by
Milestone: | 1.12 → 1.13 |
---|
Ticket planning... move current 1.12 tickets out to 1.13 that likely won't get fixed in 1.12.
comment:6 Changed 3 years ago by
Milestone: | 1.13 → 1.14 |
---|
Assigning to Sam since he wrote that tutorial.