var WallHeaderView = module.exports = function (opts) {
  View.apply(this, arguments);
  opts = this.opts = opts || {};

  /**
   * Whether the button should be forced to render or not.
   * @type {boolean}
   * @private
   */
  this._forceButtonRender = !!opts.forceButtonRender;

  /**
   * The post button.
   * @type {?InputButton}
   * @private
   */
  this._postButton = opts.postButton ? this._createPostButton(opts.postButton) : null;

  /**
   * @type {boolean}
   * @private
   */
  this._rendered = false;

  if (opts.collection) {
    this.setCollection(opts.collection);
  }
};
/**
 * Dropdown encapulates a clickable element and a popover.
 * @param {function} opts.followButton
 * @param {Object.<string, string>} opts.tags
 */
function Dropdown(opts) {
    View.apply(this, arguments);
    this._button = this._createButton();
    this._popover = null;
    this._innerEl = document.createElement('div');
    this._innerEl.classList.add('lf-follow-dropdown');
}
示例#3
0
文件: panel.js 项目: 1Jamie/gaia
/**
 * A Panel is a "full screen" style tab/dialog.  Panels have an active state
 * which can be true or false, and can transition in and out using CSS3
 * classes and animation events.
 *
 * @constructor
 * @param {HTMLElement} element The element to wrap.
 */
function Panel(element) {
  View.apply(this, arguments);
  priv.set(this, {
    active: element.classList.contains('active'),
    transition: false
  });
  element.addEventListener('animationend', this);
}
示例#4
0
function AccountDetail(options) {
  View.apply(this, arguments);

  this.accountStore = this.app.store('Account');
  this.calendarStore = this.app.store('Calendar');
  this.accountId = null;
  this.count = 0;
}
示例#5
0
function Settings(options) {
  View.apply(this, arguments);

  this.calendarList = {};
  this._hideSettings = this._hideSettings.bind(this);
  this._onDrawerTransitionEnd = this._onDrawerTransitionEnd.bind(this);
  this._updateTimeouts = Object.create(null);

  this._observeUI();
}
var WallHeaderView = module.exports = function (opts) {
    View.apply(this, arguments);
    opts = opts || {};
    this._rendered = false;
    this._postButton = opts.postButton ?
        this._createPostButton(opts.postButton) : null;
    if (opts.collection) {
        this.setCollection(opts.collection);
    }
};
            SubView = function (opts) {
                if (!opts || !opts.noTemplate) {
                    this.template = function () {
                        return '<div></div>';
                    };
                }

                View.apply(this, arguments);
                LaunchableModal.apply(this, arguments);
            };
