Beispiel #1
0
/* jshint node:true */

'use strict';
var Marionette = require('backbone-shim').Marionette,
  ErrorTemplate = require('Error.html');

module.exports = Marionette.ItemView.extend({
  template: ErrorTemplate,
  attributes: {
    class: 'error',
  }
});
Beispiel #2
0
/* globals chatApp */
/* jshint node:true */

'use strict';

/**
 * View for displaying a single message
 * @return Marionette.ItemView MessageView
 */

var Marionette = require('backbone-shim').Marionette,
  MessageTemplate = require('Message.html');

module.exports = Marionette.ItemView.extend({
  template: MessageTemplate,
  classes: 'message',
  templateHelpers: function () {
    var currentUserClasses = '';
    if (chatApp.models.CurrentUser.loadedUser()) {
      if (this.model.get('username') === chatApp.models.CurrentUser.getName()) {
        currentUserClasses += 'current-user';
      }
    }
    return {
      currentUserClasses: currentUserClasses,
    };
  }
});