{"id":26722935,"url":"https://github.com/useallfive/marionette.enhancedcontroller","last_synced_at":"2025-10-09T01:12:02.634Z","repository":{"id":18536598,"uuid":"21737342","full_name":"UseAllFive/marionette.enhancedController","owner":"UseAllFive","description":"Extend Marionette.Controller to allow for region management and debugging.","archived":false,"fork":false,"pushed_at":"2014-08-22T15:21:31.000Z","size":756,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-10-09T01:07:54.561Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UseAllFive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-11T13:38:13.000Z","updated_at":"2017-03-08T02:44:25.000Z","dependencies_parsed_at":"2022-08-31T00:00:42.466Z","dependency_job_id":null,"html_url":"https://github.com/UseAllFive/marionette.enhancedController","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/UseAllFive/marionette.enhancedController","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UseAllFive%2Fmarionette.enhancedController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UseAllFive%2Fmarionette.enhancedController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UseAllFive%2Fmarionette.enhancedController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UseAllFive%2Fmarionette.enhancedController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UseAllFive","download_url":"https://codeload.github.com/UseAllFive/marionette.enhancedController/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UseAllFive%2Fmarionette.enhancedController/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000722,"owners_count":26082894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-27T20:38:21.135Z","updated_at":"2025-10-09T01:12:02.595Z","avatar_url":"https://github.com/UseAllFive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# marionette.enhancedController\n\nBrought to you by [Use All Five, Inc.](http://www.useallfive.com)\n\n```\nAuthor: Justin Anastos \u003cjanastos@useallfive.com\u003e\nAuthor URI: [http://www.useallfive.com](http://www.useallfive.com)\nRepository: https://github.com/UseAllFive/marionette.enhancedController\n```\n\nExtend `Marionette.Controller` in place to allow for region management and\ndebugging.\n\nMany thanks to [Brian Mann](https://github.com/brian-mann)'s [Backbone Rails: Loading\nViews](http://www.backbonerails.com/screencasts/loading-views) for the logic\nand the base code used to create this module.\n\n[Annotated Source](http://useallfive.github.io/marionette.enhancedController/marionette.enhancedController.html)\n\n## Installation\n\n- Include `lib/marionette.enhancedController.js` before any\n  `Marionette.Controllers` are used\n\n  The original `Marionette.Controller` will be modified and\n  `Marionette.Controller` will be set to the modified version. This will\n  work in place as long as you include this file before any\n  `Marionette.Controller`s are defined.\n\n- Optional: Include css to render the\nloading views. Example:\n\n  ```css\n  .loading-container {\n      min-height: 200px;\n      position: relative;\n      width: 100%;\n  }\n\n  .loading-container \u003e .spinner {\n      left: 50% !important;\n      position: absolute !important;\n      top: 50% !important;\n  }\n```\n\n## Usage\n\n### Region Management\n\nWhenever you create a `Marionette.Controller` instance, pass it a `region`\noption that specifies the `Marionette.Region` you wish to draw your\ncontroller's view on. In the controller, call `this.show(yourView)` (usually\nin the `initialize` function) to display `yourView` in the specified\n`region`. When the view is removed, the controller will automatically be\nclosed.\n\nNote: As of Marionette v2, you cannot show views that have been shown and\nremoved. Keep this in mind.\n\n```js\nvar Controller\nvar controller;\n\n// Define controller\nController = Marionette.Controller.extend({\n  initialize: function() {\n    // Instantiate a view\n    var view = new Marionette.ItemView({ ... });\n\n    // Show the view\n    this.show(view);\n  }\n});\n\n// Instantiate controller\ncontroller = new Controlller({\n  region: yourRegion\n});\n```\n\n### Loading Views\nIf you would like to show a loading view while entities load, add the\nfollowing option to the `.show` command inside the controller:\n\n```js\nthis.show(view, {\n    loading: true\n});\n```\n\n*Note*: You **must** have attached the entities `model`s and `collection`s\nto the view you want to show and have executed `fetch` on them before\ncalling `this.show()` or the loading view will not know what to wait for.\n\n#### Custom Entities\n\nThe loading view will automatically wait for any models or controllers that\nhave had `fetch` run on them to load and then will display the original\nview. You can manually specify the entities that must load, but they must\nall have had `fetch` run on them already:\n\n```js\n// Single entity\nvar model = new Backbone.Model({ ... });\nmodel.fetch();\n\nthis.show(view, {\n    entities: model,\n    loading: true,\n    loadingType: 'opacity'\n});\n\n// Multiple entities\nvar model1 = new Backbone.Model({ ... });\nvar model2 = new Backbone.Model({ ... });\nmodel1.fetch();\nmodel2.fetch();\n\nthis.show(view, {\n    entities: [model1, model2],\n    loading: true,\n    loadingType: 'opacity'\n});\n```\n\n#### Opacity Loading View\nThe default loading view is a spinner (spinjs), but can be customized to show\nthe original view with an opacity of 0.5 instead:\n\n```js\nthis.show(view, {\n    loading: true,\n    loadingType: 'opacity'\n});\n```\n\n### Debugging\nFrom the console, you can view the `Marionette.Controller`s that have been\ncreated by looking at `Marionette.Controller._registry`. To verify that\ncontrollers that have been instiated in the lifetime of the application,\ncall `Marionette.Controller._resetRegistry()`. This will attempt to close\ndown all controllers in the registry. If they are not removed from the\nregistry (their close was not captured), then you have a memory leak.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseallfive%2Fmarionette.enhancedcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuseallfive%2Fmarionette.enhancedcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseallfive%2Fmarionette.enhancedcontroller/lists"}