This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/composer_messages_controller.js
2013-09-10 12:30:56 -04:00

31 lines
703 B
JavaScript

/**
A controller for displaying messages as the user composes a message.
@class ComposerMessagesController
@extends Ember.ArrayController
@namespace Discourse
@module Discourse
**/
Discourse.ComposerMessagesController = Ember.ArrayController.extend({
needs: ['composer'],
init: function() {
this._super();
this.set('messagesByTemplate', {});
},
popup: function(msg) {
var messagesByTemplate = this.get('messagesByTemplate'),
existing = messagesByTemplate[msg.templateName];
if (!existing) {
this.pushObject(msg);
messagesByTemplate[msg.templateName] = msg;
}
},
closeMessage: function(message) {
this.removeObject(message);
}
});