Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 20 commits
  • 230 files changed
  • 0 commit comments
  • 7 contributors
Commits on Feb 23, 2013
@kubabrecka kubabrecka 'pseudo' locale files for testing/development + script to generate th…
…ese files
623cc66
Commits on Feb 25, 2013
@jyggen jyggen Added swedish translation for client strings. 4990eab
@nverba nverba Update config/routes.rb
Facebook and Twitter controllers are no longer defined. 
c6eeffe
@nverba nverba Fixed broken link to Vagrant Docs 5016657
@nverba nverba Fixed broken link to Vagrant Docs 602a79f
@goshakkk goshakkk avoid unused variable warning in Topic 054a699
@nlalonde nlalonde Dashboard JS checks version every 12 hours 0321643
@eviltrout eviltrout Clean up JS, add YUIDoc support, automatically create IIFE via asset …
…pipeline
e461c84
@coding-horror coding-horror add thinkgeek to onebox whitelist 11bf337
@eviltrout eviltrout Merge pull request #262 from goshakkk/no-unused-var-warn
Avoid unused variable (post) warning in Topic
2ba2809
@eviltrout eviltrout Merge pull request #261 from nverba/patch-2
Fixed broken link to Vagrant Docs
dbfbc34
@eviltrout eviltrout Merge pull request #260 from nverba/patch-1
Update config/routes.rb
c69cac5
@eviltrout eviltrout Merge pull request #257 from jyggen/master
Swedish translation of client strings
4be869d
@eviltrout eviltrout Merge pull request #237 from kubabrecka/pseudolocalization
'pseudo' locale files for testing/development + script to generate these files
2a7345b
@eviltrout eviltrout Oops I missed a couple of jshint errors :) 3e201fc
@coding-horror coding-horror some copyedits on admin / email d9d3419
@eviltrout eviltrout Better error messages when topics can't load 397c6ca
@eviltrout eviltrout Ack! Messed up the jshint again. I gotta get better about this. e28594b
Commits on Feb 26, 2013
@coding-horror coding-horror minor copyedits around login / email ea9196a
@coding-horror coding-horror copyedit topic load failure messages b50e053
Showing with 4,620 additions and 4,711 deletions.
  1. +1 −1 Vagrantfile
  2. +57 −61 app/assets/javascripts/admin/controllers/admin_customize_controller.js
  3. +11 −15 app/assets/javascripts/admin/controllers/admin_dashboard_controller.js
  4. +34 −38 app/assets/javascripts/admin/controllers/admin_email_logs_controller.js
  5. +57 −61 app/assets/javascripts/admin/controllers/admin_flags_controller.js
  6. +58 −62 app/assets/javascripts/admin/controllers/admin_site_settings_controller.js
  7. +100 −104 app/assets/javascripts/admin/controllers/admin_users_list_controller.js
  8. +183 −187 app/assets/javascripts/admin/models/admin_user.js
  9. +29 −31 app/assets/javascripts/admin/models/email_log.js
  10. +103 −105 app/assets/javascripts/admin/models/flagged_post.js
  11. +100 −105 app/assets/javascripts/admin/models/site_customization.js
  12. +59 −61 app/assets/javascripts/admin/models/site_setting.js
  13. +31 −35 app/assets/javascripts/admin/models/version_check.js
  14. +15 −17 app/assets/javascripts/admin/routes/admin_customize_route.js
  15. +25 −21 app/assets/javascripts/admin/routes/admin_dashboard_route.js
  16. +15 −17 app/assets/javascripts/admin/routes/admin_email_logs_route.js
  17. +17 −19 app/assets/javascripts/admin/routes/admin_flags_active_route.js
  18. +18 −20 app/assets/javascripts/admin/routes/admin_flags_old_route.js
  19. +12 −14 app/assets/javascripts/admin/routes/admin_flags_route.js
  20. +12 −14 app/assets/javascripts/admin/routes/admin_route.js
  21. +25 −24 app/assets/javascripts/admin/routes/admin_routes.js
  22. +15 −17 app/assets/javascripts/admin/routes/admin_site_settings_route.js
  23. +15 −17 app/assets/javascripts/admin/routes/admin_user_route.js
  24. +12 −14 app/assets/javascripts/admin/routes/admin_users_list_active_route.js
  25. +12 −14 app/assets/javascripts/admin/routes/admin_users_list_new_route.js
  26. +12 −14 app/assets/javascripts/admin/routes/admin_users_list_pending_route.js
  27. +12 −14 app/assets/javascripts/admin/routes/admin_users_list_route.js
  28. +56 −57 app/assets/javascripts/admin/views/ace_editor_view.js
  29. +49 −50 app/assets/javascripts/admin/views/admin_customize_view.js
  30. +26 −28 app/assets/javascripts/admin/views/admin_dashboard_view.js
  31. +1 −0 app/assets/javascripts/application.js.erb
  32. +341 −342 app/assets/javascripts/discourse.js
  33. +296 −292 app/assets/javascripts/discourse/components/autocomplete.js
  34. +174 −203 app/assets/javascripts/discourse/components/bbcode.js
  35. +133 −134 app/assets/javascripts/discourse/components/caret_position.js
  36. +86 −93 app/assets/javascripts/discourse/components/click_track.js
  37. +12 −2 app/assets/javascripts/discourse/components/debounce.js
  38. +0 −10 app/assets/javascripts/discourse/components/discourse_text_field.js
  39. +83 −84 app/assets/javascripts/discourse/components/div_resizer.js
  40. +90 −122 app/assets/javascripts/discourse/components/eyeline.js
  41. +46 −45 app/assets/javascripts/discourse/components/key_value_store.js
  42. +16 −20 app/assets/javascripts/discourse/components/lightbox.js
  43. +59 −0 app/assets/javascripts/discourse/components/mention.js
  44. +140 −142 app/assets/javascripts/discourse/components/message_bus.js
  45. +89 −0 app/assets/javascripts/discourse/components/onebox.js
  46. +0 −38 app/assets/javascripts/discourse/components/pagedown_editor.js
  47. +20 −21 app/assets/javascripts/discourse/components/probes.js
  48. +0 −92 app/assets/javascripts/discourse/components/sanitize.js
  49. +152 −162 app/assets/javascripts/discourse/components/screen_track.js
  50. +23 −13 app/assets/javascripts/discourse/components/syntax_highlighting.js
  51. +33 −35 app/assets/javascripts/discourse/components/transition_helper.js
  52. +71 −66 app/assets/javascripts/discourse/components/user_search.js
  53. +245 −256 app/assets/javascripts/discourse/components/utilities.js
  54. +11 −2 app/assets/javascripts/discourse/controllers/application_controller.js
  55. +243 −233 app/assets/javascripts/discourse/controllers/composer_controller.js
  56. +10 −3 app/assets/javascripts/discourse/controllers/controller.js
  57. +21 −15 app/assets/javascripts/discourse/controllers/header_controller.js
  58. +41 −32 app/assets/javascripts/discourse/controllers/list_categories_controller.js
  59. +93 −85 app/assets/javascripts/discourse/controllers/list_controller.js
  60. +65 −65 app/assets/javascripts/discourse/controllers/list_topics_controller.js
  61. +13 −7 app/assets/javascripts/discourse/controllers/modal_controller.js
  62. +12 −0 app/assets/javascripts/discourse/controllers/object_controller.js
  63. +82 −151 app/assets/javascripts/discourse/controllers/preferences_controller.js
  64. +50 −48 app/assets/javascripts/discourse/controllers/preferences_email_controller.js
  65. +62 −67 app/assets/javascripts/discourse/controllers/preferences_username_controller.js
  66. +79 −79 app/assets/javascripts/discourse/controllers/quote_button_controller.js
  67. +29 −25 app/assets/javascripts/discourse/controllers/share_controller.js
  68. +33 −27 app/assets/javascripts/discourse/controllers/static_controller.js
  69. +20 −13 app/assets/javascripts/discourse/controllers/topic_admin_menu_controller.js
  70. +392 −397 app/assets/javascripts/discourse/controllers/topic_controller.js
  71. +25 −17 app/assets/javascripts/discourse/controllers/user_activity_controller.js
  72. +21 −12 app/assets/javascripts/discourse/controllers/user_controller.js
  73. +14 −8 app/assets/javascripts/discourse/controllers/user_invited_controller.js
  74. +23 −16 app/assets/javascripts/discourse/controllers/user_private_messages_controller.js
