Fix javascript regression with quoting

This commit is contained in:
Robin Ward 2013-02-21 12:54:40 -05:00
parent c5393d93f3
commit f6263749d4
9 changed files with 46 additions and 4 deletions

View File

@ -1,6 +1,7 @@
(function() { (function() {
window.Discourse.AdminCustomizeController = Ember.Controller.extend({ window.Discourse.AdminCustomizeController = Ember.Controller.extend({
newCustomization: function() { newCustomization: function() {
var item; var item;
item = Discourse.SiteCustomization.create({ item = Discourse.SiteCustomization.create({
@ -9,12 +10,15 @@
this.get('content').pushObject(item); this.get('content').pushObject(item);
return this.set('content.selectedItem', item); return this.set('content.selectedItem', item);
}, },
selectStyle: function(style) { selectStyle: function(style) {
return this.set('content.selectedItem', style); return this.set('content.selectedItem', style);
}, },
save: function() { save: function() {
return this.get('content.selectedItem').save(); return this.get('content.selectedItem').save();
}, },
"delete": function() { "delete": function() {
var _this = this; 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) { 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); }).call(this);

View File

@ -3,6 +3,7 @@
window.Discourse.AdminDashboardController = Ember.Controller.extend({ window.Discourse.AdminDashboardController = Ember.Controller.extend({
loading: true, loading: true,
versionCheck: null, versionCheck: null,
upToDate: (function() { upToDate: (function() {
if (this.versionCheck) { if (this.versionCheck) {
return this.versionCheck.latest_version === this.versionCheck.installed_version; return this.versionCheck.latest_version === this.versionCheck.installed_version;
@ -10,6 +11,7 @@
return true; return true;
} }
}).property('versionCheck'), }).property('versionCheck'),
updateIconClasses: (function() { updateIconClasses: (function() {
var classes; var classes;
classes = "icon icon-warning-sign "; classes = "icon icon-warning-sign ";
@ -20,6 +22,7 @@
} }
return classes; return classes;
}).property('versionCheck'), }).property('versionCheck'),
priorityClass: (function() { priorityClass: (function() {
if (this.get('versionCheck.critical_updates')) { if (this.get('versionCheck.critical_updates')) {
return 'version-check critical'; return 'version-check critical';
@ -27,6 +30,7 @@
return 'version-check normal'; return 'version-check normal';
} }
}).property('versionCheck') }).property('versionCheck')
}); });
}).call(this); }).call(this);

View File

@ -1,9 +1,11 @@
(function() { (function() {
window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, { window.Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, {
sendTestEmailDisabled: (function() { sendTestEmailDisabled: (function() {
return this.blank('testEmailAddress'); return this.blank('testEmailAddress');
}).property('testEmailAddress'), }).property('testEmailAddress'),
sendTestEmail: function() { sendTestEmail: function() {
var _this = this; var _this = this;
this.set('sentTestEmail', false); this.set('sentTestEmail', false);
@ -19,6 +21,7 @@
}); });
return false; return false;
} }
}); });
}).call(this); }).call(this);

View File

@ -1,6 +1,7 @@
(function() { (function() {
window.Discourse.AdminFlagsController = Ember.Controller.extend({ window.Discourse.AdminFlagsController = Ember.Controller.extend({
clearFlags: function(item) { clearFlags: function(item) {
var _this = this; var _this = this;
return item.clearFlags().then((function() { return item.clearFlags().then((function() {
@ -9,6 +10,7 @@
return bootbox.alert("something went wrong"); return bootbox.alert("something went wrong");
})); }));
}, },
deletePost: function(item) { deletePost: function(item) {
var _this = this; var _this = this;
return item.deletePost().then((function() { return item.deletePost().then((function() {
@ -17,12 +19,15 @@
return bootbox.alert("something went wrong"); return bootbox.alert("something went wrong");
})); }));
}, },
adminOldFlagsView: (function() { adminOldFlagsView: (function() {
return this.query === 'old'; return this.query === 'old';
}).property('query'), }).property('query'),
adminActiveFlagsView: (function() { adminActiveFlagsView: (function() {
return this.query === 'active'; return this.query === 'active';
}).property('query') }).property('query')
}); });
}).call(this); }).call(this);

