function BillProposalViewer(lawId) { View.call(this, template); this.lawId = lawId; this.bills = []; this.selected = null; this.progressContainer = this.find('div.progress-container'); this.progress = new Progress('#00708f'); this.progressContainer.append(this.progress.element); this.onlawsload = this.onlawsload.bind(this); this.refresh = this.refresh.bind(this); this.reload = this.reload.bind(this); this.add = this.add.bind(this); laws.on('loaded', this.onlawsload); //TODO: make all this dependent on `bus` when making views reactive in #284 // This should fetch stuff again from backend so voted stuff is updated citizen.on('loaded', this.refresh); citizen.on('unloaded', this.refresh); this.refresh(); }
CommentsFilter.prototype.switchOn = function() { bus.on('page:change', this.bound('switchOff')); this.bind('click', 'li a', 'onsortclick'); this.on('change', this.bound('onsortchange')); citizen.on('load', this.bound('refresh')); var dropdownBtn = this.find('.btn'); this.dropdown = new ToggleParent(dropdownBtn[0]); }
function LawsFilter() { if (!(this instanceof LawsFilter)) { return new LawsFilter(); }; this.reset = this.reset.bind(this); this.fetch = this.fetch.bind(this); this.refresh = this.refresh.bind(this); this.onlawsready = this.onlawsready.bind(this); this.state('initializing'); this.initialize(); laws.on('loaded', this.onlawsready) //TODO: make all this dependent on `bus` when making views reactive in #284 citizen.on('loaded', this.refresh); citizen.on('unloaded', this.reset); }
HeaderView.prototype.switchOn = function() { var self = this; snapper(this.el); if (isMobile()) { this.headroomBrowser = initHeadroom('#browser'); this.headroomContent = initHeadroom('#content'); } citizen.on('loaded', function () { var userBadge = new UserBadge(); userBadge.replace(self.user); self.el.find('.anonymous-citizen').addClass('hide'); }); citizen.on('unloaded', function () { self.user.empty(); self.el.find('.anonymous-citizen').removeClass('hide'); }); }
function Laws() { if (!(this instanceof Laws)) { return new Laws(); }; // instance bindings this.middleware = this.middleware.bind(this); this.fetch = this.fetch.bind(this); this.state('initializing'); // Re-fetch laws on citizen sign-in citizen.on('loaded', this.fetch); this.fetch(); }
HeaderView.prototype.switchOn = function() { snapper(this.el); citizen.on('loaded', this.refresh); citizen.on('unloaded', this.refresh); // setTimeout(feedback.bind, 0); }
Feedback.prototype.onCitizen = function() { uservoice.user(); citizen.on('loaded', this.refresh); citizen.on('unloaded', this.refresh); };