Sorry, we could not display the entire diff because it was too big.
View
2 Vagrantfile
@@ -1,6 +1,6 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
-# See https://github.com/discourse/core/blob/master/DEVELOPMENT.md
+# See https://github.com/discourse/discourse/blob/master/docs/VAGRANT.md
#
Vagrant::Config.run do |config|
config.vm.box = 'discourse-pre'
View
118 app/assets/javascripts/admin/controllers/admin_customize_controller.js
@@ -1,63 +1,59 @@
-(function() {
+/**
+ This controller supports interface for creating custom CSS skins in Discourse.
+
+ @class AdminCustomizeController
+ @extends Ember.Controller
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminCustomizeController = Ember.Controller.extend({
+
+ /**
+ Create a new customization style
+
+ @method newCustomization
+ **/
+ newCustomization: function() {
+ var item = Discourse.SiteCustomization.create({name: 'New Style'});
+ this.get('content').pushObject(item);
+ this.set('content.selectedItem', item);
+ },
+
+ /**
+ Select a given style
+
+ @method selectStyle
+ @param {Discourse.SiteCustomization} style The style we are selecting
+ **/
+ selectStyle: function(style) {
+ this.set('content.selectedItem', style);
+ },
+
+ /**
+ Save the current customization
+
+ @method save
+ **/
+ save: function() {
+ this.get('content.selectedItem').save();
+ },
/**
- This controller supports interface for creating custom CSS skins in Discourse.
-
- @class AdminCustomizeController
- @extends Ember.Controller
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminCustomizeController = Ember.Controller.extend({
-
- /**
- Create a new customization style
-
- @method newCustomization
- **/
- newCustomization: function() {
- var item = Discourse.SiteCustomization.create({name: 'New Style'});
- this.get('content').pushObject(item);
- this.set('content.selectedItem', item);
- },
-
- /**
- Select a given style
-
- @method selectStyle
- @param {Discourse.SiteCustomization} style The style we are selecting
- **/
- selectStyle: function(style) {
- this.set('content.selectedItem', style);
- },
-
- /**
- Save the current customization
-
- @method save
- **/
- save: function() {
- this.get('content.selectedItem').save();
- },
-
- /**
- Destroy the current customization
-
- @method destroy
- **/
- destroy: function() {
- var _this = this;
- return bootbox.confirm(Em.String.i18n("admin.customize.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) {
- var selected;
- if (result) {
- selected = _this.get('content.selectedItem');
- selected["delete"]();
- _this.set('content.selectedItem', null);
- return _this.get('content').removeObject(selected);
- }
- });
- }
-
- });
-
-}).call(this);
+ Destroy the current customization
+
+ @method destroy
+ **/
+ destroy: function() {
+ var _this = this;
+ return bootbox.confirm(Em.String.i18n("admin.customize.delete_confirm"), Em.String.i18n("no_value"), Em.String.i18n("yes_value"), function(result) {
+ var selected;
+ if (result) {
+ selected = _this.get('content.selectedItem');
+ selected["delete"]();
+ _this.set('content.selectedItem', null);
+ return _this.get('content').removeObject(selected);
+ }
+ });
+ }
+
+});
View
26 app/assets/javascripts/admin/controllers/admin_dashboard_controller.js
@@ -1,16 +1,12 @@
-(function() {
+/**
+ This controller supports the default interface when you enter the admin section.
- /**
- This controller supports the default interface when you enter the admin section.
-
- @class AdminDashboardController
- @extends Ember.Controller
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminDashboardController = Ember.Controller.extend({
- loading: true,
- versionCheck: null
- });
-
-}).call(this);
+ @class AdminDashboardController
+ @extends Ember.Controller
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminDashboardController = Ember.Controller.extend({
+ loading: true,
+ versionCheck: null
+});
View
72 app/assets/javascripts/admin/controllers/admin_email_logs_controller.js
@@ -1,43 +1,39 @@
-(function() {
+/**
+ This controller supports the interface for reviewing email logs.
+ @class AdminEmailLogsController
+ @extends Ember.ArrayController
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, {
+
/**
- This controller supports the interface for reviewing email logs.
+ Is the "send test email" button disabled?
- @class AdminEmailLogsController
- @extends Ember.ArrayController
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, {
-
- /**
- Is the "send test email" button disabled?
+ @property sendTestEmailDisabled
+ **/
+ sendTestEmailDisabled: (function() {
+ return this.blank('testEmailAddress');
+ }).property('testEmailAddress'),
- @property sendTestEmailDisabled
- **/
- sendTestEmailDisabled: (function() {
- return this.blank('testEmailAddress');
- }).property('testEmailAddress'),
-
- /**
- Sends a test email to the currently entered email address
-
- @method sendTestEmail
- **/
- sendTestEmail: function() {
- var _this = this;
- _this.set('sentTestEmail', false);
- jQuery.ajax({
- url: '/admin/email_logs/test',
- type: 'POST',
- data: { email_address: this.get('testEmailAddress') },
- success: function() {
- return _this.set('sentTestEmail', true);
- }
- });
- return false;
- }
-
- });
+ /**
+ Sends a test email to the currently entered email address
-}).call(this);
+ @method sendTestEmail
+ **/
+ sendTestEmail: function() {
+ var _this = this;
+ _this.set('sentTestEmail', false);
+ jQuery.ajax({
+ url: '/admin/email_logs/test',
+ type: 'POST',
+ data: { email_address: this.get('testEmailAddress') },
+ success: function() {
+ return _this.set('sentTestEmail', true);
+ }
+ });
+ return false;
+ }
+
+});
View
118 app/assets/javascripts/admin/controllers/admin_flags_controller.js
@@ -1,63 +1,59 @@
-(function() {
+/**
+ This controller supports the interface for dealing with flags in the admin section.
+
+ @class AdminFlagsController
+ @extends Ember.Controller
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminFlagsController = Ember.Controller.extend({
+
+ /**
+ Clear all flags on a post
+
+ @method clearFlags
+ @param {Discourse.FlaggedPost} item The post whose flags we want to clear
+ **/
+ clearFlags: function(item) {
+ var _this = this;
+ item.clearFlags().then((function() {
+ _this.content.removeObject(item);
+ }), (function() {
+ bootbox.alert("something went wrong");
+ }));
+ },
+
+ /**
+ Deletes a post
+
+ @method deletePost
+ @param {Discourse.FlaggedPost} item The post to delete
+ **/
+ deletePost: function(item) {
+ var _this = this;
+ item.deletePost().then((function() {
+ _this.content.removeObject(item);
+ }), (function() {
+ bootbox.alert("something went wrong");
+ }));
+ },
+
+ /**
+ Are we viewing the 'old' view?
+
+ @property adminOldFlagsView
+ **/
+ adminOldFlagsView: (function() {
+ return this.query === 'old';
+ }).property('query'),
/**
- This controller supports the interface for dealing with flags in the admin section.
-
- @class AdminFlagsController
- @extends Ember.Controller
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminFlagsController = Ember.Controller.extend({
-
- /**
- Clear all flags on a post
-
- @method clearFlags
- @param {Discourse.FlaggedPost} item The post whose flags we want to clear
- **/
- clearFlags: function(item) {
- var _this = this;
- item.clearFlags().then((function() {
- _this.content.removeObject(item);
- }), (function() {
- bootbox.alert("something went wrong");
- }));
- },
-
- /**
- Deletes a post
-
- @method deletePost
- @param {Discourse.FlaggedPost} item The post to delete
- **/
- deletePost: function(item) {
- var _this = this;
- item.deletePost().then((function() {
- _this.content.removeObject(item);
- }), (function() {
- bootbox.alert("something went wrong");
- }));
- },
-
- /**
- Are we viewing the 'old' view?
-
- @property adminOldFlagsView
- **/
- adminOldFlagsView: (function() {
- return this.query === 'old';
- }).property('query'),
-
- /**
- Are we viewing the 'active' view?
-
- @property adminActiveFlagsView
- **/
- adminActiveFlagsView: (function() {
- return this.query === 'active';
- }).property('query')
-
- });
-
-}).call(this);
+ Are we viewing the 'active' view?
+
+ @property adminActiveFlagsView
+ **/
+ adminActiveFlagsView: (function() {
+ return this.query === 'active';
+ }).property('query')
+
+});
View
120 app/assets/javascripts/admin/controllers/admin_site_settings_controller.js
@@ -1,74 +1,70 @@
-(function() {
+/**
+ This controller supports the interface for SiteSettings.
- /**
- This controller supports the interface for SiteSettings.
+ @class AdminSiteSettingsController
+ @extends Ember.ArrayController
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, {
+ filter: null,
+ onlyOverridden: false,
- @class AdminSiteSettingsController
- @extends Ember.ArrayController
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, {
- filter: null,
- onlyOverridden: false,
+ /**
+ The list of settings based on the current filters
- /**
- The list of settings based on the current filters
+ @property filteredContent
+ **/
+ filteredContent: (function() {
+ var filter,
+ _this = this;
+ if (!this.present('content')) return null;
+ if (this.get('filter')) {
+ filter = this.get('filter').toLowerCase();
+ }
- @property filteredContent
- **/
- filteredContent: (function() {
- var filter,
- _this = this;
- if (!this.present('content')) return null;
- if (this.get('filter')) {
- filter = this.get('filter').toLowerCase();
+ return this.get('content').filter(function(item, index, enumerable) {
+ if (_this.get('onlyOverridden') && !item.get('overridden')) return false;
+ if (filter) {
+ if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true;
+ if (item.get('description').toLowerCase().indexOf(filter) > -1) return true;
+ if (item.get('value').toLowerCase().indexOf(filter) > -1) return true;
+ return false;
}
- return this.get('content').filter(function(item, index, enumerable) {
- if (_this.get('onlyOverridden') && !item.get('overridden')) return false;
- if (filter) {
- if (item.get('setting').toLowerCase().indexOf(filter) > -1) return true;
- if (item.get('description').toLowerCase().indexOf(filter) > -1) return true;
- if (item.get('value').toLowerCase().indexOf(filter) > -1) return true;
- return false;
- }
-
- return true;
- });
- }).property('filter', 'content.@each', 'onlyOverridden'),
-
- /**
- Reset a setting to its default value
+ return true;
+ });
+ }).property('filter', 'content.@each', 'onlyOverridden'),
- @method resetDefault
- @param {Discourse.SiteSetting} setting The setting we want to revert
- **/
- resetDefault: function(setting) {
- setting.set('value', setting.get('default'));
- setting.save();
- },
+ /**
+ Reset a setting to its default value
- /**
- Save changes to a site setting
+ @method resetDefault
+ @param {Discourse.SiteSetting} setting The setting we want to revert
+ **/
+ resetDefault: function(setting) {
+ setting.set('value', setting.get('default'));
+ setting.save();
+ },
- @method save
- @param {Discourse.SiteSetting} setting The setting we've changed
- **/
- save: function(setting) {
- setting.save();
- },
+ /**
+ Save changes to a site setting
- /**
- Cancel changes to a site setting
+ @method save
+ @param {Discourse.SiteSetting} setting The setting we've changed
+ **/
+ save: function(setting) {
+ setting.save();
+ },
- @method cancel
- @param {Discourse.SiteSetting} setting The setting we've changed but want to revert
- **/
- cancel: function(setting) {
- setting.resetValue();
- }
-
- });
+ /**
+ Cancel changes to a site setting
-}).call(this);
+ @method cancel
+ @param {Discourse.SiteSetting} setting The setting we've changed but want to revert
+ **/
+ cancel: function(setting) {
+ setting.resetValue();
+ }
+
+});
View
204 app/assets/javascripts/admin/controllers/admin_users_list_controller.js
@@ -1,111 +1,107 @@
-(function() {
+/**
+ This controller supports the interface for listing users in the admin section.
+
+ @class AdminUsersListController
+ @extends Ember.ArrayController
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Presence, {
+ username: null,
+ query: null,
+ selectAll: false,
+ content: null,
/**
- This controller supports the interface for listing users in the admin section.
-
- @class AdminUsersListController
- @extends Ember.ArrayController
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Presence, {
- username: null,
- query: null,
- selectAll: false,
- content: null,
-
- /**
- Triggered when the selectAll property is changed
-
- @event selectAll
- **/
- selectAllChanged: (function() {
- var _this = this;
- this.get('content').each(function(user) {
- user.set('selected', _this.get('selectAll'));
- });
- }).observes('selectAll'),
-
- /**
- Triggered when the username filter is changed
-
- @event filterUsers
- **/
- filterUsers: Discourse.debounce(function() {
- this.refreshUsers();
- }, 250).observes('username'),
+ Triggered when the selectAll property is changed
+
+ @event selectAll
+ **/
+ selectAllChanged: (function() {
+ var _this = this;
+ this.get('content').each(function(user) {
+ user.set('selected', _this.get('selectAll'));
+ });
+ }).observes('selectAll'),
+
+ /**
+ Triggered when the username filter is changed
+
+ @event filterUsers
+ **/
+ filterUsers: Discourse.debounce(function() {
+ this.refreshUsers();
+ }, 250).observes('username'),
+
+ /**
+ Triggered when the order of the users list is changed
+
+ @event orderChanged
+ **/
+ orderChanged: (function() {
+ this.refreshUsers();
+ }).observes('query'),
+
+ /**
+ Do we want to show the approval controls?
+
+ @property showApproval
+ **/
+ showApproval: (function() {
+ if (!Discourse.SiteSettings.must_approve_users) return false;
+ if (this.get('query') === 'new') return true;
+ if (this.get('query') === 'pending') return true;
+ }).property('query'),
- /**
- Triggered when the order of the users list is changed
+ /**
+ How many users are currently selected
- @event orderChanged
- **/
- orderChanged: (function() {
+ @property selectedCount
+ **/
+ selectedCount: (function() {
+ if (this.blank('content')) return 0;
+ return this.get('content').filterProperty('selected').length;
+ }).property('content.@each.selected'),
+
+ /**
+ Do we have any selected users?
+
+ @property hasSelection
+ **/
+ hasSelection: (function() {
+ return this.get('selectedCount') > 0;
+ }).property('selectedCount'),
+
+ /**
+ Refresh the current list of users.
+
+ @method refreshUsers
+ **/
+ refreshUsers: function() {
+ this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username')));
+ },
+
+
+ /**
+ Show the list of users.
+
+ @method show
+ **/
+ show: function(term) {
+ if (this.get('query') === term) {
this.refreshUsers();
- }).observes('query'),
-
- /**
- Do we want to show the approval controls?
-
- @property showApproval
- **/
- showApproval: (function() {
- if (!Discourse.SiteSettings.must_approve_users) return false;
- if (this.get('query') === 'new') return true;
- if (this.get('query') === 'pending') return true;
- }).property('query'),
-
- /**
- How many users are currently selected
-
- @property selectedCount
- **/
- selectedCount: (function() {
- if (this.blank('content')) return 0;
- return this.get('content').filterProperty('selected').length;
- }).property('content.@each.selected'),
-
- /**
- Do we have any selected users?
-
- @property hasSelection
- **/
- hasSelection: (function() {
- return this.get('selectedCount') > 0;
- }).property('selectedCount'),
-
- /**
- Refresh the current list of users.
-
- @method refreshUsers
- **/
- refreshUsers: function() {
- this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username')));
- },
-
-
- /**
- Show the list of users.
-
- @method show
- **/
- show: function(term) {
- if (this.get('query') === term) {
- this.refreshUsers();
- return;
- }
- this.set('query', term);
- },
-
- /**
- Approve all the currently selected users.
-
- @method approveUsers
- **/
- approveUsers: function() {
- Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected'));
+ return;
}
-
- });
+ this.set('query', term);
+ },
-}).call(this);
+ /**
+ Approve all the currently selected users.
+
+ @method approveUsers
+ **/
+ approveUsers: function() {
+ Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected'));
+ }
+
+});
View
370 app/assets/javascripts/admin/models/admin_user.js
@@ -1,190 +1,186 @@
-(function() {
-
- /**
- Our data model for dealing with users from the admin section.
-
- @class AdminUser
- @extends Discourse.Model
- @namespace Discourse
- @module Discourse
- **/
- window.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'});
- },
-
- // Revoke the user's admin access
- revokeAdmin: function() {
- this.set('admin', false);
- this.set('can_grant_admin', true);
- this.set('can_revoke_admin', false);
- return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_admin", {type: 'PUT'});
- },
-
- grantAdmin: function() {
- this.set('admin', true);
- this.set('can_grant_admin', false);
- this.set('can_revoke_admin', true);
- jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_admin", {type: 'PUT'});
- },
-
- // Revoke the user's moderation access
- revokeModeration: function() {
- this.set('moderator', false);
- this.set('can_grant_moderation', true);
- this.set('can_revoke_moderation', false);
- return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_moderation", {type: 'PUT'});
- },
-
- grantModeration: function() {
- this.set('moderator', true);
- this.set('can_grant_moderation', false);
- this.set('can_revoke_moderation', true);
- jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_moderation", {type: 'PUT'});
- },
-
- refreshBrowsers: function() {
- jQuery.ajax("/admin/users/" + (this.get('id')) + "/refresh_browsers", {type: 'POST'});
- bootbox.alert("Message sent to all clients!");
- },
-
- approve: function() {
- this.set('can_approve', false);
- this.set('approved', true);
- this.set('approved_by', Discourse.get('currentUser'));
- jQuery.ajax("/admin/users/" + (this.get('id')) + "/approve", {type: 'PUT'});
- },
-
- username_lower: (function() {
- return this.get('username').toLowerCase();
- }).property('username'),
-
- trustLevel: (function() {
- return Discourse.get('site.trust_levels').findProperty('id', this.get('trust_level'));
- }).property('trust_level'),
-
- canBan: (function() {
- return !this.admin && !this.moderator;
- }).property('admin', 'moderator'),
-
- banDuration: (function() {
- var banned_at, banned_till;
- banned_at = Date.create(this.banned_at);
- banned_till = Date.create(this.banned_till);
- return "" + (banned_at.short()) + " - " + (banned_till.short());
- }).property('banned_till', 'banned_at'),
-
- ban: function() {
- var duration,
- _this = this;
- if (duration = parseInt(window.prompt(Em.String.i18n('admin.user.ban_duration')), 10)) {
- if (duration > 0) {
- return jQuery.ajax("/admin/users/" + this.id + "/ban", {
- type: 'PUT',
- data: {duration: duration},
- success: function() {
- window.location.reload();
- },
- error: function(e) {
- var error;
- error = Em.String.i18n('admin.user.ban_failed', {
- error: "http: " + e.status + " - " + e.body
- });
- bootbox.alert(error);
- }
- });
- }
- }
- },
-
- unban: function() {
- var _this = this;
- return jQuery.ajax("/admin/users/" + this.id + "/unban", {
- type: 'PUT',
- success: function() {
- window.location.reload();
- },
- error: function(e) {
- var error;
- error = Em.String.i18n('admin.user.unban_failed', {
- error: "http: " + e.status + " - " + e.body
- });
- bootbox.alert(error);
- }
- });
- },
-
- impersonate: function() {
- var _this = this;
- return jQuery.ajax("/admin/impersonate", {
- type: 'POST',
- data: {
- username_or_email: this.get('username')
- },
- success: function() {
- document.location = "/";
- },
- error: function(e) {
- _this.set('loading', false);
- if (e.status === 404) {
- return bootbox.alert(Em.String.i18n('admin.impersonate.not_found'));
- } else {
- return bootbox.alert(Em.String.i18n('admin.impersonate.invalid'));
+/**
+ Our data model for dealing with users from the admin section.
+
+ @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'});
+ },
+
+ // Revoke the user's admin access
+ revokeAdmin: function() {
+ this.set('admin', false);
+ this.set('can_grant_admin', true);
+ this.set('can_revoke_admin', false);
+ return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_admin", {type: 'PUT'});
+ },
+
+ grantAdmin: function() {
+ this.set('admin', true);
+ this.set('can_grant_admin', false);
+ this.set('can_revoke_admin', true);
+ jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_admin", {type: 'PUT'});
+ },
+
+ // Revoke the user's moderation access
+ revokeModeration: function() {
+ this.set('moderator', false);
+ this.set('can_grant_moderation', true);
+ this.set('can_revoke_moderation', false);
+ return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_moderation", {type: 'PUT'});
+ },
+
+ grantModeration: function() {
+ this.set('moderator', true);
+ this.set('can_grant_moderation', false);
+ this.set('can_revoke_moderation', true);
+ jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_moderation", {type: 'PUT'});
+ },
+
+ refreshBrowsers: function() {
+ jQuery.ajax("/admin/users/" + (this.get('id')) + "/refresh_browsers", {type: 'POST'});
+ bootbox.alert("Message sent to all clients!");
+ },
+
+ approve: function() {
+ this.set('can_approve', false);
+ this.set('approved', true);
+ this.set('approved_by', Discourse.get('currentUser'));
+ jQuery.ajax("/admin/users/" + (this.get('id')) + "/approve", {type: 'PUT'});
+ },
+
+ username_lower: (function() {
+ return this.get('username').toLowerCase();
+ }).property('username'),
+
+ trustLevel: (function() {
+ return Discourse.get('site.trust_levels').findProperty('id', this.get('trust_level'));
+ }).property('trust_level'),
+
+ canBan: (function() {
+ return !this.admin && !this.moderator;
+ }).property('admin', 'moderator'),
+
+ banDuration: (function() {
+ var banned_at, banned_till;
+ banned_at = Date.create(this.banned_at);
+ banned_till = Date.create(this.banned_till);
+ return "" + (banned_at.short()) + " - " + (banned_till.short());
+ }).property('banned_till', 'banned_at'),
+
+ ban: function() {
+ var duration,
+ _this = this;
+ if (duration = parseInt(window.prompt(Em.String.i18n('admin.user.ban_duration')), 10)) {
+ if (duration > 0) {
+ return jQuery.ajax("/admin/users/" + this.id + "/ban", {
+ type: 'PUT',
+ data: {duration: duration},
+ success: function() {
+ window.location.reload();
+ },
+ error: function(e) {
+ var error;
+ error = Em.String.i18n('admin.user.ban_failed', {
+ error: "http: " + e.status + " - " + e.body
+ });
+ bootbox.alert(error);
}
- }
- });
+ });
+ }
}
-
- });
-
- window.Discourse.AdminUser.reopenClass({
-
- bulkApprove: function(users) {
- users.each(function(user) {
- user.set('approved', true);
- user.set('can_approve', false);
- return user.set('selected', false);
- });
- return jQuery.ajax("/admin/users/approve-bulk", {
- type: 'PUT',
- data: {
- users: users.map(function(u) {
- return u.id;
- })
- }
- });
- },
-
- find: function(username) {
- var promise;
- promise = new RSVP.Promise();
- jQuery.ajax({
- url: "/admin/users/" + username,
- success: function(result) {
- return promise.resolve(Discourse.AdminUser.create(result));
- }
- });
- return promise;
- },
-
- findAll: function(query, filter) {
- var result;
- result = Em.A();
- jQuery.ajax({
- url: "/admin/users/list/" + query + ".json",
- data: {
- filter: filter
- },
- success: function(users) {
- return users.each(function(u) {
- return result.pushObject(Discourse.AdminUser.create(u));
- });
+ },
+
+ unban: function() {
+ var _this = this;
+ return jQuery.ajax("/admin/users/" + this.id + "/unban", {
+ type: 'PUT',
+ success: function() {
+ window.location.reload();
+ },
+ error: function(e) {
+ var error;
+ error = Em.String.i18n('admin.user.unban_failed', {
+ error: "http: " + e.status + " - " + e.body
+ });
+ bootbox.alert(error);
+ }
+ });
+ },
+
+ impersonate: function() {
+ var _this = this;
+ return jQuery.ajax("/admin/impersonate", {
+ type: 'POST',
+ data: {
+ username_or_email: this.get('username')
+ },
+ success: function() {
+ document.location = "/";
+ },
+ error: function(e) {
+ _this.set('loading', false);
+ if (e.status === 404) {
+ return bootbox.alert(Em.String.i18n('admin.impersonate.not_found'));
+ } else {
+ return bootbox.alert(Em.String.i18n('admin.impersonate.invalid'));
}
- });
- return result;
- }
- });
-
-}).call(this);
+ }
+ });
+ }
+
+});
+
+window.Discourse.AdminUser.reopenClass({
+
+ bulkApprove: function(users) {
+ users.each(function(user) {
+ user.set('approved', true);
+ user.set('can_approve', false);
+ return user.set('selected', false);
+ });
+ return jQuery.ajax("/admin/users/approve-bulk", {
+ type: 'PUT',
+ data: {
+ users: users.map(function(u) {
+ return u.id;
+ })
+ }
+ });
+ },
+
+ find: function(username) {
+ var promise;
+ promise = new RSVP.Promise();
+ jQuery.ajax({
+ url: "/admin/users/" + username,
+ success: function(result) {
+ return promise.resolve(Discourse.AdminUser.create(result));
+ }
+ });
+ return promise;
+ },
+
+ findAll: function(query, filter) {
+ var result;
+ result = Em.A();
+ jQuery.ajax({
+ url: "/admin/users/list/" + query + ".json",
+ data: {
+ filter: filter
+ },
+ success: function(users) {
+ return users.each(function(u) {
+ return result.pushObject(Discourse.AdminUser.create(u));
+ });
+ }
+ });
+ return result;
+ }
+});
View
60 app/assets/javascripts/admin/models/email_log.js
@@ -1,38 +1,36 @@
-(function() {
+/**
+ Our data model for representing an email log.
- /**
- Our data model for representing an email log.
+ @class EmailLog
+ @extends Discourse.Model
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.EmailLog = Discourse.Model.extend({});
- @class EmailLog
- @extends Discourse.Model
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.EmailLog = Discourse.Model.extend({});
+Discourse.EmailLog.reopenClass({
- window.Discourse.EmailLog.reopenClass({
+ create: function(attrs) {
+ if (attrs.user) {
+ attrs.user = Discourse.AdminUser.create(attrs.user);
+ }
+ return this._super(attrs);
+ },
- create: function(attrs) {
- if (attrs.user) {
- attrs.user = Discourse.AdminUser.create(attrs.user);
+ findAll: function(filter) {
+ var result;
+ result = Em.A();
+ jQuery.ajax({
+ url: "/admin/email_logs.json",
+ data: { filter: filter },
+ success: function(logs) {
+ logs.each(function(log) {
+ result.pushObject(Discourse.EmailLog.create(log));
+ });
}
- return this._super(attrs);
- },
+ });
+ return result;
+ }
+});
- findAll: function(filter) {
- var result;
- result = Em.A();
- jQuery.ajax({
- url: "/admin/email_logs.json",
- data: { filter: filter },
- success: function(logs) {
- logs.each(function(log) {
- result.pushObject(Discourse.EmailLog.create(log));
- });
- }
- });
- return result;
- }
- });
-}).call(this);
View
208 app/assets/javascripts/admin/models/flagged_post.js
@@ -1,85 +1,56 @@
-(function() {
+/**
+ Our data model for interacting with flagged posts.
- /**
- Our data model for interacting with flagged posts.
+ @class FlaggedPost
+ @extends Discourse.Post
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.FlaggedPost = Discourse.Post.extend({
- @class FlaggedPost
- @extends Discourse.Post
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.FlaggedPost = Discourse.Post.extend({
+ flaggers: (function() {
+ var r,
+ _this = this;
+ r = [];
+ this.post_actions.each(function(a) {
+ return r.push(_this.userLookup[a.user_id]);
+ });
+ return r;
+ }).property(),
- flaggers: (function() {
- var r,
- _this = this;
- r = [];
- this.post_actions.each(function(a) {
- return r.push(_this.userLookup[a.user_id]);
- });
- return r;
- }).property(),
-
- messages: (function() {
- var r,
- _this = this;
- r = [];
- this.post_actions.each(function(a) {
- if (a.message) {
- return r.push({
- user: _this.userLookup[a.user_id],
- message: a.message
- });
- }
- });
- return r;
- }).property(),
-
- lastFlagged: (function() {
- return this.post_actions[0].created_at;
- }).property(),
+ messages: (function() {
+ var r,
+ _this = this;
+ r = [];
+ this.post_actions.each(function(a) {
+ if (a.message) {
+ return r.push({
+ user: _this.userLookup[a.user_id],
+ message: a.message
+ });
+ }
+ });
+ return r;
+ }).property(),
- user: (function() {
- return this.userLookup[this.user_id];
- }).property(),
+ lastFlagged: (function() {
+ return this.post_actions[0].created_at;
+ }).property(),
- topicHidden: (function() {
- return this.get('topic_visible') === 'f';
- }).property('topic_hidden'),
+ user: (function() {
+ return this.userLookup[this.user_id];
+ }).property(),
- deletePost: function() {
- var promise;
- promise = new RSVP.Promise();
- if (this.get('post_number') === "1") {
- return jQuery.ajax("/t/" + this.topic_id, {
- type: 'DELETE',
- cache: false,
- success: function() {
- promise.resolve();
- },
- error: function(e) {
- promise.reject();
- }
- });
- } else {
- return jQuery.ajax("/posts/" + this.id, {
- type: 'DELETE',
- cache: false,
- success: function() {
- promise.resolve();
- },
- error: function(e) {
- promise.reject();
- }
- });
- }
- },
+ topicHidden: (function() {
+ return this.get('topic_visible') === 'f';
+ }).property('topic_hidden'),
- clearFlags: function() {
- var promise;
- promise = new RSVP.Promise();
- jQuery.ajax("/admin/flags/clear/" + this.id, {
- type: 'POST',
+ deletePost: function() {
+ var promise;
+ promise = new RSVP.Promise();
+ if (this.get('post_number') === "1") {
+ return jQuery.ajax("/t/" + this.topic_id, {
+ type: 'DELETE',
cache: false,
success: function() {
promise.resolve();
@@ -88,37 +59,64 @@
promise.reject();
}
});
- return promise;
- },
-
- hiddenClass: (function() {
- if (this.get('hidden') === "t") return "hidden-post";
- }).property()
-
- });
-
- window.Discourse.FlaggedPost.reopenClass({
- findAll: function(filter) {
- var result;
- result = Em.A();
- jQuery.ajax({
- url: "/admin/flags/" + filter + ".json",
- success: function(data) {
- var userLookup;
- userLookup = {};
- data.users.each(function(u) {
- userLookup[u.id] = Discourse.User.create(u);
- });
- return data.posts.each(function(p) {
- var f;
- f = Discourse.FlaggedPost.create(p);
- f.userLookup = userLookup;
- return result.pushObject(f);
- });
+ } else {
+ return jQuery.ajax("/posts/" + this.id, {
+ type: 'DELETE',
+ cache: false,
+ success: function() {
+ promise.resolve();
+ },
+ error: function(e) {
+ promise.reject();
}
});
- return result;
}
- });
+ },
+
+ clearFlags: function() {
+ var promise;
+ promise = new RSVP.Promise();
+ jQuery.ajax("/admin/flags/clear/" + this.id, {
+ type: 'POST',
+ cache: false,
+ success: function() {
+ promise.resolve();
+ },
+ error: function(e) {
+ promise.reject();
+ }
+ });
+ return promise;
+ },
+
+ hiddenClass: (function() {
+ if (this.get('hidden') === "t") return "hidden-post";
+ }).property()
+
+});
+
+Discourse.FlaggedPost.reopenClass({
+ findAll: function(filter) {
+ var result;
+ result = Em.A();
+ jQuery.ajax({
+ url: "/admin/flags/" + filter + ".json",
+ success: function(data) {
+ var userLookup;
+ userLookup = {};
+ data.users.each(function(u) {
+ userLookup[u.id] = Discourse.User.create(u);
+ });
+ return data.posts.each(function(p) {
+ var f;
+ f = Discourse.FlaggedPost.create(p);
+ f.userLookup = userLookup;
+ return result.pushObject(f);
+ });
+ }
+ });
+ return result;
+ }
+});
+
-}).call(this);
View
205 app/assets/javascripts/admin/models/site_customization.js
@@ -1,117 +1,112 @@
-(function() {
- var SiteCustomizations;
+/**
+ Our data model for interacting with site customizations.
- /**
- Our data model for interacting with site customizations.
+ @class SiteCustomization
+ @extends Discourse.Model
+ @namespace Discourse
+ @module Discourse
+**/
+Discourse.SiteCustomization = Discourse.Model.extend({
+ trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'override_default_style'],
- @class SiteCustomization
- @extends Discourse.Model
- @namespace Discourse
- @module Discourse
- **/
- window.Discourse.SiteCustomization = Discourse.Model.extend({
- trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'override_default_style'],
+ init: function() {
+ this._super();
+ return this.startTrackingChanges();
+ },
+
+ description: (function() {
+ return "" + this.name + (this.enabled ? ' (*)' : '');
+ }).property('selected', 'name'),
- init: function() {
- this._super();
- return this.startTrackingChanges();
- },
-
- description: (function() {
- return "" + this.name + (this.enabled ? ' (*)' : '');
- }).property('selected', 'name'),
-
- changed: (function() {
- var _this = this;
- if (!this.originals) {
- return false;
- }
- return this.trackedProperties.any(function(p) {
- return _this.originals[p] !== _this.get(p);
- });
- }).property('override_default_style', 'enabled', 'name', 'stylesheet', 'header', 'originals'),
+ changed: (function() {
+ var _this = this;
+ if (!this.originals) {
+ return false;
+ }
+ return this.trackedProperties.any(function(p) {
+ return _this.originals[p] !== _this.get(p);
+ });
+ }).property('override_default_style', 'enabled', 'name', 'stylesheet', 'header', 'originals'),
- startTrackingChanges: function() {
- var _this = this;
- this.set('originals', {});
- return this.trackedProperties.each(function(p) {
- _this.originals[p] = _this.get(p);
- return true;
- });
- },
+ startTrackingChanges: function() {
+ var _this = this;
+ this.set('originals', {});
+ return this.trackedProperties.each(function(p) {
+ _this.originals[p] = _this.get(p);
+ return true;
+ });
+ },
- previewUrl: (function() {
- return "/?preview-style=" + (this.get('key'));
- }).property('key'),
+ previewUrl: (function() {
+ return "/?preview-style=" + (this.get('key'));
+ }).property('key'),
- disableSave: (function() {
- return !this.get('changed');
- }).property('changed'),
+ disableSave: (function() {
+ return !this.get('changed');
+ }).property('changed'),
- save: function() {
- var data;
- this.startTrackingChanges();
- data = {
- name: this.name,
- enabled: this.enabled,
- stylesheet: this.stylesheet,
- header: this.header,
- override_default_style: this.override_default_style
- };
- return jQuery.ajax({
- url: "/admin/site_customizations" + (this.id ? '/' + this.id : ''),
- data: {
- site_customization: data
- },
- type: this.id ? 'PUT' : 'POST'
- });
- },
+ save: function() {
+ var data;
+ this.startTrackingChanges();
+ data = {
+ name: this.name,
+ enabled: this.enabled,
+ stylesheet: this.stylesheet,
+ header: this.header,
+ override_default_style: this.override_default_style
+ };
+ return jQuery.ajax({
+ url: "/admin/site_customizations" + (this.id ? '/' + this.id : ''),
+ data: {
+ site_customization: data
+ },
+ type: this.id ? 'PUT' : 'POST'
+ });
+ },
- "delete": function() {
- if (!this.id) return;
-
- return jQuery.ajax({
- url: "/admin/site_customizations/" + this.id,
- type: 'DELETE'
- });
- }
+ "delete": function() {
+ if (!this.id) return;
+
+ return jQuery.ajax({
+ url: "/admin/site_customizations/" + this.id,
+ type: 'DELETE'
+ });
+ }
- });
+});
- SiteCustomizations = Ember.ArrayProxy.extend({
- selectedItemChanged: (function() {
- var selected;
- selected = this.get('selectedItem');
- return this.get('content').each(function(i) {
- return i.set('selected', selected === i);
- });
- }).observes('selectedItem')
- });
+var SiteCustomizations = Ember.ArrayProxy.ext