mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
ES6: More components moved over.
This commit is contained in:
parent
941b5f919f
commit
1af2ff6201
9 changed files with 25 additions and 18 deletions
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.GroupsListComponent = Em.Component.extend({
|
||||
export default Em.Component.extend({
|
||||
classNames: ['groups']
|
||||
});
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.NavigationItemComponent = Ember.Component.extend({
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'li',
|
||||
classNameBindings: ['active', 'content.hasIcon:has-icon'],
|
||||
attributeBindings: ['title'],
|
|
@ -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>');
|
||||
}
|
||||
});
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
{{unbound boundI18n scope linkBinding="model.link" usernameBinding="model.username"}}
|
|
@ -3,7 +3,7 @@
|
|||
{{#if content}}
|
||||
<ul>
|
||||
{{#each}}
|
||||
<li {{bind-attr class="read"}}>{{notification-item model=this scope=scope}}</li>
|
||||
{{notification-item notification=this scope=scope}}
|
||||
{{/each}}
|
||||
<li class="read last">
|
||||
<a {{bind-attr href="currentUser.path"}}>{{i18n notifications.more}} …</a>
|
||||
|
|
|
@ -18,7 +18,8 @@ class SilenceLogger < Rails::Rack::Logger
|
|||
if env[HTTP_X_SILENCE_LOGGER] ||
|
||||
@opts[:silenced].include?(path_info) ||
|
||||
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
|
||||
@app.call(env)
|
||||
else
|
||||
|
|
|
@ -71,10 +71,10 @@ test("displays a list of notifications and a 'more' link when there are notifica
|
|||
var items = fixture(itemSelector);
|
||||
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(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");
|
||||
|
||||
var moreLink = items.eq(2).find("> a");
|
||||
|
|
Loading…
Reference in a new issue