From f6263749d409b4d67de081ede568515cdd9106b5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 21 Feb 2013 12:54:40 -0500 Subject: [PATCH] Fix javascript regression with quoting --- .../controllers/admin_customize_controller.js | 5 +++++ .../controllers/admin_dashboard_controller.js | 4 ++++ .../controllers/admin_email_logs_controller.js | 3 +++ .../admin/controllers/admin_flags_controller.js | 5 +++++ .../controllers/admin_site_settings_controller.js | 5 +++++ .../controllers/admin_users_list_controller.js | 10 ++++++++++ .../javascripts/admin/models/version_check.js | 14 ++++++++++---- .../admin/templates/dashboard.js.handlebars | 3 +++ .../javascripts/discourse/components/bbcode.js | 1 + 9 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin_customize_controller.js b/app/assets/javascripts/admin/controllers/admin_customize_controller.js index 3b6c5fdddcc..ae06ea52212 100644 --- a/app/assets/javascripts/admin/controllers/admin_customize_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_customize_controller.js @@ -1,6 +1,7 @@ (function() { window.Discourse.AdminCustomizeController = Ember.Controller.extend({ + newCustomization: function() { var item; item = Discourse.SiteCustomization.create({ @@ -9,12 +10,15 @@ this.get('content').pushObject(item); return this.set('content.selectedItem', item); }, + selectStyle: function(style) { return this.set('content.selectedItem', style); }, + save: function() { return this.get('content.selectedItem').save(); }, + "delete": 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) { @@ -27,6 +31,7 @@ } }); } + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js index 139d87e63c3..142b9e18f5a 100644 --- a/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_dashboard_controller.js @@ -3,6 +3,7 @@ window.Discourse.AdminDashboardController = Ember.Controller.extend({ loading: true, versionCheck: null, + upToDate: (function() { if (this.versionCheck) { return this.versionCheck.latest_version === this.versionCheck.installed_version; @@ -10,6 +11,7 @@ return true; } }).property('versionCheck'), + updateIconClasses: (function() { var classes; classes = "icon icon-warning-sign "; @@ -20,6 +22,7 @@ } return classes; }).property('versionCheck'), + priorityClass: (function() { if (this.get('versionCheck.critical_updates')) { return 'version-check critical'; @@ -27,6 +30,7 @@ return 'version-check normal'; } }).property('versionCheck') + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js index b1100cc1656..a8ce5f92220 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js @@ -1,9 +1,11 @@ (function() { window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, { + sendTestEmailDisabled: (function() { return this.blank('testEmailAddress'); }).property('testEmailAddress'), + sendTestEmail: function() { var _this = this; this.set('sentTestEmail', false); @@ -19,6 +21,7 @@ }); return false; } + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_flags_controller.js b/app/assets/javascripts/admin/controllers/admin_flags_controller.js index f8fec86938e..de20e2fd4df 100644 --- a/app/assets/javascripts/admin/controllers/admin_flags_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_flags_controller.js @@ -1,6 +1,7 @@ (function() { window.Discourse.AdminFlagsController = Ember.Controller.extend({ + clearFlags: function(item) { var _this = this; return item.clearFlags().then((function() { @@ -9,6 +10,7 @@ return bootbox.alert("something went wrong"); })); }, + deletePost: function(item) { var _this = this; return item.deletePost().then((function() { @@ -17,12 +19,15 @@ return bootbox.alert("something went wrong"); })); }, + adminOldFlagsView: (function() { return this.query === 'old'; }).property('query'), + adminActiveFlagsView: (function() { return this.query === 'active'; }).property('query') + }); }).call(this); 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 8255f3bcf00..fdf8100fe29 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -3,6 +3,7 @@ window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, { filter: null, onlyOverridden: false, + filteredContent: (function() { var filter, _this = this; @@ -32,16 +33,20 @@ } }); }).property('filter', 'content.@each', 'onlyOverridden'), + resetDefault: function(setting) { setting.set('value', setting.get('default')); return setting.save(); }, + save: function(setting) { return setting.save(); }, + cancel: function(setting) { return setting.resetValue(); } + }); }).call(this); diff --git a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js index be92e95d686..1cbd5d9b61b 100644 --- a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js @@ -5,18 +5,22 @@ query: null, selectAll: false, content: null, + selectAllChanged: (function() { var _this = this; return this.get('content').each(function(user) { return user.set('selected', _this.get('selectAll')); }); }).observes('selectAll'), + filterUsers: Discourse.debounce(function() { return this.refreshUsers(); }, 250).observes('username'), + orderChanged: (function() { return this.refreshUsers(); }).observes('query'), + showApproval: (function() { if (!Discourse.SiteSettings.must_approve_users) { return false; @@ -28,18 +32,22 @@ return true; } }).property('query'), + selectedCount: (function() { if (this.blank('content')) { return 0; } return this.get('content').filterProperty('selected').length; }).property('content.@each.selected'), + hasSelection: (function() { return this.get('selectedCount') > 0; }).property('selectedCount'), + refreshUsers: function() { return this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username'))); }, + show: function(term) { if (this.get('query') === term) { return this.refreshUsers(); @@ -47,9 +55,11 @@ return this.set('query', term); } }, + approveUsers: function() { return Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected')); } + }); }).call(this); diff --git a/app/assets/javascripts/admin/models/version_check.js b/app/assets/javascripts/admin/models/version_check.js index 0efcd352aed..893d7d24c71 100644 --- a/app/assets/javascripts/admin/models/version_check.js +++ b/app/assets/javascripts/admin/models/version_check.js @@ -1,17 +1,23 @@ (function() { - window.Discourse.VersionCheck = Discourse.Model.extend({}); + window.Discourse.VersionCheck = Discourse.Model.extend({ + hasInstalledSha: function() { + console.log( 'hello??' ); + return( this.get('installed_sha') && this.get('installed_sha') != 'unknown' ); + }.property('installed_sha') + }); Discourse.VersionCheck.reopenClass({ find: function() { - var _this = this; - return jQuery.ajax({ + var promise = new RSVP.Promise() + jQuery.ajax({ url: '/admin/version_check', dataType: 'json', success: function(json) { - return Discourse.VersionCheck.create(json); + promise.resolve(Discourse.VersionCheck.create(json)); } }); + return promise; } }); diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index 75f8ba18b06..04d8319a943 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -7,6 +7,9 @@ {{else}} {{i18n admin.dashboard.version}}: {{ versionCheck.installed_version }} + {{log versionCheck}} + + {{#if upToDate }} {{i18n admin.dashboard.up_to_date}} diff --git a/app/assets/javascripts/discourse/components/bbcode.js b/app/assets/javascripts/discourse/components/bbcode.js index 87c6aff89a6..eff4240707e 100644 --- a/app/assets/javascripts/discourse/components/bbcode.js +++ b/app/assets/javascripts/discourse/components/bbcode.js @@ -166,6 +166,7 @@ result += ", full:true"; } result += "\"]\n" + sansQuotes + "\n[/quote]\n\n"; + return result; }, formatQuote: function(text, opts) {