From be0ce08cc212fe38545cb50bddb78ba1ddaf6eb5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 16 Sep 2013 14:08:55 -0400 Subject: [PATCH] Ember Upgrade: 1.0 --- app/assets/javascripts/admin.js | 2 - app/assets/javascripts/admin.js.erb | 10 + .../controllers/admin_dashboard_controller.js | 9 +- .../admin_email_index_controller.js | 29 +- .../admin_email_preview_digest_controller.js | 23 +- .../controllers/admin_flags_controller.js | 100 +- .../controllers/admin_groups_controller.js | 78 +- .../controllers/admin_reports_controller.js | 16 +- .../admin_site_content_edit_controller.js | 17 +- .../admin_site_settings_controller.js | 50 +- .../controllers/admin_user_controller.js | 35 +- .../admin/routes/admin_logs_routes.js | 2 +- .../routes/admin_site_content_edit_route.js | 21 +- .../admin/templates/admin.js.handlebars | 20 +- .../admin/templates/dashboard.js.handlebars | 14 +- .../admin/templates/email.js.handlebars | 6 +- .../admin/templates/email_logs.js.handlebars | 4 +- .../email_preview_digest.js.handlebars | 4 +- .../admin/templates/flags.js.handlebars | 10 +- .../admin/templates/logs.js.handlebars | 6 +- .../staff_action_logs_list_item.js.handlebars | 4 +- .../reports/trust_levels_report.js.handlebars | 10 +- .../templates/site_contents.js.handlebars | 2 +- .../admin/templates/user.js.handlebars | 8 +- .../admin/templates/users_list.js.handlebars | 18 +- app/assets/javascripts/application.js.erb | 12 +- app/assets/javascripts/discourse.js | 4 +- .../controllers/avatar_selector_controller.js | 14 +- .../controllers/composer_controller.js | 195 +- .../composer_messages_controller.js | 22 +- .../controllers/edit_category_controller.js | 156 +- .../edit_topic_auto_close_controller.js | 12 +- .../discourse/controllers/flag_controller.js | 42 +- .../controllers/header_controller.js | 18 +- .../controllers/invite_controller.js | 33 +- .../discourse/controllers/list_controller.js | 18 +- .../controllers/list_topics_controller.js | 44 +- .../controllers/merge_topic_controller.js | 2 +- .../controllers/preferences_controller.js | 79 +- .../preferences_email_controller.js | 19 +- .../preferences_username_controller.js | 31 +- .../controllers/search_controller.js | 14 +- .../discourse/controllers/share_controller.js | 10 +- .../controllers/split_topic_controller.js | 2 +- .../topic_admin_menu_controller.js | 12 +- .../discourse/controllers/topic_controller.js | 435 +- .../controllers/upload_selector_controller.js | 6 +- .../controllers/user_invited_controller.js | 10 +- .../discourse/routes/application_route.js | 2 +- .../discourse/routes/list_categories_route.js | 2 +- .../discourse/routes/preferences_routes.js | 2 +- .../discourse/routes/topic_route.js | 2 +- .../discourse/templates/header.js.handlebars | 4 +- .../templates/list/topics.js.handlebars | 2 +- .../mobile/list/topics.js.handlebars | 2 +- .../templates/user/activity.js.handlebars | 10 +- .../templates/user/preferences.js.handlebars | 4 +- .../templates/user/user.js.handlebars | 8 +- .../views/buttons/favorite_button.js | 2 +- .../javascripts/discourse/views/share_view.js | 4 +- .../discourse/views/topic_admin_menu_view.js | 6 +- app/assets/javascripts/docs/yuidoc.json | 2 +- app/assets/javascripts/main_include.js | 36 +- app/assets/javascripts/main_include_admin.js | 1 + app/assets/javascripts/pagedown_custom.js | 2 +- app/controllers/topics_controller.rb | 1 + config/application.rb | 4 +- config/jshint.yml | 3 - lib/pretty_text.rb | 10 +- .../avatar_selector_controller_test.js | 4 +- .../controllers/topic_controller_test.js | 26 +- test/javascripts/jshint_all.js.erb | 2 - test/javascripts/test_helper.js | 40 +- .../assets/javascripts}/LAB.js | 0 .../assets/javascripts}/Markdown.Converter.js | 0 .../assets/javascripts}/Markdown.Editor.js | 0 .../assets/javascripts}/Markdown.Sanitizer.js | 0 .../assets/javascripts}/better_markdown.js | 0 .../assets/javascripts}/bootbox.js | 0 .../assets/javascripts}/bootstrap-alert.js | 0 .../assets/javascripts}/bootstrap-button.js | 0 .../assets/javascripts}/bootstrap-dropdown.js | 0 .../assets/javascripts}/bootstrap-modal.js | 0 .../javascripts}/bootstrap-transition.js | 0 .../assets/javascripts}/browser-update.js | 0 .../assets/javascripts}/chosen.jquery.js | 0 .../assets/javascripts/development}/ember.js | 12384 +++++++++++----- .../javascripts/development}/jquery-2.0.3.js | 0 .../list-view.js} | 314 +- .../assets/javascripts}/ember-renderspeed.js | 0 .../assets/javascripts}/favcount.js | 0 .../assets/javascripts}/handlebars.js | 0 .../javascripts}/jquery.ba-replacetext.js | 0 .../javascripts}/jquery.ba-resize.min.js | 0 .../assets/javascripts}/jquery.color.js | 0 .../assets/javascripts}/jquery.cookie.js | 0 .../assets/javascripts}/jquery.fileupload.js | 0 .../javascripts}/jquery.iframe-transport.js | 0 .../javascripts}/jquery.putcursoratend.js | 0 .../assets/javascripts}/jquery.tagsinput.js | 0 .../assets/javascripts}/jquery.ui.widget.js | 0 .../assets/javascripts}/lodash.js | 0 .../assets/javascripts}/md5.js | 0 .../javascripts}/modernizr.custom.95264.js | 0 .../assets/javascripts}/mousetrap.js | 0 .../assets/javascripts/production}/ember.js | 12203 +++++++++------ .../production}/jquery-2.0.3.min.js | 0 .../javascripts/production/list-view.js | 1304 ++ .../assets/javascripts}/rsvp.js | 0 .../assets/javascripts}/show-html.js | 0 110 files changed, 19597 insertions(+), 8477 deletions(-) delete mode 100644 app/assets/javascripts/admin.js create mode 100644 app/assets/javascripts/admin.js.erb create mode 100644 app/assets/javascripts/main_include_admin.js rename {app/assets/javascripts/external => vendor/assets/javascripts}/LAB.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/Markdown.Converter.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/Markdown.Editor.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/Markdown.Sanitizer.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/better_markdown.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootbox.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootstrap-alert.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootstrap-button.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootstrap-dropdown.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootstrap-modal.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/bootstrap-transition.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/browser-update.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/chosen.jquery.js (100%) rename {app/assets/javascripts/external_production => vendor/assets/javascripts/development}/ember.js (74%) mode change 100644 => 100755 rename {app/assets/javascripts/external_development => vendor/assets/javascripts/development}/jquery-2.0.3.js (100%) rename vendor/assets/javascripts/{list_view.js => development/list-view.js} (82%) mode change 100755 => 100644 rename {app/assets/javascripts/external => vendor/assets/javascripts}/ember-renderspeed.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/favcount.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/handlebars.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.ba-replacetext.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.ba-resize.min.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.color.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.cookie.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.fileupload.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.iframe-transport.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.putcursoratend.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.tagsinput.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/jquery.ui.widget.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/lodash.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/md5.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/modernizr.custom.95264.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/mousetrap.js (100%) rename {app/assets/javascripts/external_development => vendor/assets/javascripts/production}/ember.js (78%) mode change 100755 => 100644 rename {app/assets/javascripts/external_production => vendor/assets/javascripts/production}/jquery-2.0.3.min.js (100%) create mode 100755 vendor/assets/javascripts/production/list-view.js rename {app/assets/javascripts/external => vendor/assets/javascripts}/rsvp.js (100%) rename {app/assets/javascripts/external => vendor/assets/javascripts}/show-html.js (100%) diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js deleted file mode 100644 index ddcc17a8141..00000000000 --- a/app/assets/javascripts/admin.js +++ /dev/null @@ -1,2 +0,0 @@ -//= require list_view.js -//= require_tree ./admin diff --git a/app/assets/javascripts/admin.js.erb b/app/assets/javascripts/admin.js.erb new file mode 100644 index 00000000000..aa336ccd8e8 --- /dev/null +++ b/app/assets/javascripts/admin.js.erb @@ -0,0 +1,10 @@ +<% +if Rails.env.development? + require_asset ("development/list-view.js") +else + require_asset ("production/list-view.js") +end + +require_asset("main_include_admin.js") + +%> diff --git a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js index fd3d2cfdf40..43d4edeeafe 100644 --- a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js @@ -46,5 +46,12 @@ Discourse.AdminDashboardController = Ember.Controller.extend({ updatedTimestamp: function() { return moment(this.get('updated_at')).format('LLL'); - }.property('updated_at') + }.property('updated_at'), + + actions: { + refreshProblems: function() { + this.loadProblems(); + } + } + }); diff --git a/app/assets/javascripts/admin/controllers/admin_email_index_controller.js b/app/assets/javascripts/admin/controllers/admin_email_index_controller.js index 8da9fa2d493..3ad47271329 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_index_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_email_index_controller.js @@ -24,23 +24,24 @@ Discourse.AdminEmailIndexController = Discourse.Controller.extend({ this.set('sentTestEmail', false); }.observes('testEmailAddress'), + actions: { + /** + Sends a test email to the currently entered email address - /** - Sends a test email to the currently entered email address + @method sendTestEmail + **/ + sendTestEmail: function() { + this.set('sentTestEmail', false); - @method sendTestEmail - **/ - sendTestEmail: function() { - this.set('sentTestEmail', false); - - var adminEmailLogsController = this; - Discourse.ajax("/admin/email/test", { - type: 'POST', - data: { email_address: this.get('testEmailAddress') } - }).then(function () { - adminEmailLogsController.set('sentTestEmail', true); - }); + var adminEmailLogsController = this; + Discourse.ajax("/admin/email/test", { + type: 'POST', + data: { email_address: this.get('testEmailAddress') } + }).then(function () { + adminEmailLogsController.set('sentTestEmail', true); + }); + } } }); diff --git a/app/assets/javascripts/admin/controllers/admin_email_preview_digest_controller.js b/app/assets/javascripts/admin/controllers/admin_email_preview_digest_controller.js index eb54d21c6fb..171f0094d17 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_preview_digest_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_email_preview_digest_controller.js @@ -8,14 +8,21 @@ **/ Discourse.AdminEmailPreviewDigestController = Discourse.ObjectController.extend({ - refresh: function() { - var model = this.get('model'); - var controller = this; - controller.set('loading', true); - Discourse.EmailPreview.findDigest(this.get('lastSeen')).then(function (email) { - model.setProperties(email.getProperties('html_content', 'text_content')); - controller.set('loading', false); - }); + actions: { + refresh: function() { + var model = this.get('model'), + self = this; + + self.set('loading', true); + Discourse.EmailPreview.findDigest(this.get('lastSeen')).then(function (email) { + model.setProperties(email.getProperties('html_content', 'text_content')); + self.set('loading', false); + }); + }, + + toggleShowHtml: function() { + this.toggleProperty('showHtml'); + } } }); diff --git a/app/assets/javascripts/admin/controllers/admin_flags_controller.js b/app/assets/javascripts/admin/controllers/admin_flags_controller.js index c5a7e11d810..46485ffc3e6 100644 --- a/app/assets/javascripts/admin/controllers/admin_flags_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_flags_controller.js @@ -8,62 +8,64 @@ **/ Discourse.AdminFlagsController = Ember.ArrayController.extend({ - /** - Clear all flags on a post + actions: { + /** + Clear all flags on a post - @method clearFlags - @param {Discourse.FlaggedPost} item The post whose flags we want to clear - **/ - disagreeFlags: function(item) { - var adminFlagsController = this; - item.disagreeFlags().then((function() { - adminFlagsController.removeObject(item); - }), function() { - bootbox.alert(I18n.t("admin.flags.error")); - }); - }, + @method clearFlags + @param {Discourse.FlaggedPost} item The post whose flags we want to clear + **/ + disagreeFlags: function(item) { + var adminFlagsController = this; + item.disagreeFlags().then((function() { + adminFlagsController.removeObject(item); + }), function() { + bootbox.alert(I18n.t("admin.flags.error")); + }); + }, - agreeFlags: function(item) { - var adminFlagsController = this; - item.agreeFlags().then((function() { - adminFlagsController.removeObject(item); - }), function() { - bootbox.alert(I18n.t("admin.flags.error")); - }); - }, + agreeFlags: function(item) { + var adminFlagsController = this; + item.agreeFlags().then((function() { + adminFlagsController.removeObject(item); + }), function() { + bootbox.alert(I18n.t("admin.flags.error")); + }); + }, - deferFlags: function(item) { - var adminFlagsController = this; - item.deferFlags().then((function() { - adminFlagsController.removeObject(item); - }), function() { - bootbox.alert(I18n.t("admin.flags.error")); - }); - }, + deferFlags: function(item) { + var adminFlagsController = this; + item.deferFlags().then((function() { + adminFlagsController.removeObject(item); + }), function() { + bootbox.alert(I18n.t("admin.flags.error")); + }); + }, - /** - Deletes a post + /** + Deletes a post - @method deletePost - @param {Discourse.FlaggedPost} item The post to delete - **/ - deletePost: function(item) { - var adminFlagsController = this; - item.deletePost().then((function() { - adminFlagsController.removeObject(item); - }), function() { - bootbox.alert(I18n.t("admin.flags.error")); - }); - }, + @method deletePost + @param {Discourse.FlaggedPost} item The post to delete + **/ + deletePost: function(item) { + var adminFlagsController = this; + item.deletePost().then((function() { + adminFlagsController.removeObject(item); + }), function() { + bootbox.alert(I18n.t("admin.flags.error")); + }); + }, - /** - Deletes a user and all posts and topics created by that user. + /** + Deletes a user and all posts and topics created by that user. - @method deleteSpammer - @param {Discourse.FlaggedPost} item The post to delete - **/ - deleteSpammer: function(item) { - item.get('user').deleteAsSpammer(function() { window.location.reload(); }); + @method deleteSpammer + @param {Discourse.FlaggedPost} item The post to delete + **/ + deleteSpammer: function(item) { + item.get('user').deleteAsSpammer(function() { window.location.reload(); }); + } }, /** diff --git a/app/assets/javascripts/admin/controllers/admin_groups_controller.js b/app/assets/javascripts/admin/controllers/admin_groups_controller.js index 8fb3ae9a841..e54ae33d2dd 100644 --- a/app/assets/javascripts/admin/controllers/admin_groups_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_groups_controller.js @@ -1,49 +1,51 @@ Discourse.AdminGroupsController = Ember.Controller.extend({ itemController: 'adminGroup', - edit: function(group){ - this.get('model').select(group); - group.load(); - }, + actions: { + edit: function(group){ + this.get('model').select(group); + group.load(); + }, - refreshAutoGroups: function(){ - var controller = this; + refreshAutoGroups: function(){ + var self = this; - this.set('refreshingAutoGroups', true); - Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}) - .then(function() { - controller.set('model', Discourse.Group.findAll()); - controller.set('refreshingAutoGroups', false); - }); - }, + self.set('refreshingAutoGroups', true); + Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function() { + self.set('model', Discourse.Group.findAll()); + self.set('refreshingAutoGroups', false); + }); + }, - newGroup: function(){ - var group = Discourse.Group.create(); - group.set("loaded", true); - var model = this.get("model"); - model.addObject(group); - model.select(group); - }, + newGroup: function(){ + var group = Discourse.Group.create(); + group.set("loaded", true); + var model = this.get("model"); + model.addObject(group); + model.select(group); + }, - save: function(group){ - if(!group.get("id")){ - group.create(); - } else { - group.save(); - } - }, - - destroy: function(group){ - var _this = this; - return bootbox.confirm(I18n.t("admin.groups.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) { - if (result) { - group.destroy().then(function(deleted) { - if (deleted) { - _this.get("model").removeObject(group); - } - }); + save: function(group){ + if(!group.get("id")){ + group.create(); + } else { + group.save(); } - }); + }, + + destroy: function(group){ + var self = this; + return bootbox.confirm(I18n.t("admin.groups.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) { + if (result) { + group.destroy().then(function(deleted) { + if (deleted) { + self.get("model").removeObject(group); + } + }); + } + }); + } } + }); diff --git a/app/assets/javascripts/admin/controllers/admin_reports_controller.js b/app/assets/javascripts/admin/controllers/admin_reports_controller.js index 14c15402cee..35fb54b7415 100644 --- a/app/assets/javascripts/admin/controllers/admin_reports_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_reports_controller.js @@ -4,14 +4,16 @@ Discourse.AdminReportsController = Ember.ObjectController.extend({ viewingTable: Em.computed.equal('viewMode', 'table'), viewingBarChart: Em.computed.equal('viewMode', 'barChart'), - // Changes the current view mode to 'table' - viewAsTable: function() { - this.set('viewMode', 'table'); - }, + actions: { + // Changes the current view mode to 'table' + viewAsTable: function() { + this.set('viewMode', 'table'); + }, - // Changes the current view mode to 'barChart' - viewAsBarChart: function() { - this.set('viewMode', 'barChart'); + // Changes the current view mode to 'barChart' + viewAsBarChart: function() { + this.set('viewMode', 'barChart'); + } } }); \ No newline at end of file diff --git a/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js b/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js index dfaebeb04cf..68e5b6d3afa 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js @@ -14,12 +14,15 @@ Discourse.AdminSiteContentEditController = Discourse.Controller.extend({ return false; }.property('saving', 'content.content'), - saveChanges: function() { - var controller = this; - controller.setProperties({saving: true, saved: false}); - this.get('content').save().then(function () { - controller.setProperties({saving: false, saved: true}); - }); + actions: { + saveChanges: function() { + var self = this; + self.setProperties({saving: true, saved: false}); + self.get('content').save().then(function () { + self.setProperties({saving: false, saved: true}); + }); + } } +}); -}); \ No newline at end of file +Discourse.AdminSiteContentsController = Ember.ArrayController.extend({}); \ No newline at end of file diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js index 075406e889c..769865e1365 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -39,35 +39,37 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P }); }.property('filter', 'content.@each', 'onlyOverridden'), - /** - Reset a setting to its default value + actions: { + /** + Reset a setting to its default value - @method resetDefault - @param {Discourse.SiteSetting} setting The setting we want to revert - **/ - resetDefault: function(setting) { - setting.set('value', setting.get('default')); - setting.save(); - }, + @method resetDefault + @param {Discourse.SiteSetting} setting The setting we want to revert + **/ + resetDefault: function(setting) { + setting.set('value', setting.get('default')); + setting.save(); + }, - /** - Save changes to a site setting + /** + Save changes to a site setting - @method save - @param {Discourse.SiteSetting} setting The setting we've changed - **/ - save: function(setting) { - setting.save(); - }, + @method save + @param {Discourse.SiteSetting} setting The setting we've changed + **/ + save: function(setting) { + setting.save(); + }, - /** - Cancel changes to a site setting + /** + Cancel changes to a site setting - @method cancel - @param {Discourse.SiteSetting} setting The setting we've changed but want to revert - **/ - cancel: function(setting) { - setting.resetValue(); + @method cancel + @param {Discourse.SiteSetting} setting The setting we've changed but want to revert + **/ + cancel: function(setting) { + setting.resetValue(); + } } }); diff --git a/app/assets/javascripts/admin/controllers/admin_user_controller.js b/app/assets/javascripts/admin/controllers/admin_user_controller.js index d2c0e83c47e..986e5129c19 100644 --- a/app/assets/javascripts/admin/controllers/admin_user_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_user_controller.js @@ -9,22 +9,25 @@ Discourse.AdminUserController = Discourse.ObjectController.extend({ editingTitle: false, - toggleTitleEdit: function() { - this.set('editingTitle', !this.editingTitle); - }, - - saveTitle: function() { - Discourse.ajax("/users/" + this.get('username').toLowerCase(), { - data: {title: this.get('title')}, - type: 'PUT' - }).then(null, function(e){ - bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body})); - }); - - this.toggleTitleEdit(); - }, - showApproval: function() { return Discourse.SiteSettings.must_approve_users; - }.property() + }.property(), + + actions: { + toggleTitleEdit: function() { + this.toggleProperty('editingTitle'); + }, + + saveTitle: function() { + Discourse.ajax("/users/" + this.get('username').toLowerCase(), { + data: {title: this.get('title')}, + type: 'PUT' + }).then(null, function(e){ + bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body})); + }); + + this.send('toggleTitleEdit'); + } + } + }); diff --git a/app/assets/javascripts/admin/routes/admin_logs_routes.js b/app/assets/javascripts/admin/routes/admin_logs_routes.js index cceb94b3f10..b989b068645 100644 --- a/app/assets/javascripts/admin/routes/admin_logs_routes.js +++ b/app/assets/javascripts/admin/routes/admin_logs_routes.js @@ -33,7 +33,7 @@ Discourse.AdminLogsStaffActionLogsRoute = Discourse.Route.extend({ return controller.show(); }, - events: { + actions: { showDetailsModal: function(logRecord) { Discourse.Route.showModal(this, 'admin_staff_action_log_details', logRecord); this.controllerFor('modal').set('modalClass', 'log-details-modal'); diff --git a/app/assets/javascripts/admin/routes/admin_site_content_edit_route.js b/app/assets/javascripts/admin/routes/admin_site_content_edit_route.js index 90465427d76..b654c6383de 100644 --- a/app/assets/javascripts/admin/routes/admin_site_content_edit_route.js +++ b/app/assets/javascripts/admin/routes/admin_site_content_edit_route.js @@ -13,24 +13,11 @@ Discourse.AdminSiteContentEditRoute = Discourse.Route.extend({ }, model: function(params) { - var list = this.controllerFor('adminSiteContents').get('model'); + var list = Discourse.SiteContentType.findAll(); - // ember routing is fun ... this is what happens - // - // linkTo creates an Ember.LinkView , it marks an with the class "active" - // if the "context" of this dynamic route is equal to the model in the linkTo - // the route "context" is set here, so we want to make sure we have the exact - // same object, from Ember we have: - // - // if (handlerInfo.context !== object) { return false; } - // - // we could avoid this hack if Ember just compared .serialize(model) with .serialize(context) - // - // alternatively we could use some sort of identity map - // - // see also: https://github.com/emberjs/ember.js/issues/3005 - - return list.findProperty("content_type", params.content_type); + return list.then(function(items) { + return items.findProperty("content_type", params.content_type); + }); }, renderTemplate: function() { diff --git a/app/assets/javascripts/admin/templates/admin.js.handlebars b/app/assets/javascripts/admin/templates/admin.js.handlebars index 105b66316fd..5a09dd52f3a 100644 --- a/app/assets/javascripts/admin/templates/admin.js.handlebars +++ b/app/assets/javascripts/admin/templates/admin.js.handlebars @@ -3,21 +3,21 @@
diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index e3e57f9e7fd..621d355ee61 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -13,7 +13,7 @@

