mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Some javascript refactoring: Move markdown functions into their own classs, remove extraneous window.
calls.
This commit is contained in:
parent
e2ead81818
commit
1416bc7475
18 changed files with 32 additions and 36 deletions
|
@ -1,13 +1,13 @@
|
|||
/**
|
||||
Our data model for dealing with users from the admin section.
|
||||
|
||||
@class AdminUser
|
||||
@class AdminUser
|
||||
@extends Discourse.Model
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
**/
|
||||
Discourse.AdminUser = Discourse.Model.extend({
|
||||
|
||||
|
||||
deleteAllPosts: function() {
|
||||
this.set('can_delete_all_posts', false);
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/delete_all_posts", {type: 'PUT'});
|
||||
|
@ -137,7 +137,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
|
||||
});
|
||||
|
||||
window.Discourse.AdminUser.reopenClass({
|
||||
Discourse.AdminUser.reopenClass({
|
||||
|
||||
bulkApprove: function(users) {
|
||||
users.each(function(user) {
|
||||
|
|
|
@ -34,7 +34,7 @@ _getTransitionEndEventName = function() {
|
|||
};
|
||||
transitionEnd = _getTransitionEndEventName();
|
||||
|
||||
window.Discourse.TransitionHelper = {
|
||||
Discourse.TransitionHelper = {
|
||||
after: function(element, callback) {
|
||||
return $(element).on(transitionEnd, callback);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.CategoryList = Discourse.Model.extend({});
|
||||
Discourse.CategoryList = Discourse.Model.extend({});
|
||||
|
||||
window.Discourse.CategoryList.reopenClass({
|
||||
Discourse.CategoryList.reopenClass({
|
||||
|
||||
categoriesFrom: function(result) {
|
||||
var categories, users;
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.InputValidation = Discourse.Model.extend({});
|
||||
Discourse.InputValidation = Discourse.Model.extend({});
|
||||
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
}).property('reply_count')
|
||||
});
|
||||
|
||||
window.Discourse.Post.reopenClass({
|
||||
Discourse.Post.reopenClass({
|
||||
|
||||
createActionSummary: function(result) {
|
||||
var lookup;
|
||||
|
|
|
@ -343,7 +343,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
}
|
||||
});
|
||||
|
||||
window.Discourse.Topic.reopenClass({
|
||||
Discourse.Topic.reopenClass({
|
||||
NotificationLevel: {
|
||||
WATCHING: 3,
|
||||
TRACKING: 2,
|
||||
|
|
|
@ -138,7 +138,7 @@ Discourse.UserAction.reopenClass({
|
|||
GOT_PRIVATE_MESSAGE: 13
|
||||
});
|
||||
|
||||
window.Discourse.UserAction.reopenClass({
|
||||
Discourse.UserAction.reopenClass({
|
||||
statGroups: (function() {
|
||||
var g;
|
||||
g = {};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.ApplicationView = Discourse.View.extend({
|
||||
Discourse.ApplicationView = Discourse.View.extend({
|
||||
templateName: 'application'
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.FeaturedTopicsView = Discourse.View.extend({
|
||||
Discourse.FeaturedTopicsView = Discourse.View.extend({
|
||||
templateName: 'featured_topics',
|
||||
classNames: ['category-list-item']
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.ListCategoriesView = Discourse.View.extend({
|
||||
Discourse.ListCategoriesView = Discourse.View.extend({
|
||||
|
||||
templateName: 'list/categories',
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.ArchetypeOptionsModalView = window.Discourse.ModalBodyView.extend({
|
||||
Discourse.ArchetypeOptionsModalView = Discourse.ModalBodyView.extend({
|
||||
templateName: 'modal/archetype_options',
|
||||
title: Em.String.i18n('topic.options')
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.SearchView = Discourse.View.extend({
|
||||
Discourse.SearchView = Discourse.View.extend({
|
||||
tagName: 'div',
|
||||
classNames: ['d-dropdown'],
|
||||
elementId: 'search-dropdown',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.TopicAdminMenuView = Discourse.View.extend({
|
||||
Discourse.TopicAdminMenuView = Discourse.View.extend({
|
||||
|
||||
willDestroyElement: function() {
|
||||
$('html').off('mouseup.discourse-topic-admin-menu');
|
||||
|
|
|
@ -489,7 +489,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
}
|
||||
});
|
||||
|
||||
window.Discourse.TopicView.reopenClass({
|
||||
Discourse.TopicView.reopenClass({
|
||||
|
||||
// Scroll to a given post, if in the DOM. Returns whether it was in the DOM or not.
|
||||
scrollTo: function(topicId, postNumber, callback) {
|
||||
|
@ -504,11 +504,11 @@ window.Discourse.TopicView.reopenClass({
|
|||
header = $('header');
|
||||
title = $('#topic-title');
|
||||
expectedOffset = title.height() - header.find('.contents').height();
|
||||
|
||||
|
||||
if (expectedOffset < 0) {
|
||||
expectedOffset = 0;
|
||||
}
|
||||
|
||||
|
||||
$('html, body').scrollTop(existing.offset().top - (header.outerHeight(true) + expectedOffset));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.PreferencesEmailView = Discourse.View.extend({
|
||||
Discourse.PreferencesEmailView = Discourse.View.extend({
|
||||
templateName: 'user/email',
|
||||
classNames: ['user-preferences'],
|
||||
didInsertElement: function() {
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
window.Discourse.View = Ember.View.extend(Discourse.Presence, {});
|
||||
Discourse.View = Ember.View.extend(Discourse.Presence, {});
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
|
||||
/* These will help us migrate up to the new ember's default behavior
|
||||
*/
|
||||
|
||||
|
||||
window.ENV = {
|
||||
CP_DEFAULT_CACHEABLE: true,
|
||||
VIEW_PRESERVES_CONTEXT: true,
|
||||
MANDATORY_SETTER: false
|
||||
};
|
||||
|
||||
window.Discourse = {};
|
||||
|
||||
window.Discourse.SiteSettings = {};
|
||||
// These will help us migrate up to the new ember's default behavior
|
||||
window.ENV = {
|
||||
CP_DEFAULT_CACHEABLE: true,
|
||||
VIEW_PRESERVES_CONTEXT: true,
|
||||
MANDATORY_SETTER: false
|
||||
};
|
||||
|
||||
window.Discourse = {};
|
||||
Discourse.SiteSettings = {};
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
|
||||
Discourse.Environment = '<%= Rails.env %>';
|
||||
window.Discourse.Router.map(function() {
|
||||
Discourse.Router.map(function() {
|
||||
return Discourse.routeBuilder.call(this);
|
||||
});
|
||||
Discourse.start()
|
||||
|
|
Loading…
Reference in a new issue