示例#8
0
function EventBase(options) {
  View.apply(this, arguments);

  this.store = core.storeFactory.get('Event');

  this._els = Object.create(null);
  this._changeToken = 0;

  this.cancel = this.cancel.bind(this);
  this.primary = this.primary.bind(this);
  this._initEvents();
}
示例#9
0
function TimeHeader() {
  View.apply(this, arguments);
  this.controller = core.timeController;
  this.controller.on('scaleChange', this);

  this.element.addEventListener('action', (e) => {
    e.stopPropagation();
    var path = window.location.pathname;
    if (SETTINGS.test(path)) {
      router.resetState();
    } else {
      router.show('/settings/');
    }
  });
}
示例#10
0
function ModifyAccount(options) {
  View.apply(this, arguments);

  this.deleteRecord = this.deleteRecord.bind(this);
  this.cancel = this.cancel.bind(this);
  this.displayOAuth2 = this.displayOAuth2.bind(this);
  this.hideHeaderAndForm = this.hideHeaderAndForm.bind(this);
  this.cancelDelete = this.cancelDelete.bind(this);

  this.accountHandler = new AccountCreation(this.app);
  this.accountHandler.on('authorizeError', this);

  // bound so we can add remove listeners
  this._boundSaveUpdateModel = this.save.bind(this, { updateModel: true });
}
示例#11
0
function AdvancedSettings(options) {
  View.apply(this, arguments);
  this.settingStore = this.app.store('Setting');
  this._initEvents();
  this.initHeader();

  this.dbListener = this.app.dbListener;
  this.allAccounts = this.dbListener.getAllAccounts();
  this.allCalendars = this.dbListener.getAllCalendars();
  this._renderCalendarSelector();
  this.dbListener.on('calendar-change', (calendars) => {
    this.allCalendars = calendars;
    this._renderCalendarSelector();
  });
  this.dbListener.on('account-change', (accounts) => {
    this.allAccounts = accounts;
    this._renderCalendarSelector();
  });
}
function FollowButton(opts) {
    var self = this;
    View.apply(this, arguments);
    opts = opts || {};
    opts.label = opts.label || 'follow';
    this.subscription = opts.subscription;
    this._button = new Button(createFollowCommand(opts.subscription));
    this._follow = opts.follow || function (subscription, errback) { errback(); };
    this._unfollow = opts.unfollow || function (subscription, errback) { errback(); };
    this.setFollowing(false);
    if (typeof opts.isFollowing === 'function') {
        opts.isFollowing(this.subscription, function (err, isFollowing) {
            console.log('checked isFollowing on FollowButton create', isFollowing, opts.subscription);
            self.setFollowing(isFollowing);
        })
    }
    this._button.$el.addClass('lf-btn-default');
    this._button.$el.addClass('lf-btn-xs');
};
function TagsHeaderView(tags) {
    View.apply(this, arguments);
    this.tags = tags;
    var followButtonFactory = new FollowButtonFactory();
    function createDropdown(tags) {
        var dropdown = new FollowButtonDropdown({
            followButton: function () {
                var el = followButtonFactory.create.apply(followButtonFactory, arguments);
                return el;
            },
            tags: tags
        });
        dropdown.render();
        dropdown.$el.addClass('lf-tags-header-view-follow')
        dropdown._button.$el.addClass('lf-btn-primary lf-btn-xs');
        return dropdown.el;
    }
    this._dropdown = createDropdown(tags);
};
示例#14
0
文件: month.js 项目: xifeiwu/calendar
function Month() {
  View.apply(this, arguments);
  this.frames = new Map();
  window.addEventListener('localized', this);
  this.datePicker = document.getElementById('month-view-date-picker');
  this.datePicker.addEventListener('input', function(evt) {
    this._goToDay('selected-day', new Date(evt.target.value));
  }.bind(this));
  this.datePicker.addEventListener('blur', function(evt) {
    this._getCurFocus().focus();
    this.datePicker.setAttribute('tabindex', '-1');
  }.bind(this));

  // XXX: disable sync function for now
  if (this.app.isOnlineModificationEnable()) {
    // get and observe syncFrequency to determine
    // whether to show 'Sync Calendar' or not
    this.needShowSyncCalendar = false;
    var setting = this.app.store('Setting');
    setting.getValue('syncFrequency', function(err, value) {
      if (!err && (value === 0)) {
        this.needShowSyncCalendar = true;
      } else {
        this.needShowSyncCalendar = false;
      }
    }.bind(this));
    setting.on('syncFrequencyChange', function(syncFreq) {
      if (syncFreq === 0) {
        this.needShowSyncCalendar = true;
      } else {
        this.needShowSyncCalendar = false;
      }
    }.bind(this));
  } else {
    this.needShowSyncCalendar = false;
  }

  this._keyDownHandler = this._keyDownEvent.bind(this);
}
示例#15
0
文件: view.js 项目: Livefyre/view
 function ParentView () {
     View.apply(this, arguments);
 }
示例#16
0
文件: time_parent.js 项目: 4gh/gaia
/**
 * Parent view for busytime-based views
 * (month, week, day) contains basic
 * handlers for purging frames, panning, etc...
 *
 * Each "child" must be added to frames.
 * Each child must be identified by some id.
 *
 * Child classes are expected to have "create"
 * method and "destroy" methods for adding &
 * removing them from the dom.
 */
function TimeParent() {
  View.apply(this, arguments);
  this.frames = new OrderedMap();
  this._initEvents();
}
示例#17
0
文件: view.js 项目: Livefyre/view
 ViewWithEvents = function () {
     this.clickedEls = [];
     View.apply(this, arguments);
 };
示例#18
0
文件: view.js 项目: Livefyre/view
 var ClassyView = function () {
     View.apply(this, arguments);
 };
示例#19
0
文件: view.js 项目: Livefyre/view
 function MyView () {
     View.apply(this, arguments);
 }
示例#20
0
function CreateAccount(options) {
  View.apply(this, arguments);
  this.cancel = this.cancel.bind(this);
  this._initEvents();
}
示例#21
0
function MonthDayAgenda() {
  Parent.apply(this, arguments);
  this._render = this._render.bind(this);
  this.controller = this.app.timeController;
}