Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

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.
base fork: kevinansfield/discourse
base: ea861ebb57
...
head fork: kevinansfield/discourse
compare: b50e0536c7
  • 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 14,135 additions and 12,116 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
  75. +234 −164 app/assets/javascripts/discourse/helpers/application_helpers.js
  76. +54 −45 app/assets/javascripts/discourse/helpers/i18n_helpers.js
  77. +42 −44 app/assets/javascripts/discourse/mixins/presence.js
  78. +36 −23 app/assets/javascripts/discourse/mixins/scrolling.js
  79. +111 −111 app/assets/javascripts/discourse/models/action_summary.js
  80. +22 −15 app/assets/javascripts/discourse/models/archetype.js
  81. +53 −43 app/assets/javascripts/discourse/models/category.js
  82. +47 −38 app/assets/javascripts/discourse/models/category_list.js
  83. +505 −537 app/assets/javascripts/discourse/models/composer.js
  84. +72 −74 app/assets/javascripts/discourse/models/draft.js
  85. +9 −3 app/assets/javascripts/discourse/models/input_validation.js
  86. +33 −24 app/assets/javascripts/discourse/models/invite.js
  87. +40 −32 app/assets/javascripts/discourse/models/invite_list.js
  88. +0 −54 app/assets/javascripts/discourse/models/mention.js
  89. +65 −67 app/assets/javascripts/discourse/models/model.js
  90. +57 −61 app/assets/javascripts/discourse/models/nav_item.js
  91. +43 −38 app/assets/javascripts/discourse/models/notification.js
  92. +0 −83 app/assets/javascripts/discourse/models/onebox.js
  93. +314 −343 app/assets/javascripts/discourse/models/post.js
  94. +21 −14 app/assets/javascripts/discourse/models/post_action_type.js
  95. +62 −56 app/assets/javascripts/discourse/models/site.js
  96. +406 −442 app/assets/javascripts/discourse/models/topic.js
  97. +121 −110 app/assets/javascripts/discourse/models/topic_list.js
  98. +304 −293 app/assets/javascripts/discourse/models/user.js
  99. +141 −130 app/assets/javascripts/discourse/models/user_action.js
  100. +15 −9 app/assets/javascripts/discourse/models/user_action_group.js
  101. +9 −3 app/assets/javascripts/discourse/models/user_action_stat.js
  102. +17 −11 app/assets/javascripts/discourse/routes/application_route.js
  103. +45 −41 app/assets/javascripts/discourse/routes/application_routes.js
  104. +6 −5 app/assets/javascripts/discourse/routes/discourse_location.js
  105. +21 −13 app/assets/javascripts/discourse/routes/discourse_restricted_user_route.js
  106. +22 −24 app/assets/javascripts/discourse/routes/discourse_route.js
  107. +45 −40 app/assets/javascripts/discourse/routes/filtered_list_route.js
  108. +32 −23 app/assets/javascripts/discourse/routes/list_categories_route.js
  109. +35 −30 app/assets/javascripts/discourse/routes/list_category_route.js
  110. +21 −15 app/assets/javascripts/discourse/routes/preferences_email_route.js
  111. +23 −14 app/assets/javascripts/discourse/routes/preferences_route.js
  112. +21 −16 app/assets/javascripts/discourse/routes/preferences_username_route.js
  113. +20 −12 app/assets/javascripts/discourse/routes/static_route.js
  114. +22 −14 app/assets/javascripts/discourse/routes/topic_best_of_route.js
  115. +22 −14 app/assets/javascripts/discourse/routes/topic_from_params_route.js
  116. +42 −31 app/assets/javascripts/discourse/routes/topic_route.js
  117. +21 −16 app/assets/javascripts/discourse/routes/user_activity_route.js
  118. +21 −16 app/assets/javascripts/discourse/routes/user_invited_route.js
  119. +32 −26 app/assets/javascripts/discourse/routes/user_private_messages_route.js
  120. +15 −17 app/assets/javascripts/discourse/routes/user_route.js
  121. +1 −1  app/assets/javascripts/discourse/templates/embedded_post.js.handlebars
  122. +6 −6 app/assets/javascripts/discourse/templates/post.js.handlebars
  123. +8 −8 app/assets/javascripts/discourse/templates/suggested_topic.js.handlebars
  124. +5 −5 app/assets/javascripts/discourse/templates/topic.js.handlebars
  125. +2 −2 app/assets/javascripts/discourse/templates/topic_extra_info.js.handlebars
  126. +83 −74 app/assets/javascripts/discourse/views/actions_history_view.js
  127. +11 −5 app/assets/javascripts/discourse/views/application_view.js
  128. +0 −8 app/assets/javascripts/discourse/views/archetype_options_modal_view.js
  129. +0 −24 app/assets/javascripts/discourse/views/auto_sized_text_view.js
  130. +28 −18 app/assets/javascripts/discourse/views/button_view.js
  131. +49 −40 app/assets/javascripts/discourse/views/combobox_view.js
  132. +20 −14 app/assets/javascripts/discourse/views/combobox_view_category.js
  133. +376 −376 app/assets/javascripts/discourse/views/composer_view.js
  134. +18 −0 app/assets/javascripts/discourse/views/discourse_text_field.js
  135. +54 −44 app/assets/javascripts/discourse/views/dropdown_button_view.js
  136. +20 −13 app/assets/javascripts/discourse/views/embedded_post_view.js
  137. +0 −44 app/assets/javascripts/discourse/views/excerpt/excerpt_category_view.js
  138. +0 −30 app/assets/javascripts/discourse/views/excerpt/excerpt_post_view.js
  139. +0 −26 app/assets/javascripts/discourse/views/excerpt/excerpt_user_view.js
  140. +0 −185 app/assets/javascripts/discourse/views/excerpt/excerpt_view.js
  141. +0 −12 app/assets/javascripts/discourse/views/featured_threads_view.js
  142. +12 −6 app/assets/javascripts/discourse/views/featured_topics_view.js
  143. +0 −83 app/assets/javascripts/discourse/views/flag_view.js
  144. +116 −111 app/assets/javascripts/discourse/views/header_view.js
  145. +0 −42 app/assets/javascripts/discourse/views/history_view.js
  146. +0 −32 app/assets/javascripts/discourse/views/image_selector.js
  147. +31 −21 app/assets/javascripts/discourse/views/input_tip_view.js
  148. +17 −8 app/assets/javascripts/discourse/views/list/list_categories_view.js
  149. +103 −90 app/assets/javascripts/discourse/views/list/list_topics_view.js
  150. +30 −23 app/assets/javascripts/discourse/views/list/list_view.js
  151. +46 −35 app/assets/javascripts/discourse/views/list/topic_list_item_view.js
  152. +14 −0 app/assets/javascripts/discourse/views/modal/archetype_options_modal_view.js
  153. +29 −21 app/assets/javascripts/discourse/views/modal/archetype_options_view.js
  154. +229 −241 app/assets/javascripts/discourse/views/modal/create_account_view.js
  155. +58 −60 app/assets/javascripts/discourse/views/modal/edit_category_view.js
  156. +84 −0 app/assets/javascripts/discourse/views/modal/flag_view.js
  157. +25 −20 app/assets/javascripts/discourse/views/modal/forgot_password_view.js
  158. +52 −0 app/assets/javascripts/discourse/views/modal/history_view.js
  159. +42 −0 app/assets/javascripts/discourse/views/modal/image_selector.js
  160. +59 −58 app/assets/javascripts/discourse/views/modal/invite_modal_view.js
  161. +49 −47 app/assets/javascripts/discourse/views/modal/invite_private_modal_view.js
  162. +138 −132 app/assets/javascripts/discourse/views/modal/login_view.js
  163. +32 −25 app/assets/javascripts/discourse/views/modal/modal_body_view.js
  164. +42 −31 app/assets/javascripts/discourse/views/modal/modal_view.js
  165. +50 −46 app/assets/javascripts/discourse/views/modal/move_selected_view.js
  166. +8 −1 app/assets/javascripts/discourse/views/modal/not_activated_view.js
  167. +26 −17 app/assets/javascripts/discourse/views/modal/option_boolean_view.js
  168. +59 −49 app/assets/javascripts/discourse/views/nav_item_view.js
  169. +12 −6 app/assets/javascripts/discourse/views/notifications_view.js
  170. +45 −0 app/assets/javascripts/discourse/views/pagedown_editor.js
  171. +25 −17 app/assets/javascripts/discourse/views/parent_view.js
  172. +16 −8 app/assets/javascripts/discourse/views/participant_view.js
  173. +27 −21 app/assets/javascripts/discourse/views/post_link_view.js
  174. +162 −189 app/assets/javascripts/discourse/views/post_menu_view.js
  175. +256 −266 app/assets/javascripts/discourse/views/post_view.js
  176. +14 −8 app/assets/javascripts/discourse/views/prepend_post_view.js
  177. +44 −40 app/assets/javascripts/discourse/views/quote_buton_view.js
  178. +29 −21 app/assets/javascripts/discourse/views/replies_view.js
  179. +26 −21 app/assets/javascripts/discourse/views/search/search_results_type_view.js
  180. +148 −143 app/assets/javascripts/discourse/views/search/search_view.js
  181. +21 −15 app/assets/javascripts/discourse/views/selected_posts_view.js
  182. +59 −52 app/assets/javascripts/discourse/views/share_view.js
  183. +11 −5 app/assets/javascripts/discourse/views/suggested_topic_view.js
  184. +26 −17 app/assets/javascripts/discourse/views/topic_admin_menu_view.js
  185. +22 −14 app/assets/javascripts/discourse/views/topic_extra_info_view.js
  186. +147 −123 app/assets/javascripts/discourse/views/topic_footer_buttons_view.js
  187. +14 −8 app/assets/javascripts/discourse/views/topic_posts_view.js
  188. +48 −46 app/assets/javascripts/discourse/views/topic_status_view.js
  189. +0 −7 app/assets/javascripts/discourse/views/topic_summary/topic_links_view.js
  190. +78 −83 app/assets/javascripts/discourse/views/topic_summary/topic_summary_view.js
  191. +462 −505 app/assets/javascripts/discourse/views/topic_view.js
  192. +37 −28 app/assets/javascripts/discourse/views/user/activity_filter_view.js
  193. +15 −9 app/assets/javascripts/discourse/views/user/preferences_email_view.js
  194. +26 −17 app/assets/javascripts/discourse/views/user/preferences_username_view.js
  195. +12 −6 app/assets/javascripts/discourse/views/user/preferences_view.js
  196. +20 −12 app/assets/javascripts/discourse/views/user/user_activity_view.js
  197. +11 −5 app/assets/javascripts/discourse/views/user/user_invited_view.js
  198. +29 −19 app/assets/javascripts/discourse/views/user/user_private_messages_view.js
  199. +50 −39 app/assets/javascripts/discourse/views/user/user_stream_view.js
  200. +23 −15 app/assets/javascripts/discourse/views/user/user_view.js
  201. +3 −7 app/assets/javascripts/discourse/views/view.js
  202. +1 −3 app/assets/javascripts/env.js
  203. +1 −3 app/assets/javascripts/pagedown_custom.js
  204. +44 −49 app/assets/javascripts/preload_store.js
  205. +0 −144 app/assets/stylesheets/components/tooltips.css.scss
  206. +5 −5 app/controllers/topics_controller.rb
  207. +4 −5 app/models/topic.rb
  208. +3 −0  config/initializers/discourse_iife.rb
  209. +1 −0  config/jshint.yml
  210. +12 −7 config/locales/client.en.yml
  211. +707 −0 config/locales/client.pseudo.yml
  212. +715 −0 config/locales/client.sv.yml
  213. +2 −0  config/locales/server.en.yml
  214. +672 −0 config/locales/server.pseudo.yml
  215. +0 −6 config/routes.rb
  216. +22 −0 lib/discourse_iife.rb
  217. +7 −8 lib/oneboxer/discourse_onebox.rb
  218. +1 −0  lib/oneboxer/whitelist.rb
  219. +48 −0 script/generate-pseudolocalization.rb
  220. +2 −2 spec/fixtures/oneboxer/android.response
  221. +1 −3 spec/javascripts/bbcode_spec.js
  222. +2 −2 spec/javascripts/hacks.js
  223. +1 −3 spec/javascripts/key_value_store_spec.js
  224. +1 −3 spec/javascripts/message_bus_spec.js
  225. +1 −3 spec/javascripts/onebox_spec.js
  226. +1 −3 spec/javascripts/preload_store_spec.js
  227. +1 −3 spec/javascripts/user_action_spec.js
  228. +1 −3 spec/javascripts/utilities_spec.js
  229. +9 −9 spec/phantom_js/smoke_test.js
  230. +1 −1  sublime-project
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: "