mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 18:33:40 +08:00
Fix JSHint errors
This commit is contained in:
parent
aa346b3884
commit
9bad350de0
|
@ -2,7 +2,8 @@
|
|||
"predef": [
|
||||
"document",
|
||||
"window",
|
||||
"-Promise"
|
||||
"-Promise",
|
||||
"moment"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
|
|
|
@ -2,7 +2,6 @@ import Ember from 'ember';
|
|||
|
||||
import TaggedArray from '../../utils/tagged-array';
|
||||
import ActionButton from '../ui/controls/action-button';
|
||||
import SeparatorItem from '../ui/items/separator-item';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
|
@ -23,11 +22,11 @@ export default Ember.Component.extend({
|
|||
}.property('childViews.@each.active'),
|
||||
|
||||
displayUnread: function() {
|
||||
return this.get('countType') == 'unread' && this.get('discussion.isUnread');
|
||||
return this.get('countType') === 'unread' && this.get('discussion.isUnread');
|
||||
}.property('countType', 'discussion.isUnread'),
|
||||
|
||||
displayLastPost: function() {
|
||||
return this.get('terminalPostType') == 'last' && this.get('discussion.repliesCount');
|
||||
return this.get('terminalPostType') === 'last' && this.get('discussion.repliesCount');
|
||||
}.property('terminalPostType', 'discussion.repliesCount'),
|
||||
|
||||
start: function() {
|
||||
|
@ -37,11 +36,13 @@ export default Ember.Component.extend({
|
|||
discussionId: Ember.computed.alias('discussion.id'),
|
||||
|
||||
relevantPosts: function() {
|
||||
if (this.get('controller.show') != 'posts') return [];
|
||||
if (this.get('controller.show') !== 'posts') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (this.get('controller.searchQuery')) {
|
||||
return this.get('discussion.relevantPosts');
|
||||
} else if (this.get('controller.sort') == 'newest' || this.get('controller.sort') == 'oldest') {
|
||||
} else if (this.get('controller.sort') === 'newest' || this.get('controller.sort') === 'oldest') {
|
||||
return [this.get('discussion.startPost')];
|
||||
} else {
|
||||
return [this.get('discussion.lastPost')];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
import TaggedArray from '../../utils/tagged-array';
|
||||
import ActionButton from '../ui/controls/action-button';
|
||||
// import TaggedArray from '../../utils/tagged-array';
|
||||
// import ActionButton from '../ui/controls/action-button';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'article',
|
||||
|
@ -45,18 +45,18 @@ export default Ember.Component.extend({
|
|||
}, 100);
|
||||
},
|
||||
|
||||
addControl: function(tag, title, icon, permissionAttribute) {
|
||||
if (permissionAttribute && ! this.get('post').get(permissionAttribute)) {
|
||||
return;
|
||||
}
|
||||
// addControl: function(tag, title, icon, permissionAttribute) {
|
||||
// if (permissionAttribute && ! this.get('post').get(permissionAttribute)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
var self = this;
|
||||
var action = function(post) {
|
||||
self.get('controller').send(actionName, post);
|
||||
};
|
||||
// var self = this;
|
||||
// var action = function(post) {
|
||||
// self.get('controller').send(actionName, post);
|
||||
// };
|
||||
|
||||
var item = MenuItem.extend({title: title, icon: icon, action: action});
|
||||
this.get('controls').addItem(tag, item);
|
||||
}
|
||||
// var item = MenuItem.extend({title: title, icon: icon, action: action});
|
||||
// this.get('controls').addItem(tag, item);
|
||||
// }
|
||||
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
classNames: ['stream'],
|
||||
|
@ -177,7 +179,7 @@ export default Ember.Component.extend({
|
|||
if ($item.length) {
|
||||
var marginTop = this.getMarginTop();
|
||||
var scrollTop = $item.is(':first-child') ? 0 : $item.offset().top - marginTop;
|
||||
if (scrollTop != $(document).scrollTop()) {
|
||||
if (scrollTop !== $(document).scrollTop()) {
|
||||
$container.stop(true).animate({scrollTop: scrollTop});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
// A discussion 'item' represents one item in the post stream. In other words, a
|
||||
// single item may represent a single post, or it may represent a gap of many
|
||||
// posts which have not been loaded.
|
||||
|
@ -38,7 +40,7 @@ export default Ember.Component.extend({
|
|||
if (this.get('loading')) {
|
||||
buffer.push(' ');
|
||||
} else {
|
||||
buffer.push(this.get('count')+' more post'+(this.get('count') != 1 ? 's' : ''));
|
||||
buffer.push(this.get('count')+' more post'+(this.get('count') !== 1 ? 's' : ''));
|
||||
}
|
||||
buffer.push('</span>');
|
||||
},
|
||||
|
@ -93,9 +95,7 @@ export default Ember.Component.extend({
|
|||
// anchor (i.e. this gap is terminal,) then we'll scroll to the
|
||||
// bottom of the document.
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
$('body').scrollTop(anchor.length
|
||||
? anchor.offset().top - scrollOffset
|
||||
: $('body').height());
|
||||
$('body').scrollTop(anchor.length ? anchor.offset().top - scrollOffset : $('body').height());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
layoutName: 'components/discussions/stream-scrubber',
|
||||
classNames: ['scrubber', 'stream-scrubber'],
|
||||
|
@ -245,7 +247,7 @@ export default Ember.Component.extend({
|
|||
// Now loop through each of the items in the discussion. An 'item' is
|
||||
// either a single post or a 'gap' of one or more posts that haven't
|
||||
// been loaded yet.
|
||||
$items.each(function(k) {
|
||||
$items.each(function() {
|
||||
var $this = $(this),
|
||||
top = $this.offset().top,
|
||||
height = $this.outerHeight(true);
|
||||
|
@ -319,7 +321,7 @@ export default Ember.Component.extend({
|
|||
|
||||
// jQuery likes to put overflow:hidden, but because the scrollbar
|
||||
// handle has a negative margin-left, we need to override.
|
||||
if (func == 'animate') {
|
||||
if (func === 'animate') {
|
||||
$part.css('overflow', 'visible');
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +371,7 @@ export default Ember.Component.extend({
|
|||
// percentage to account for it.
|
||||
var minPercentVisible = 50 / this.$('.scrubber-scrollbar').outerHeight() * 100;
|
||||
var percentPerVisiblePost = Math.max(100 / count, minPercentVisible / visible);
|
||||
var percentPerPost = count == visible ? 0 : (100 - percentPerVisiblePost * visible) / (count - visible);
|
||||
var percentPerPost = count === visible ? 0 : (100 - percentPerVisiblePost * visible) / (count - visible);
|
||||
|
||||
return {
|
||||
index: percentPerPost,
|
||||
|
|
|
@ -19,9 +19,9 @@ export default Ember.Component.extend({
|
|||
click: function(e) {
|
||||
e.preventDefault();
|
||||
var action = this.get('action');
|
||||
if (typeof action == 'string') {
|
||||
if (typeof action === 'string') {
|
||||
this.sendAction('action');
|
||||
} else if (typeof action == 'function') {
|
||||
} else if (typeof action === 'function') {
|
||||
action();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
import DropdownButton from './dropdown-button';
|
||||
|
||||
export default DropdownButton.extend({
|
||||
|
|
|
@ -7,10 +7,12 @@ export default Ember.Component.extend({
|
|||
layoutName: 'components/ui/controls/item-list',
|
||||
|
||||
listItems: function() {
|
||||
if (!Ember.isArray(this.get('items'))) return [];
|
||||
if (!Ember.isArray(this.get('items'))) {
|
||||
return [];
|
||||
}
|
||||
var listItems = [];
|
||||
this.get('items').forEach(function(item) {
|
||||
if (item.tagName != 'li') {
|
||||
if (item.tagName !== 'li') {
|
||||
item = ComponentItem.extend({component: item});
|
||||
}
|
||||
listItems.push(item);
|
||||
|
|
|
@ -9,7 +9,7 @@ export default Ember.Component.extend({
|
|||
didInsertElement: function() {
|
||||
var self = this;
|
||||
this.$().find('input').on('keydown', function(e) {
|
||||
if (e.which == 27) {
|
||||
if (e.which === 27) {
|
||||
self.clear();
|
||||
}
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ export default Ember.Component.extend({
|
|||
}).on('click', function(e) {
|
||||
e.preventDefault();
|
||||
self.clear();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
|
|
@ -28,11 +28,11 @@ export default Ember.ArrayController.extend(Ember.Evented, PaneableMixin, {
|
|||
],
|
||||
|
||||
terminalPostType: function() {
|
||||
return ['newest', 'oldest'].indexOf(this.get('sort')) != -1 ? 'start' : 'last';
|
||||
return ['newest', 'oldest'].indexOf(this.get('sort')) !== -1 ? 'start' : 'last';
|
||||
}.property('sort'),
|
||||
|
||||
countType: function() {
|
||||
return this.get('sort') == 'replies' ? 'replies' : 'unread';
|
||||
return this.get('sort') === 'replies' ? 'replies' : 'unread';
|
||||
}.property('sort'),
|
||||
|
||||
discussionsCount: function() {
|
||||
|
@ -56,35 +56,39 @@ export default Ember.ArrayController.extend(Ember.Evented, PaneableMixin, {
|
|||
var show = this.get('show');
|
||||
var searchQuery = this.get('searchQuery');
|
||||
|
||||
if (sort == 'newest') {
|
||||
if (sort === 'newest') {
|
||||
sort = 'created';
|
||||
order = 'desc';
|
||||
} else if (sort == 'oldest') {
|
||||
} else if (sort === 'oldest') {
|
||||
sort = 'created';
|
||||
}
|
||||
else if (sort == 'recent') {
|
||||
else if (sort === 'recent') {
|
||||
sort = '';
|
||||
}
|
||||
else if (sort == 'replies') {
|
||||
else if (sort === 'replies') {
|
||||
order = 'desc';
|
||||
}
|
||||
|
||||
var params = {
|
||||
sort: (order == 'desc' ? '-' : '')+sort,
|
||||
sort: (order === 'desc' ? '-' : '')+sort,
|
||||
q: searchQuery,
|
||||
start: start
|
||||
};
|
||||
|
||||
if (show == 'posts') {
|
||||
if (searchQuery) params.include = 'relevantPosts';
|
||||
else if (sort == 'created') params.include = 'startPost,startUser';
|
||||
else params.include = 'lastPost,lastUser';
|
||||
if (show === 'posts') {
|
||||
if (searchQuery) {
|
||||
params.include = 'relevantPosts';
|
||||
} else if (sort === 'created') {
|
||||
params.include = 'startPost,startUser';
|
||||
} else {
|
||||
params.include = 'lastPost,lastUser';
|
||||
}
|
||||
}
|
||||
|
||||
return this.store.find('discussion', params).then(function(discussions) {
|
||||
var results = Em.A();
|
||||
var results = Ember.A();
|
||||
discussions.forEach(function(discussion) {
|
||||
var relevantPosts = Em.A();
|
||||
var relevantPosts = Ember.A();
|
||||
// discussion.get('relevantPosts.content').forEach(function(post) {
|
||||
// relevantPosts.pushObject(PostResult.create(post));
|
||||
// });
|
||||
|
@ -118,21 +122,21 @@ export default Ember.ArrayController.extend(Ember.Evented, PaneableMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
searchQueryDidChange: function(q) {
|
||||
searchQueryDidChange: function() {
|
||||
this.get('controllers.application').set('searchQuery', this.get('searchQuery'));
|
||||
this.get('controllers.application').set('searchActive', !! this.get('searchQuery'));
|
||||
|
||||
var sortOptions = this.get('sortOptions');
|
||||
|
||||
if (this.get('searchQuery') && sortOptions[0].sort != 'relevance') {
|
||||
if (this.get('searchQuery') && sortOptions[0].sort !== 'relevance') {
|
||||
sortOptions.unshiftObject({sort: 'relevance', label: 'Relevance'});
|
||||
}
|
||||
else if ( ! this.get('searchQuery') && sortOptions[0].sort == 'relevance') {
|
||||
else if ( ! this.get('searchQuery') && sortOptions[0].sort === 'relevance') {
|
||||
sortOptions.shiftObject();
|
||||
}
|
||||
}.observes('searchQuery'),
|
||||
|
||||
paramsDidChange: function(show) {
|
||||
paramsDidChange: function() {
|
||||
this.set('start', 0);
|
||||
}.observes('show', 'sort', 'searchQuery')
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Handlebars.makeBoundHelper(function(number, options) {
|
||||
export default Ember.Handlebars.makeBoundHelper(function(number) {
|
||||
return new Ember.Handlebars.SafeString(''+number);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Handlebars.makeBoundHelper(function(icon, options) {
|
||||
return new Handlebars.SafeString('<i class="fa fa-fw fa-'+icon+' '+(options.hash.class || '')+'"></i>');
|
||||
return new Ember.Handlebars.SafeString('<i class="fa fa-fw fa-'+icon+' '+(options.hash.class || '')+'"></i>');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Handlebars.makeBoundHelper(function(text, phrase, options) {
|
||||
export default Ember.Handlebars.makeBoundHelper(function(text, phrase) {
|
||||
if (phrase) {
|
||||
var words = phrase.split(' ');
|
||||
var replacement = function(matched) {
|
||||
|
@ -13,6 +13,6 @@ export default Ember.Handlebars.makeBoundHelper(function(text, phrase, options)
|
|||
);
|
||||
});
|
||||
}
|
||||
return new Handlebars.SafeString(text);
|
||||
return new Ember.Handlebars.SafeString(text);
|
||||
});
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ export default Ember.Handlebars.makeBoundHelper(function(time) {
|
|||
var datetime = m.format(),
|
||||
full = m.format('LLLL');
|
||||
|
||||
var second = 1e3;
|
||||
// var second = 1e3;
|
||||
var minute = 6e4;
|
||||
var hour = 36e5;
|
||||
var day = 864e5;
|
||||
var week = 6048e5;
|
||||
// var week = 6048e5;
|
||||
var ago = null;
|
||||
|
||||
var diff = Math.abs(m.diff(moment()));
|
||||
|
@ -20,12 +20,12 @@ export default Ember.Handlebars.makeBoundHelper(function(time) {
|
|||
ago = moment.duration(diff).hours()+'h ago';
|
||||
} else if (diff < 30 * day) {
|
||||
ago = moment.duration(diff).days()+'d ago';
|
||||
} else if (m.year() == moment().year()) {
|
||||
} else if (m.year() === moment().year()) {
|
||||
ago = m.format('D MMM');
|
||||
} else {
|
||||
ago = m.format('MMM \'YY');
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString('<time pubdate datetime="'+datetime+'" title="'+full+'">'+ago+'</time>');
|
||||
return new Ember.Handlebars.SafeString('<time pubdate datetime="'+datetime+'" title="'+full+'">'+ago+'</time>');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
function HSVtoRGB(h, s, v) {
|
||||
function hsvToRgb(h, s, v) {
|
||||
var r, g, b, i, f, p, q, t;
|
||||
if (h && s === undefined && v === undefined) {
|
||||
s = h.s, v = h.v, h = h.h;
|
||||
s = h.s; v = h.v; h = h.h;
|
||||
}
|
||||
i = Math.floor(h * 6);
|
||||
f = h * 6 - i;
|
||||
|
@ -11,12 +11,12 @@ function HSVtoRGB(h, s, v) {
|
|||
q = v * (1 - f * s);
|
||||
t = v * (1 - (1 - f) * s);
|
||||
switch (i % 6) {
|
||||
case 0: r = v, g = t, b = p; break;
|
||||
case 1: r = q, g = v, b = p; break;
|
||||
case 2: r = p, g = v, b = t; break;
|
||||
case 3: r = p, g = q, b = v; break;
|
||||
case 4: r = t, g = p, b = v; break;
|
||||
case 5: r = v, g = p, b = q; break;
|
||||
case 0: r = v; g = t; b = p; break;
|
||||
case 1: r = q; g = v; b = p; break;
|
||||
case 2: r = p; g = v; b = t; break;
|
||||
case 3: r = p; g = q; b = v; break;
|
||||
case 4: r = t; g = p; b = v; break;
|
||||
case 5: r = v; g = p; b = q; break;
|
||||
}
|
||||
return {
|
||||
r: Math.floor(r * 255),
|
||||
|
@ -26,17 +26,21 @@ function HSVtoRGB(h, s, v) {
|
|||
}
|
||||
|
||||
export default Ember.Handlebars.makeBoundHelper(function(user, options) {
|
||||
if (!user) return;
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
var number;
|
||||
if (number = user.get('avatarNumber')) {
|
||||
number = number + '';
|
||||
var filename = number.length >= 3 ? number : new Array(3 - number.length + 1).join('0') + number;
|
||||
return new Handlebars.SafeString('<img src="/packages/flarum/core/avatars/'+filename+'.jpg" class="avatar '+options.hash.class+'">');
|
||||
return new Ember.Handlebars.SafeString('<img src="/packages/flarum/core/avatars/'+filename+'.jpg" class="avatar '+options.hash.class+'">');
|
||||
}
|
||||
|
||||
var username = user.get('username');
|
||||
if (!username) username = '?';
|
||||
if (!username) {
|
||||
username = '?';
|
||||
}
|
||||
|
||||
var letter = username.charAt(0).toUpperCase();
|
||||
|
||||
|
@ -46,8 +50,8 @@ export default Ember.Handlebars.makeBoundHelper(function(user, options) {
|
|||
}
|
||||
|
||||
var hue = num % 360;
|
||||
var rgb = HSVtoRGB(hue / 360, 100 / 255, 200 / 255);
|
||||
var rgb = hsvToRgb(hue / 360, 100 / 255, 200 / 255);
|
||||
var bg = ''+rgb.r.toString(16)+rgb.g.toString(16)+rgb.b.toString(16);
|
||||
return new Handlebars.SafeString('<span class="avatar '+options.hash.class+'" style="background:#'+bg+'" title="'+username+'">'+letter+'</span>');
|
||||
return new Ember.Handlebars.SafeString('<span class="avatar '+options.hash.class+'" style="background:#'+bg+'" title="'+username+'">'+letter+'</span>');
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import Ember from 'ember';
|
|||
|
||||
var DiscussionResult = Ember.ObjectProxy.extend({
|
||||
|
||||
relevantPosts: Em.A(),
|
||||
relevantPosts: null,
|
||||
|
||||
startPost: null,
|
||||
lastPost: null
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
|
|
|
@ -8,7 +8,9 @@ var PostResult = Ember.ObjectProxy.extend({
|
|||
|
||||
PostResult.reopenClass({
|
||||
create: function(post) {
|
||||
if (!post) return null;
|
||||
if (!post) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = this._super();
|
||||
result.set('content', post);
|
||||
|
|
|
@ -43,7 +43,7 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
|
|||
// Clear the contents of the post stream, resetting it to one big gap.
|
||||
clear: function() {
|
||||
var content = Ember.A();
|
||||
content.clear().pushObject(Em.Object.create({
|
||||
content.clear().pushObject(Ember.Object.create({
|
||||
gap: true,
|
||||
indexStart: 0,
|
||||
indexEnd: this.get('count') - 1,
|
||||
|
@ -60,10 +60,7 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
|
|||
// Find the appropriate gap objects in the post stream. When we find
|
||||
// one, we will turn on its loading flag.
|
||||
this.get('content').forEach(function(item) {
|
||||
if (item.gap && (
|
||||
(item.indexStart >= start && item.indexStart <= end)
|
||||
|| (item.indexEnd >= start && item.indexEnd <= end)
|
||||
)) {
|
||||
if (item.gap && ((item.indexStart >= start && item.indexStart <= end) || (item.indexEnd >= start && item.indexEnd <= end))) {
|
||||
item.set('loading', true);
|
||||
item.set('direction', backwards ? 'up' : 'down');
|
||||
}
|
||||
|
@ -96,7 +93,7 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
|
|||
// request.) Or, if it's a gap, we'll switch on its loading flag.
|
||||
var item = this.findNearestToNumber(number);
|
||||
if (item) {
|
||||
if (item.get('content.number') == number) {
|
||||
if (item.get('content.number') === number) {
|
||||
return Ember.RSVP.resolve([item.get('content')]);
|
||||
} else if (item.gap) {
|
||||
item.set('direction', 'down').set('loading', true);
|
||||
|
@ -143,7 +140,6 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
|
|||
},
|
||||
|
||||
addPost: function(post) {
|
||||
var stream = this;
|
||||
var index = this.get('ids').indexOf(post.get('id'));
|
||||
var content = this.get('content');
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
|
|
|
@ -42,14 +42,14 @@ export default Ember.Route.extend({
|
|||
var controller = this.get('controller'),
|
||||
oldStart = this.get('controller.start');
|
||||
Ember.run.next(function() {
|
||||
if (! params.start || ! controller || ! controller.get('loaded') || params.start == oldStart) {
|
||||
if (! params.start || ! controller || ! controller.get('loaded') || params.start === oldStart) {
|
||||
return;
|
||||
}
|
||||
controller.trigger('startWasChanged', params.start);
|
||||
});
|
||||
},
|
||||
|
||||
willTransition: function(transition) {
|
||||
willTransition: function() {
|
||||
// When we transition away from this discussion, we want to hide
|
||||
// the discussions list pane. This means that when the user
|
||||
// selects a different discussion within the pane, the pane will
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
import Discussion from '../models/discussion';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
|
||||
|
@ -18,14 +17,14 @@ export default Ember.Route.extend({
|
|||
}
|
||||
},
|
||||
|
||||
model: function(params) {
|
||||
model: function() {
|
||||
var model = Ember.ArrayProxy.create();
|
||||
|
||||
return Ember.RSVP.resolve(model);
|
||||
},
|
||||
|
||||
actions: {
|
||||
queryParamsDidChange: function(newParams, params) {
|
||||
queryParamsDidChange: function() {
|
||||
var self = this;
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
self.refresh();
|
||||
|
|
|
@ -21,7 +21,7 @@ export default Ember.ArrayProxy.extend({
|
|||
|
||||
insertAfterTag: function(anchorTag, obj, tag) {
|
||||
var idx = this.indexOfTag(anchorTag);
|
||||
this.insertAtWithTag(idx + 1, obj, newTag);
|
||||
this.insertAtWithTag(idx + 1, obj, tag);
|
||||
},
|
||||
|
||||
insertBeforeTag: function(anchorTag, obj, tag) {
|
||||
|
|
|
@ -5,6 +5,8 @@ import SearchInput from '../components/ui/controls/search-input';
|
|||
import DropdownSelect from '../components/ui/controls/dropdown-select';
|
||||
import TaggedArray from '../utils/tagged-array';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.View.extend({
|
||||
|
||||
title: function() {
|
||||
|
|
|
@ -3,9 +3,10 @@ import Ember from 'ember';
|
|||
import TaggedArray from '../utils/tagged-array';
|
||||
import ActionButton from '../components/ui/controls/action-button';
|
||||
import DropdownSplit from '../components/ui/controls/dropdown-split';
|
||||
import DropdownButton from '../components/ui/controls/dropdown-button';
|
||||
import StreamScrubber from '../components/discussions/stream-scrubber';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.View.extend(Ember.Evented, {
|
||||
|
||||
sidebarItems: null,
|
||||
|
|
|
@ -5,6 +5,8 @@ import ActionButton from '../components/ui/controls/action-button';
|
|||
import NavItem from '../components/ui/items/nav-item';
|
||||
import TaggedArray from '../utils/tagged-array';
|
||||
|
||||
var $ = Ember.$;
|
||||
|
||||
export default Ember.View.extend({
|
||||
|
||||
sidebarItems: null,
|
||||
|
@ -24,7 +26,7 @@ export default Ember.View.extend({
|
|||
return $sidebar.offset().top - $('#header').outerHeight(true) - parseInt($sidebar.css('margin-top'));
|
||||
},
|
||||
bottom: function () {
|
||||
return (this.bottom = $('#footer').outerHeight(true))
|
||||
return (this.bottom = $('#footer').outerHeight(true));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -57,7 +59,7 @@ export default Ember.View.extend({
|
|||
label: 'Start a Discussion',
|
||||
icon: 'edit',
|
||||
className: 'btn btn-primary new-discussion'
|
||||
})
|
||||
});
|
||||
sidebar.pushObjectWithTag(newDiscussion, 'newDiscussion');
|
||||
|
||||
var nav = TaggedArray.create();
|
||||
|
|
|
@ -14,7 +14,7 @@ export default Ember.View.extend({
|
|||
},
|
||||
|
||||
willDestroyElement: function() {
|
||||
this.get('controller.session').off('sessionAuthenticationSucceeded', this, this.hide)
|
||||
this.get('controller.session').off('sessionAuthenticationSucceeded', this, this.hide);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user