View File

@ -3,6 +3,7 @@
window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, { window.Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, {
filter: null, filter: null,
onlyOverridden: false, onlyOverridden: false,
filteredContent: (function() { filteredContent: (function() {
var filter, var filter,
_this = this; _this = this;
@ -32,16 +33,20 @@
} }
}); });
}).property('filter', 'content.@each', 'onlyOverridden'), }).property('filter', 'content.@each', 'onlyOverridden'),
resetDefault: function(setting) { resetDefault: function(setting) {
setting.set('value', setting.get('default')); setting.set('value', setting.get('default'));
return setting.save(); return setting.save();
}, },
save: function(setting) { save: function(setting) {
return setting.save(); return setting.save();
}, },
cancel: function(setting) { cancel: function(setting) {
return setting.resetValue(); return setting.resetValue();
} }
}); });
}).call(this); }).call(this);

View File

@ -5,18 +5,22 @@
query: null, query: null,
selectAll: false, selectAll: false,
content: null, content: null,
selectAllChanged: (function() { selectAllChanged: (function() {
var _this = this; var _this = this;
return this.get('content').each(function(user) { return this.get('content').each(function(user) {
return user.set('selected', _this.get('selectAll')); return user.set('selected', _this.get('selectAll'));
}); });
}).observes('selectAll'), }).observes('selectAll'),
filterUsers: Discourse.debounce(function() { filterUsers: Discourse.debounce(function() {
return this.refreshUsers(); return this.refreshUsers();
}, 250).observes('username'), }, 250).observes('username'),
orderChanged: (function() { orderChanged: (function() {
return this.refreshUsers(); return this.refreshUsers();
}).observes('query'), }).observes('query'),
showApproval: (function() { showApproval: (function() {
if (!Discourse.SiteSettings.must_approve_users) { if (!Discourse.SiteSettings.must_approve_users) {
return false; return false;
@ -28,18 +32,22 @@
return true; return true;
} }
}).property('query'), }).property('query'),
selectedCount: (function() { selectedCount: (function() {
if (this.blank('content')) { if (this.blank('content')) {
return 0; return 0;
} }
return this.get('content').filterProperty('selected').length; return this.get('content').filterProperty('selected').length;
}).property('content.@each.selected'), }).property('content.@each.selected'),
hasSelection: (function() { hasSelection: (function() {
return this.get('selectedCount') > 0; return this.get('selectedCount') > 0;
}).property('selectedCount'), }).property('selectedCount'),
refreshUsers: function() { refreshUsers: function() {
return this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username'))); return this.set('content', Discourse.AdminUser.findAll(this.get('query'), this.get('username')));
}, },
show: function(term) { show: function(term) {
if (this.get('query') === term) { if (this.get('query') === term) {
return this.refreshUsers(); return this.refreshUsers();
@ -47,9 +55,11 @@
return this.set('query', term); return this.set('query', term);
} }
}, },
approveUsers: function() { approveUsers: function() {
return Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected')); return Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected'));
} }
}); });
}).call(this); }).call(this);

View File

@ -1,17 +1,23 @@
(function() { (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({ Discourse.VersionCheck.reopenClass({
find: function() { find: function() {
var _this = this; var promise = new RSVP.Promise()
return jQuery.ajax({ jQuery.ajax({
url: '/admin/version_check', url: '/admin/version_check',
dataType: 'json', dataType: 'json',
success: function(json) { success: function(json) {
return Discourse.VersionCheck.create(json); promise.resolve(Discourse.VersionCheck.create(json));
} }
}); });
return promise;
} }
}); });

View File

@ -7,6 +7,9 @@
{{else}} {{else}}
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span> {{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
{{log versionCheck}}
<span class="version-notes"> <span class="version-notes">
{{#if upToDate }} {{#if upToDate }}
<i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}} <i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}}

View File

@ -166,6 +166,7 @@
result += ", full:true"; result += ", full:true";
} }
result += "\"]\n" + sansQuotes + "\n[/quote]\n\n"; result += "\"]\n" + sansQuotes + "\n[/quote]\n\n";
return result;
}, },
formatQuote: function(text, opts) { formatQuote: function(text, opts) {