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() {
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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
});

View File

@ -7,6 +7,9 @@
{{else}}
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
{{log versionCheck}}
<span class="version-notes">
{{#if upToDate }}
<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 += "\"]\n" + sansQuotes + "\n[/quote]\n\n";
return result;
},
formatQuote: function(text, opts) {