{{i18n admin.dashboard.last_checked}}: {{problemsTimestamp}} - +

@@ -25,7 +25,7 @@

{{i18n admin.dashboard.no_problems}} - +

@@ -121,15 +121,15 @@ - + - + - + - +
{{i18n admin.dashboard.admins}}{{#linkTo 'adminUsersList.admins'}}{{admins}}{{/linkTo}}{{#link-to 'adminUsersList.admins'}}{{admins}}{{/link-to}} {{i18n admin.dashboard.banned}}{{#linkTo 'adminUsersList.banned'}}{{banned}}{{/linkTo}}{{#link-to 'adminUsersList.banned'}}{{banned}}{{/link-to}}
{{i18n admin.dashboard.moderators}}{{#linkTo 'adminUsersList.moderators'}}{{moderators}}{{/linkTo}}{{#link-to 'adminUsersList.moderators'}}{{moderators}}{{/link-to}} {{i18n admin.dashboard.blocked}}{{#linkTo 'adminUsersList.blocked'}}{{blocked}}{{/linkTo}}{{#link-to 'adminUsersList.blocked'}}{{blocked}}{{/link-to}}
@@ -265,7 +265,7 @@ {{#each top_referrers.data}} - {{#linkTo 'adminUser' this}}{{unbound username}}{{/linkTo}} + {{#link-to 'adminUser' this}}{{unbound username}}{{/link-to}} {{num_clicks}} {{num_topics}} diff --git a/app/assets/javascripts/admin/templates/email.js.handlebars b/app/assets/javascripts/admin/templates/email.js.handlebars index 4239864bd71..8c6b4aa3b82 100644 --- a/app/assets/javascripts/admin/templates/email.js.handlebars +++ b/app/assets/javascripts/admin/templates/email.js.handlebars @@ -1,9 +1,9 @@
diff --git a/app/assets/javascripts/admin/templates/email_logs.js.handlebars b/app/assets/javascripts/admin/templates/email_logs.js.handlebars index f937ee6bc53..508f72566e9 100644 --- a/app/assets/javascripts/admin/templates/email_logs.js.handlebars +++ b/app/assets/javascripts/admin/templates/email_logs.js.handlebars @@ -15,8 +15,8 @@ {{date created_at}} {{#if user}} - {{#linkTo 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/linkTo}} - {{#linkTo 'adminUser' user}}{{user.username}}{{/linkTo}} + {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}} + {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}} {{else}} — {{/if}} diff --git a/app/assets/javascripts/admin/templates/email_preview_digest.js.handlebars b/app/assets/javascripts/admin/templates/email_preview_digest.js.handlebars index aaa5bb3ccb4..c0dee55e03d 100644 --- a/app/assets/javascripts/admin/templates/email_preview_digest.js.handlebars +++ b/app/assets/javascripts/admin/templates/email_preview_digest.js.handlebars @@ -11,9 +11,9 @@
{{#if showHtml}} - {{i18n admin.email.html}} | {{i18n admin.email.text}} + {{i18n admin.email.html}} | {{i18n admin.email.text}} {{else}} - {{i18n admin.email.html}} | {{i18n admin.email.text}} + {{i18n admin.email.html}} | {{i18n admin.email.text}} {{/if}}
diff --git a/app/assets/javascripts/admin/templates/flags.js.handlebars b/app/assets/javascripts/admin/templates/flags.js.handlebars index fc94328f0b8..2138a4ac326 100644 --- a/app/assets/javascripts/admin/templates/flags.js.handlebars +++ b/app/assets/javascripts/admin/templates/flags.js.handlebars @@ -1,8 +1,8 @@
@@ -25,7 +25,7 @@ {{#each flaggedPost in content}} - {{#if flaggedPost.user}}{{#linkTo 'adminUser' flaggedPost.user}}{{avatar flaggedPost.user imageSize="small"}}{{/linkTo}}{{/if}} + {{#if flaggedPost.user}}{{#link-to 'adminUser' flaggedPost.user}}{{avatar flaggedPost.user imageSize="small"}}{{/link-to}}{{/if}} {{#if flaggedPost.topicHidden}} {{/if}}

{{flaggedPost.title}}


{{{flaggedPost.excerpt}}} @@ -35,7 +35,7 @@ {{#each flaggedPost.flaggers}} - {{#linkTo 'adminUser' this.user}}{{avatar this.user imageSize="small"}} {{/linkTo}} + {{#link-to 'adminUser' this.user}}{{avatar this.user imageSize="small"}} {{/link-to}} {{date this.flaggedAt}} @@ -54,7 +54,7 @@ -
{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}} {{message}}
+
{{#link-to 'adminUser' user}}{{avatar user imageSize="small"}}{{/link-to}} {{message}}
diff --git a/app/assets/javascripts/admin/templates/logs.js.handlebars b/app/assets/javascripts/admin/templates/logs.js.handlebars index f1faac2b6f3..5e6af379d0b 100644 --- a/app/assets/javascripts/admin/templates/logs.js.handlebars +++ b/app/assets/javascripts/admin/templates/logs.js.handlebars @@ -1,9 +1,9 @@
diff --git a/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars b/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars index 749f3197075..c807003e635 100644 --- a/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars +++ b/app/assets/javascripts/admin/templates/logs/staff_action_logs_list_item.js.handlebars @@ -1,5 +1,5 @@
- {{#linkTo 'adminUser' acting_user}}{{avatar acting_user imageSize="tiny"}}{{/linkTo}} + {{#link-to 'adminUser' acting_user}}{{avatar acting_user imageSize="tiny"}}{{/link-to}} {{acting_user.username}}
@@ -7,7 +7,7 @@
{{#if target_user}} - {{#linkTo 'adminUser' target_user}}{{avatar target_user imageSize="tiny"}}{{/linkTo}} + {{#link-to 'adminUser' target_user}}{{avatar target_user imageSize="tiny"}}{{/link-to}} {{target_user.username}} {{/if}} {{#if subject}} diff --git a/app/assets/javascripts/admin/templates/reports/trust_levels_report.js.handlebars b/app/assets/javascripts/admin/templates/reports/trust_levels_report.js.handlebars index efd9dece091..a16c7883d04 100644 --- a/app/assets/javascripts/admin/templates/reports/trust_levels_report.js.handlebars +++ b/app/assets/javascripts/admin/templates/reports/trust_levels_report.js.handlebars @@ -1,8 +1,8 @@ {{title}} - {{#linkTo 'adminUsersList.newuser'}}{{valueAtTrustLevel data 0}}{{/linkTo}} - {{#linkTo 'adminUsersList.basic'}}{{valueAtTrustLevel data 1}}{{/linkTo}} - {{#linkTo 'adminUsersList.regular'}}{{valueAtTrustLevel data 2}}{{/linkTo}} - {{#linkTo 'adminUsersList.leaders'}}{{valueAtTrustLevel data 3}}{{/linkTo}} - {{#linkTo 'adminUsersList.elders'}}{{valueAtTrustLevel data 4}}{{/linkTo}} + {{#link-to 'adminUsersList.newuser'}}{{valueAtTrustLevel data 0}}{{/link-to}} + {{#link-to 'adminUsersList.basic'}}{{valueAtTrustLevel data 1}}{{/link-to}} + {{#link-to 'adminUsersList.regular'}}{{valueAtTrustLevel data 2}}{{/link-to}} + {{#link-to 'adminUsersList.leaders'}}{{valueAtTrustLevel data 3}}{{/link-to}} + {{#link-to 'adminUsersList.elders'}}{{valueAtTrustLevel data 4}}{{/link-to}} \ No newline at end of file diff --git a/app/assets/javascripts/admin/templates/site_contents.js.handlebars b/app/assets/javascripts/admin/templates/site_contents.js.handlebars index 970b8894339..e6b86a54b5d 100644 --- a/app/assets/javascripts/admin/templates/site_contents.js.handlebars +++ b/app/assets/javascripts/admin/templates/site_contents.js.handlebars @@ -4,7 +4,7 @@ diff --git a/app/assets/javascripts/admin/templates/user.js.handlebars b/app/assets/javascripts/admin/templates/user.js.handlebars index 08979e4f6b4..ab274137dda 100644 --- a/app/assets/javascripts/admin/templates/user.js.handlebars +++ b/app/assets/javascripts/admin/templates/user.js.handlebars @@ -4,10 +4,10 @@
{{i18n user.username.title}}
{{username}}
- {{#linkTo 'userActivity' class="btn"}} + {{#link-to 'userActivity' class="btn"}} {{i18n admin.user.show_public_profile}} - {{/linkTo}} + {{/link-to}} {{#if can_impersonate}}