示例#1
0
文件: view.js 项目: Legislatura/demos
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();
}
示例#2
0
文件: view.js 项目: Docworld/app
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]);
}
示例#3
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);
}
示例#4
0
文件: view.js 项目: Docworld/app
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');
  });
}
示例#5
0
文件: proto.js 项目: 89berner/app
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();
}
示例#6
0
文件: header.js 项目: Arduinology/app
HeaderView.prototype.switchOn = function() {
  snapper(this.el);
  citizen.on('loaded', this.refresh);
  citizen.on('unloaded', this.refresh);
  // setTimeout(feedback.bind, 0);
}
示例#7
0
文件: feedback.js 项目: 3manuek/app
Feedback.prototype.onCitizen = function() {
  uservoice.user();
  citizen.on('loaded', this.refresh);
  citizen.on('unloaded', this.refresh);
};