JS refactoring that fixes presence errors in earlier reverted commit.

This commit is contained in:
Robin Ward 2013-02-22 10:20:23 -05:00
parent 6347cbe275
commit 45ab3ab892
74 changed files with 207 additions and 221 deletions

View File

@ -8,7 +8,7 @@
@namespace Discourse
@module Discourse
**/
window.Discourse.SiteSetting = Discourse.Model.extend(Discourse.Presence, {
window.Discourse.SiteSetting = Discourse.Model.extend({
// Whether a property is short.
short: (function() {

View File

@ -1,7 +1,7 @@
(function() {
/**
Handles routes related to users.
Handles routes related to users in the admin section.
@class AdminUserRoute
@extends Discourse.Route

View File

@ -5,11 +5,11 @@
A view that wraps the ACE editor (http://ace.ajax.org/)
@class AceEditorView
@extends Discourse.View
@extends Em.View
@namespace Discourse
@module Discourse
**/
Discourse.AceEditorView = window.Discourse.View.extend({
Discourse.AceEditorView = Discourse.View.extend({
mode: 'css',
classNames: ['ace-wrapper'],

View File

@ -5,11 +5,11 @@
A view to handle site customizations
@class AdminCustomizeView
@extends Discourse.View
@extends Em.View
@namespace Discourse
@module Discourse
**/
Discourse.AdminCustomizeView = window.Discourse.View.extend({
Discourse.AdminCustomizeView = Discourse.View.extend({
templateName: 'admin/templates/customize',
classNames: ['customize'],

View File

@ -4,11 +4,11 @@
The default view in the admin section
@class AdminDashboardView
@extends Discourse.View
@extends Em.View
@namespace Discourse
@module Discourse
**/
Discourse.AdminDashboardView = window.Discourse.View.extend({
Discourse.AdminDashboardView = Discourse.View.extend({
templateName: 'admin/templates/dashboard',
updateIconClasses: function() {

View File

@ -28,8 +28,8 @@
// Stuff we need to load first
//= require_tree ./discourse/mixins
//= require ./discourse/components/debounce
//= require ./discourse/views/view
//= require ./discourse/components/debounce
//= require ./discourse/controllers/controller
//= require ./discourse/views/modal/modal_body_view
//= require ./discourse/models/model

View File

@ -27,7 +27,7 @@
Ember.Handlebars.registerHelper('countI18n', function(key, options) {
var view;
view = Em.View.extend({
view = Discourse.View.extend({
tagName: 'span',
render: function(buffer) {
return buffer.push(Ember.String.i18n(key, {

View File

@ -1,15 +1,29 @@
(function() {
window.Discourse.Presence = Em.Mixin.create({
/* Is a property blank?
*/
/**
This mixin provides `blank` and `present` to determine whether properties are
there, accounting for more cases than just null and undefined.
@class Discourse.Presence
@extends Ember.Mixin
@namespace Discourse
@module Discourse
**/
window.Discourse.Presence = Em.Mixin.create({
/**
Returns whether a property is blank. It considers empty arrays, string, objects, undefined and null
to be blank, otherwise true.
@method blank
@param {String} name the name of the property we want to check
@return {Boolean}
*/
blank: function(name) {
var prop;
prop = this.get(name);
if (!prop) {
return true;
}
if (!prop) return true;
switch (typeof prop) {
case "string":
return prop.trim().isBlank();
@ -18,6 +32,14 @@
}
return false;
},
/**
Returns whether a property is present. A present property is the opposite of a `blank` one.
@method present
@param {String} name the name of the property we want to check
@return {Boolean}
*/
present: function(name) {
return !this.blank(name);
}

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ActionSummary = Em.Object.extend(Discourse.Presence, {
window.Discourse.ActionSummary = Discourse.Model.extend({
/* Description for the action
*/

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.InviteList = Discourse.Model.extend(Discourse.Presence, {
window.Discourse.InviteList = Discourse.Model.extend({
empty: (function() {
return this.blank('pending') && this.blank('redeemed');
}).property('pending.@each', 'redeemed.@each')

View File

@ -1,30 +1,42 @@
(function() {
window.Discourse.Model = Ember.Object.extend({
/* Our own AJAX handler that handles erronous responses
*/
/**
A base object we can use to handle models in the Discourse client application.
@class Model
@extends Ember.Object
@uses Discourse.Presence
@namespace Discourse
@module Discourse
**/
window.Discourse.Model = Ember.Object.extend(Discourse.Presence, {
/**
Our own AJAX handler that handles erronous responses
@method ajax
@param {String} url The url to contact
@param {Object} args The arguments to pass to jQuery.ajax
**/
ajax: function(url, args) {
/* Error handler
*/
var oldError,
_this = this;
oldError = args.error;
var oldError = args.error;
args.error = function(xhr) {
return oldError(jQuery.parseJSON(xhr.responseText).errors);
};
return jQuery.ajax(url, args);
},
/* Update our object from another object
*/
/**
Update our object from another object
@method mergeAttributes
@param {Object} attrs The attributes we want to merge with
@param {Object} builders Optional builders to use when merging attributes
**/
mergeAttributes: function(attrs, builders) {
var _this = this;
return Object.keys(attrs, function(k, v) {
/* If they're in a builder we use that
*/
// If they're in a builder we use that
var builder, col;
if (typeof v === 'object' && builders && (builder = builders[k])) {
if (!_this.get(k)) {
@ -42,9 +54,14 @@
});
window.Discourse.Model.reopenClass({
/* Given an array of values, return them in a hash
*/
/**
Given an array of values, return them in a hash
@method extractByKey
@param {Object} collection The collection of values
@param {Object} klass Optional The class to instantiate
**/
extractByKey: function(collection, klass) {
var retval;
retval = {};

View File

@ -10,7 +10,7 @@
validAnon = ['popular', 'category', 'categories'];
window.Discourse.NavItem = Em.Object.extend({
window.Discourse.NavItem = Discourse.Model.extend({
categoryName: (function() {
var split;
split = this.get('name').split('/');

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.Notification = Discourse.Model.extend(Discourse.Presence, {
window.Discourse.Notification = Discourse.Model.extend({
readClass: (function() {
if (this.read) {
return 'read';

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.Post = Ember.Object.extend(Discourse.Presence, {
window.Discourse.Post = Discourse.Model.extend({
/* Url to this post
*/

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PostActionType = Em.Object.extend({
window.Discourse.PostActionType = Discourse.Model.extend({
alsoName: (function() {
if (this.get('is_flag')) {
return Em.String.i18n('post.actions.flag');

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.Site = Ember.Object.extend({
window.Discourse.Site = Discourse.Model.extend({
notificationLookup: (function() {
var result;
result = [];

View File

@ -1,6 +1,6 @@
(function() {
Discourse.Topic = Discourse.Model.extend(Discourse.Presence, {
Discourse.Topic = Discourse.Model.extend({
categoriesBinding: 'Discourse.site.categories',
fewParticipants: (function() {
if (!this.present('participants')) {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.User = Discourse.Model.extend(Discourse.Presence, {
window.Discourse.User = Discourse.Model.extend({
avatarLarge: (function() {
return Discourse.Utilities.avatarUrl(this.get('username'), 'large', this.get('avatar_template'));
}).property('username'),

View File

@ -1,93 +1,49 @@
/* Ways we can filter the topics list
*/
(function() {
Discourse.buildRoutes(function() {
var router;
this.resource('topic', {
path: '/t/:slug/:id'
}, function() {
this.route('fromParams', {
path: '/'
});
this.route('fromParams', {
path: '/:nearPost'
});
return this.route('bestOf', {
path: '/best_of'
});
});
/* Generate static page routes
*/
var router = this;
router = this;
// Topic routes
this.resource('topic', { path: '/t/:slug/:id' }, function() {
this.route('fromParams', { path: '/' });
this.route('fromParams', { path: '/:nearPost' });
this.route('bestOf', { path: '/best_of' });
});
// Generate static page routes
Discourse.StaticController.pages.forEach(function(p) {
return router.route(p, {
path: "/" + p
});
router.route(p, { path: "/" + p });
});
this.route('faq', {
path: '/faq'
});
this.route('tos', {
path: '/tos'
});
this.route('privacy', {
path: '/privacy'
});
this.resource('list', {
path: '/'
}, function() {
router = this;
/* Generate routes for all our filters
*/
this.route('faq', { path: '/faq' });
this.route('tos', { path: '/tos' });
this.route('privacy', { path: '/privacy' });
// List routes
this.resource('list', { path: '/' }, function() {
router = this;
// Generate routes for all our filters
Discourse.ListController.filters.forEach(function(r) {
router.route(r, {
path: "/" + r
});
return router.route(r, {
path: "/" + r + "/more"
});
});
router.route('popular', {
path: '/'
});
router.route('categories', {
path: '/categories'
});
router.route('category', {
path: '/category/:slug/more'
});
return router.route('category', {
path: '/category/:slug'
router.route(r, { path: "/" + r });
router.route(r, { path: "/" + r + "/more" });
});
this.route('popular', { path: '/' });
this.route('categories', { path: '/categories' });
this.route('category', { path: '/category/:slug/more' });
this.route('category', { path: '/category/:slug' });
});
return this.resource('user', {
path: '/users/:username'
}, function() {
this.route('activity', {
path: '/'
});
this.resource('preferences', {
path: '/preferences'
}, function() {
this.route('username', {
path: '/username'
});
return this.route('email', {
path: '/email'
});
});
this.route('privateMessages', {
path: '/private-messages'
});
return this.route('invited', {
path: 'invited'
// User routes
this.resource('user', { path: '/users/:username' }, function() {
this.route('activity', { path: '/' });
this.resource('preferences', { path: '/preferences' }, function() {
this.route('username', { path: '/username' });
this.route('email', { path: '/email' });
});
this.route('privateMessages', { path: '/private-messages' });
this.route('invited', { path: 'invited' });
});
});

View File

@ -1,49 +1,31 @@
(function() {
window.Discourse.Route = Em.Route.extend({
/* Called every time we enter a route
*/
/**
The base admin route for all routes on Discourse. Includes global enter functionality.
@class Route
@extends Em.Route
@namespace Discourse
@module Discourse
**/
Discourse.Route = Em.Route.extend({
/**
Called every time we enter a route on Discourse.
@method enter
**/
enter: function(router, context) {
/* Close mini profiler
*/
var composerController, f, search, shareController;
// Close mini profiler
jQuery('.profiler-results .profiler-result').remove();
/* Close stuff that may be open
*/
// Close some elements that may be open
jQuery('.d-dropdown').hide();
jQuery('header ul.icons li').removeClass('active');
jQuery('[data-toggle="dropdown"]').parent().removeClass('open');
/* TODO: need to adjust these
*/
if (false) {
if (shareController = router.get('shareController')) {
shareController.close();
}
/* Hide any searches
*/
if (search = router.get('searchController')) {
search.close();
}
/* get rid of "save as draft stuff"
*/
composerController = Discourse.get('router.composerController');
if (composerController) {
composerController.closeIfCollapsed();
}
}
f = jQuery('html').data('hide-dropdown');
if (f) {
return f();
}
/*return @_super(router, context)
*/
var hideDropDownFunction = jQuery('html').data('hide-dropdown');
if (hideDropDownFunction) return hideDropDownFunction();
}
});

View File

@ -1,13 +1,20 @@
(function() {
window.Discourse.UserRoute = Discourse.Route.extend({
/**
Handles routes related to users.
@class UserRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.UserRoute = Discourse.Route.extend({
model: function(params) {
return Discourse.User.find(params.username);
},
serialize: function(params) {
return {
username: Em.get(params, 'username').toLowerCase()
};
return { username: Em.get(params, 'username').toLowerCase() };
}
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ActionsHistoryView = Em.View.extend(Discourse.Presence, {
window.Discourse.ActionsHistoryView = Discourse.View.extend({
tagName: 'section',
classNameBindings: [':post-actions', 'hidden'],
hidden: (function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ApplicationView = Ember.View.extend({
window.Discourse.ApplicationView = Discourse.View.extend({
templateName: 'application'
});

View File

@ -1,6 +1,6 @@
(function() {
Discourse.AutoSizedTextView = Ember.View.extend({
Discourse.AutoSizedTextView = Discourse.View.extend({
render: function(buffer) {
return null;
},

View File

@ -1,6 +1,6 @@
(function() {
Discourse.ButtonView = Ember.View.extend(Discourse.Presence, {
Discourse.ButtonView = Discourse.View.extend({
tagName: 'button',
classNameBindings: [':btn', ':standard', 'dropDownToggle'],
attributeBindings: ['data-not-implemented', 'title', 'data-toggle', 'data-share-url'],

View File

@ -1,6 +1,6 @@
(function() {
Discourse.ComboboxView = window.Ember.View.extend({
Discourse.ComboboxView = Discourse.View.extend({
tagName: 'select',
classNames: ['combobox'],
valueAttribute: 'id',

View File

@ -1,7 +1,7 @@
/*global Markdown:true assetPath:true */
(function() {
window.Discourse.ComposerView = window.Discourse.View.extend({
window.Discourse.ComposerView = Discourse.View.extend({
templateName: 'composer',
elementId: 'reply-control',
classNameBindings: ['content.creatingPrivateMessage:private-message',

View File

@ -1,6 +1,6 @@
(function() {
Discourse.DropdownButtonView = Ember.View.extend(Discourse.Presence, {
Discourse.DropdownButtonView = Discourse.View.extend({
classNames: ['btn-group'],
attributeBindings: ['data-not-implemented'],
didInsertElement: function(e) {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.EmbeddedPostView = Ember.View.extend({
window.Discourse.EmbeddedPostView = Discourse.View.extend({
templateName: 'embedded_post',
classNames: ['reply'],
didInsertElement: function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ExcerptCategoryView = Ember.View.extend({
window.Discourse.ExcerptCategoryView = Discourse.View.extend({
editCategory: function() {
var cat, _ref;
this.get('parentView').close();

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ExcerptPostView = Ember.View.extend({
window.Discourse.ExcerptPostView = Discourse.View.extend({
mute: function() {
return this.update(true);
},

View File

@ -1,10 +1,10 @@
(function() {
window.Discourse.ExcerptUserView = Ember.View.extend({
window.Discourse.ExcerptUserView = Discourse.View.extend({
privateMessage: function(e) {
var $target, composerController, post, postView, url, username;
$target = this.get("link");
postView = Ember.View.views[$target.closest('.ember-view')[0].id];
postView = Discourse.View.views[$target.closest('.ember-view')[0].id];
post = postView.get("post");
url = post.get("url");
username = post.get("username");

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.FeaturedTopicsView = Ember.View.extend({
window.Discourse.FeaturedTopicsView = Discourse.View.extend({
templateName: 'featured_topics',
classNames: ['category-list-item'],
init: function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.FeaturedTopicsView = Ember.View.extend({
window.Discourse.FeaturedTopicsView = Discourse.View.extend({
templateName: 'featured_topics',
classNames: ['category-list-item']
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.HeaderView = Ember.View.extend({
window.Discourse.HeaderView = Discourse.View.extend({
tagName: 'header',
classNames: ['d-header', 'clearfix'],
classNameBindings: ['editingTopic'],

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.HistoryView = Ember.View.extend({
window.Discourse.HistoryView = Discourse.View.extend({
templateName: 'history',
title: 'History',
modalClass: 'history-modal',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ImageSelectorView = Ember.View.extend({
window.Discourse.ImageSelectorView = Discourse.View.extend({
templateName: 'image_selector',
classNames: ['image-selector'],
title: 'Insert Image',

View File

@ -1,6 +1,6 @@
(function() {
Discourse.InputTipView = Ember.View.extend(Discourse.Presence, {
Discourse.InputTipView = Discourse.View.extend({
templateName: 'input_tip',
classNameBindings: [':tip', 'good', 'bad'],
good: (function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ListCategoriesView = Ember.View.extend({
window.Discourse.ListCategoriesView = Discourse.View.extend({
templateName: 'list/categories',
didInsertElement: function() {
return Discourse.set('title', Em.String.i18n("category.list"));

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ListTopicsView = Ember.View.extend(Discourse.Scrolling, Discourse.Presence, {
window.Discourse.ListTopicsView = Discourse.View.extend(Discourse.Scrolling, {
templateName: 'list/topics',
categoryBinding: 'Discourse.router.listController.category',
filterModeBinding: 'Discourse.router.listController.filterMode',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ListView = Ember.View.extend({
window.Discourse.ListView = Discourse.View.extend({
templateName: 'list/list',
composeViewBinding: Ember.Binding.oneWay('Discourse.composeView'),
categoriesBinding: 'Discourse.site.categories',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.TopicListItemView = Ember.View.extend({
window.Discourse.TopicListItemView = Discourse.View.extend({
tagName: 'tr',
templateName: 'list/topic_list_item',
classNameBindings: ['content.archived', ':topic-list-item'],

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
templateName: 'modal/create_account',
title: Em.String.i18n('create_account.title'),
uniqueUsernameValidation: null,

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ForgotPasswordView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.ForgotPasswordView = Discourse.ModalBodyView.extend({
templateName: 'modal/forgot_password',
title: Em.String.i18n('forgot_password.title'),
/* You need a value in the field to submit it.

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.InviteModalView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.InviteModalView = Discourse.ModalBodyView.extend({
templateName: 'modal/invite',
title: Em.String.i18n('topic.invite_reply.title'),
email: null,

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.InvitePrivateModalView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.InvitePrivateModalView = Discourse.ModalBodyView.extend({
templateName: 'modal/invite_private',
title: Em.String.i18n('topic.invite_private.title'),
email: null,

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.LoginView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.LoginView = Discourse.ModalBodyView.extend({
templateName: 'modal/login',
siteBinding: 'Discourse.site',
title: Em.String.i18n('login.title'),

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ModalBodyView = window.Discourse.View.extend({
window.Discourse.ModalBodyView = Discourse.View.extend({
// Focus on first element
didInsertElement: function() {
var _this = this;

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.MoveSelectedView = window.Discourse.ModalBodyView.extend(Discourse.Presence, {
window.Discourse.MoveSelectedView = Discourse.ModalBodyView.extend({
templateName: 'modal/move_selected',
title: Em.String.i18n('topic.move_selected.title'),
saving: false,

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.OptionBooleanView = Em.View.extend({
window.Discourse.OptionBooleanView = Discourse.View.extend({
classNames: ['archetype-option'],
composerControllerBinding: 'Discourse.router.composerController',
templateName: "modal/option_boolean",

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.NavItemView = Ember.View.extend({
window.Discourse.NavItemView = Discourse.View.extend({
tagName: 'li',
classNameBindings: ['isActive', 'content.hasIcon:has-icon'],
attributeBindings: ['title'],

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.NotificationsView = Ember.View.extend({
window.Discourse.NotificationsView = Discourse.View.extend({
classNameBindings: ['content.read', ':notifications'],
templateName: 'notifications'
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ParticipantView = Ember.View.extend({
window.Discourse.ParticipantView = Discourse.View.extend({
templateName: 'participant',
toggled: (function() {
return this.get('controller.userFilters').contains(this.get('participant.username'));

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PostLinkView = Ember.View.extend({
window.Discourse.PostLinkView = Discourse.View.extend({
tagName: 'li',
classNameBindings: ['direction'],
direction: (function() {

View File

@ -13,7 +13,7 @@
(function() {
window.Discourse.PostMenuView = Ember.View.extend(Discourse.Presence, {
window.Discourse.PostMenuView = Discourse.View.extend({
tagName: 'section',
classNames: ['post-menu-area', 'clearfix'],
/* Delegate to render#{button}

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PostView = Ember.View.extend({
window.Discourse.PostView = Discourse.View.extend({
classNames: ['topic-post', 'clearfix'],
templateName: 'post',
classNameBindings: ['lastPostClass', 'postTypeClass', 'selectedClass', 'post.hidden:hidden', 'isDeleted:deleted', 'parentPost:replies-above'],

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.SearchView = Ember.View.extend(Discourse.Presence, {
window.Discourse.SearchView = Discourse.View.extend({
tagName: 'div',
classNames: ['d-dropdown'],
elementId: 'search-dropdown',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.SelectedPostsView = Ember.View.extend({
window.Discourse.SelectedPostsView = Discourse.View.extend({
elementId: 'selected-posts',
templateName: 'selected_posts',
topicBinding: 'controller.content',

View File

@ -1,6 +1,6 @@
(function() {
Discourse.SuggestedTopicView = Ember.View.extend({
Discourse.SuggestedTopicView = Discourse.View.extend({
templateName: 'suggested_topic'
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.TopicAdminMenuView = Em.View.extend({
window.Discourse.TopicAdminMenuView = Discourse.View.extend({
willDestroyElement: function() {
return jQuery('html').off('mouseup.discourse-topic-admin-menu');
},

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.TopicLinksView = Ember.View.extend({
window.Discourse.TopicLinksView = Discourse.View.extend({
templateName: 'topic_summary/links'
});

View File

@ -66,7 +66,7 @@
/* If we have a best of view
*/
if (this.get('controller.showBestOf')) {
container.pushObject(Discourse.View.create({
container.pushObject(Em.View.create({
templateName: 'topic_summary/best_of_toggle',
tagName: 'section',
classNames: ['information']
@ -76,7 +76,7 @@
*/
if (this.get('topic.isPrivateMessage')) {
return container.pushObject(Discourse.View.create({
return container.pushObject(Em.View.create({
templateName: 'topic_summary/private_message',
tagName: 'section',
classNames: ['information']

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.TopicView = Ember.View.extend(Discourse.Scrolling, {
window.Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
templateName: 'topic',
topicBinding: 'controller.content',
userFiltersBinding: 'controller.userFilters',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.ActivityFilterView = Em.View.extend(Discourse.Presence, {
window.Discourse.ActivityFilterView = Discourse.View.extend({
tagName: 'li',
classNameBindings: ['active'],
active: (function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PreferencesEmailView = Ember.View.extend({
window.Discourse.PreferencesEmailView = Discourse.View.extend({
templateName: 'user/email',
classNames: ['user-preferences'],
didInsertElement: function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PreferencesUsernameView = Ember.View.extend({
window.Discourse.PreferencesUsernameView = Discourse.View.extend({
templateName: 'user/username',
classNames: ['user-preferences'],
didInsertElement: function() {

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.PreferencesView = Ember.View.extend({
window.Discourse.PreferencesView = Discourse.View.extend({
templateName: 'user/preferences',
classNames: ['user-preferences']
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.UserActivityView = Ember.View.extend({
window.Discourse.UserActivityView = Discourse.View.extend({
templateName: 'user/activity',
currentUserBinding: 'Discourse.currentUser',
userBinding: 'controller.content',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.UserInvitedView = Ember.View.extend({
window.Discourse.UserInvitedView = Discourse.View.extend({
templateName: 'user/invited'
});

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.UserPrivateMessagesView = Ember.View.extend({
window.Discourse.UserPrivateMessagesView = Discourse.View.extend({
templateName: 'user/private_messages',
selectCurrent: function(evt) {
var t;

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.UserStreamView = Ember.View.extend(Discourse.Scrolling, {
window.Discourse.UserStreamView = Discourse.View.extend(Discourse.Scrolling, {
templateName: 'user/stream',
currentUserBinding: 'Discourse.currentUser',
userBinding: 'controller.content',

View File

@ -1,6 +1,6 @@
(function() {
window.Discourse.UserView = Ember.View.extend({
window.Discourse.UserView = Discourse.View.extend({
templateName: 'user/user',
userBinding: 'controller.content',
updateTitle: (function() {

View File

@ -1,13 +1,16 @@
(function() {
window.Discourse.View = Ember.View.extend(Discourse.Presence, {
/* Overwrite this to do a different display
*/
/**
A base view that gives us common functionality, for example `present` and `blank`
displayErrors: function(errors, callback) {
alert(errors.join("\n"));
return typeof callback === "function" ? callback() : void 0;
}
@class View
@extends Ember.View
@uses Discourse.Presence
@namespace Discourse
@module Discourse
**/
window.Discourse.View = Ember.View.extend(Discourse.Presence, {
});
}).call(this);

View File

@ -26,7 +26,6 @@
// Stuff we need to load first
//= require_tree ../../app/assets/javascripts/discourse/mixins
//= require ../../app/assets/javascripts/discourse/components/debounce
//= require ../../app/assets/javascripts/discourse/views/view
//= require ../../app/assets/javascripts/discourse/controllers/controller
//= require ../../app/assets/javascripts/discourse/views/modal/modal_body_view
//= require ../../app/assets/javascripts/discourse/models/model