{"id":15883141,"url":"https://github.com/bfollington/pillar","last_synced_at":"2025-04-02T06:11:00.148Z","repository":{"id":26448715,"uuid":"29899776","full_name":"bfollington/pillar","owner":"bfollington","description":"An extension layer built on Backbone, developed alongside personal projects","archived":false,"fork":false,"pushed_at":"2015-02-28T07:32:58.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T20:30:55.914Z","etag":null,"topics":["backbone","do-not-use","retired"],"latest_commit_sha":null,"homepage":null,"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/bfollington.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":"2015-01-27T05:55:57.000Z","updated_at":"2017-03-07T00:45:58.000Z","dependencies_parsed_at":"2022-08-29T14:31:30.718Z","dependency_job_id":null,"html_url":"https://github.com/bfollington/pillar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfollington%2Fpillar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfollington%2Fpillar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfollington%2Fpillar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfollington%2Fpillar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfollington","download_url":"https://codeload.github.com/bfollington/pillar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763943,"owners_count":20829799,"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","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":["backbone","do-not-use","retired"],"created_at":"2024-10-06T04:08:38.324Z","updated_at":"2025-04-02T06:10:59.794Z","avatar_url":"https://github.com/bfollington.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pillar\nAn extension layer built on Backbone.js, `pillar` provides extended functionality for handling views and templating.\n\n## Views\n\nThe primary function of pillar is to enable full extension of views, normally in backbone extending a view does not merge the events of the subclass with the superclass. Nor do the initialize functions stack.\n\n```javascript\n    Pillar.BaseTestView = Pillar.View.extend({\n\n        init: function(opts)\n        {\n            console.log(\"Base INIT\");\n        },\n\n        events: {\n            \"click\": \"helloWorld\"\n        },\n\n        helloWorld: function(e)\n        {\n            console.log(\"Hello World\");\n        }\n    });\n\n    Pillar.TestView = Pillar.BaseTestView.extend({\n\n        init: function(opts)\n        {\n            // implicit super.init(opts);\n            console.log(\"INIT\");\n        },\n\n        events: { // inherits \"click\": \"helloWorld\"\n            \"click .all\": \"whatUp\"\n        },\n\n        whatUp: function(e)\n        {\n            console.log(\"What Up!\");\n        }\n    });\n\n    Pillar.ExtendedTestView = Pillar.TestView.extend({\n        init: function(opts)\n        {\n            // implicit super.super.init(opts);\n            // implicit super.init(opts);\n            console.log(\"Child INIT\");\n        }\n        \n        // inherits events: { \n        //    \"click\": \"helloWorld\",\n        //    \"click .all\": \"whatUp\"\n        //},\n    });\n```\n\n`Pillar.ExtendedTestView` has the events: `{\"click\": \"helloWorld\", \"click .all\": \"whatUp\"}`, and when it is initialized \"Base INIT\", \"INIT\" and \"Child INIT\" will print, in that order.\n\nTo accomplish view extension, pillar expects you to use `init` and `draw` to extend, rather than `initialize` and `render`.\n\nTo override this behaviour, `initialize` and `render` can also be overridden to allow full customisation.\n\n### Collection Views\n\nPillar provides `CollectionView`s which allow simple management of subviews.\n\n## Templating\n\nPillar allows a declarative syntax for populating your html templates.\n\n```html\n    \u003cdiv data-pillar=\"id\u003c-id\"\u003e\n        \u003ca data-pillar=\"href\u003c-link, text\u003c-title\"\u003e\u003c/a\u003e\n    \u003c/div\u003e\n```\n\nRendering this using `{id: 123, link: \"http://google.com\", title: \"Google\"}`, gives:\n\n```html\n    \u003cdiv id=\"123\"\u003e\n        \u003ca href=\"http://google.com\"\u003eGoogle\u003c/a\u003e\n    \u003c/div\u003e\n```\n\nTemplates support JSON Objects or actual Backbone models being passed. You can bind either attributes on the model object, or methods. Providing `{ id: function() { return Math.random(); } }` will actually evaluate the id function on render.\n\nThe templating system is drop-in, and I tend to use it as so:\n\n```javascript\n    //Global\n    Pillar.Templates.register(\"my_template\", $(\"#my_template\").html());\n\n    // In the view\n    template: Pillar.Templates.get(\"my_template\"),\n\n    draw: function(opts)\n    {\n        var html = this.renderTemplate(this.template, this.model);\n        this.replaceElement(html);\n    }\n```\n\n## Dependencies\n\nPillar depends on `jquery`, `backbone` and `underscore`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfollington%2Fpillar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfollington%2Fpillar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfollington%2Fpillar/lists"}