ES6: More components moved over.

This commit is contained in:
Robin Ward 2014-05-30 12:16:23 -04:00
parent 941b5f919f
commit 1af2ff6201
9 changed files with 25 additions and 18 deletions

View file

@ -6,7 +6,7 @@
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.GroupsListComponent = Em.Component.extend({ export default Em.Component.extend({
classNames: ['groups'] classNames: ['groups']
}); });

View file

@ -6,7 +6,7 @@
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.NavigationItemComponent = Ember.Component.extend({ export default Ember.Component.extend({
tagName: 'li', tagName: 'li',
classNameBindings: ['active', 'content.hasIcon:has-icon'], classNameBindings: ['active', 'content.hasIcon:has-icon'],
attributeBindings: ['title'], attributeBindings: ['title'],

View file

@ -0,0 +1,18 @@
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['notification.read'],
_markRead: function(){
var self = this;
this.$('a').click(function(){
self.set('notification.read', true);
return true;
});
}.on('didInsertElement'),
render: function(buffer) {
var notification = this.get('notification'),
text = I18n.t(this.get('scope'), Em.getProperties(notification, 'link', 'username'));
buffer.push('<span>' + text + '</span>');
}
});

View file

@ -1,11 +0,0 @@
Discourse.NotificationItemComponent = Ember.Component.extend({
tagName: 'span',
didInsertElement: function(){
var self = this;
this.$('a').click(function(){
self.set('model.read', true);
self.rerender();
return true;
});
}
});

View file

@ -1 +0,0 @@
{{unbound boundI18n scope linkBinding="model.link" usernameBinding="model.username"}}

View file

@ -3,7 +3,7 @@
{{#if content}} {{#if content}}
<ul> <ul>
{{#each}} {{#each}}
<li {{bind-attr class="read"}}>{{notification-item model=this scope=scope}}</li> {{notification-item notification=this scope=scope}}
{{/each}} {{/each}}
<li class="read last"> <li class="read last">
<a {{bind-attr href="currentUser.path"}}>{{i18n notifications.more}} &hellip;</a> <a {{bind-attr href="currentUser.path"}}>{{i18n notifications.more}} &hellip;</a>

View file

@ -18,7 +18,8 @@ class SilenceLogger < Rails::Rack::Logger
if env[HTTP_X_SILENCE_LOGGER] || if env[HTTP_X_SILENCE_LOGGER] ||
@opts[:silenced].include?(path_info) || @opts[:silenced].include?(path_info) ||
path_info.start_with?('/logs') || path_info.start_with?('/logs') ||
path_info.start_with?('/user_avatar') path_info.start_with?('/user_avatar') ||
path_info.start_with?('/letter_avatar')
Rails.logger.level = Logger::WARN Rails.logger.level = Logger::WARN
@app.call(env) @app.call(env)
else else

View file

@ -71,10 +71,10 @@ test("displays a list of notifications and a 'more' link when there are notifica
var items = fixture(itemSelector); var items = fixture(itemSelector);
equal(count(items), 3, "number of list items is correct"); equal(count(items), 3, "number of list items is correct");
equal(items.eq(0).attr("class"), "", "first (unread) item has proper class"); equal(items.eq(0).attr("class"), "ember-view", "first (unread) item has proper class");
equal(items.eq(0).text().trim(), "scope_1 username_1 link_1", "first item has correct content"); equal(items.eq(0).text().trim(), "scope_1 username_1 link_1", "first item has correct content");
equal(items.eq(1).attr("class"), "read", "second (read) item has proper class"); equal(items.eq(1).attr("class"), "ember-view read", "second (read) item has proper class");
equal(items.eq(1).text().trim(), "scope_2 username_2 link_2", "second item has correct content"); equal(items.eq(1).text().trim(), "scope_2 username_2 link_2", "second item has correct content");
var moreLink = items.eq(2).find("> a"); var moreLink = items.eq(2).find("> a");