ES6: Patch up a few issues with the admin controllers conversion
This commit is contained in:
parent
e242368266
commit
15a51c6316
|
@ -0,0 +1,7 @@
|
||||||
|
export default Ember.ArrayController.extend({
|
||||||
|
actions: {
|
||||||
|
goToGithub: function() {
|
||||||
|
window.open('https://github.com/discourse/discourse');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,3 +1,3 @@
|
||||||
import AdminEmailSkippedController from "admin/controllers/admin-email-skipped"
|
import AdminEmailSkippedController from "admin/controllers/admin-email-skipped";
|
||||||
|
|
||||||
export default AdminEmailSkippedController.extend({});
|
export default AdminEmailSkippedController.extend();
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
This controller is for the widget that shows the commits to the discourse repo.
|
|
||||||
|
|
||||||
@class AdminGithubCommitsController
|
|
||||||
@extends Ember.ArrayController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ArrayController.extend({
|
|
||||||
goToGithub: function() {
|
|
||||||
window.open('https://github.com/discourse/discourse');
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -21,6 +21,4 @@ export default Ember.ArrayController.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||||
loading: false,
|
loading: false,
|
||||||
content: [],
|
content: [],
|
||||||
itemController: 'adminLogsScreenedIpAddress',
|
itemController: 'admin-log-screened-ip-address',
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export default Ember.ObjectController.extend({
|
export default Ember.ObjectController.extend({
|
||||||
viewMode: 'table',
|
viewMode: 'table',
|
||||||
|
|
||||||
viewingTable: Em.computed.equal('viewMode', 'table'),
|
viewingTable: Em.computed.equal('viewMode', 'table'),
|
||||||
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
|
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export default Ember.ArrayController.extend({});
|
export default Ember.ArrayController.extend();
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
@uses Discourse.ModalFunctionality
|
@uses Discourse.ModalFunctionality
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {});
|
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality);
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
export default Discourse.ObjectController.extend({});
|
export default Discourse.ObjectController.extend();
|
||||||
|
|
|
@ -1,13 +1,3 @@
|
||||||
/**
|
|
||||||
The modal for viewing the details of a staff action log record
|
|
||||||
for when a site customization is created or changed.
|
|
||||||
|
|
||||||
@class ChangeSiteCustomizationDetailsController
|
|
||||||
@extends Discourse.Controller
|
|
||||||
@namespace Discourse
|
|
||||||
@uses Discourse.ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||||
previousSelected: Ember.computed.equal('selectedTab', 'previous'),
|
previousSelected: Ember.computed.equal('selectedTab', 'previous'),
|
||||||
newSelected: Ember.computed.equal('selectedTab', 'new'),
|
newSelected: Ember.computed.equal('selectedTab', 'new'),
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
@uses Discourse.ModalFunctionality
|
@uses Discourse.ModalFunctionality
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
import ChangeSiteCustomizationDetailsController from "admin/controllers/change-site-customization-details-controller";
|
import ChangeSiteCustomizationDetailsController from "admin/controllers/change-site-customization-details";
|
||||||
|
|
||||||
export default ChangeSiteCustomizationDetailsController.extend({
|
export default ChangeSiteCustomizationDetailsController.extend({
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
**/
|
**/
|
||||||
Discourse.AdminUserBadgesRoute = Discourse.Route.extend({
|
Discourse.AdminUserBadgesRoute = Discourse.Route.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
var username = this.controllerFor('adminUser').get('username');
|
var username = this.modelFor('adminUser').get('username');
|
||||||
return Discourse.UserBadge.findByUsername(username);
|
return Discourse.UserBadge.findByUsername(username);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -12,22 +12,22 @@ var classify = Ember.String.classify;
|
||||||
var get = Ember.get;
|
var get = Ember.get;
|
||||||
|
|
||||||
function parseName(fullName) {
|
function parseName(fullName) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
|
|
||||||
var nameParts = fullName.split(":"),
|
var nameParts = fullName.split(":"),
|
||||||
type = nameParts[0], fullNameWithoutType = nameParts[1],
|
type = nameParts[0], fullNameWithoutType = nameParts[1],
|
||||||
name = fullNameWithoutType,
|
name = fullNameWithoutType,
|
||||||
namespace = get(this, 'namespace'),
|
namespace = get(this, 'namespace'),
|
||||||
root = namespace;
|
root = namespace;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fullName: fullName,
|
fullName: fullName,
|
||||||
type: type,
|
type: type,
|
||||||
fullNameWithoutType: fullNameWithoutType,
|
fullNameWithoutType: fullNameWithoutType,
|
||||||
name: name,
|
name: name,
|
||||||
root: root,
|
root: root,
|
||||||
resolveMethodName: "resolve" + classify(type)
|
resolveMethodName: "resolve" + classify(type)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Discourse.Resolver = Ember.DefaultResolver.extend({
|
Discourse.Resolver = Ember.DefaultResolver.extend({
|
||||||
|
@ -40,6 +40,9 @@ Discourse.Resolver = Ember.DefaultResolver.extend({
|
||||||
var discourseBase = 'discourse/' + split[0] + 's/';
|
var discourseBase = 'discourse/' + split[0] + 's/';
|
||||||
var adminBase = 'admin/' + split[0] + 's/';
|
var adminBase = 'admin/' + split[0] + 's/';
|
||||||
|
|
||||||
|
// Allow render 'admin/templates/xyz' too
|
||||||
|
split[1] = split[1].replace('.templates', '').replace('/templates', '');
|
||||||
|
|
||||||
// Try slashes
|
// Try slashes
|
||||||
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/'));
|
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/'));
|
||||||
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//= require admin/controllers/admin-email-skipped
|
||||||
|
//= require admin/controllers/change-site-customization-details
|
||||||
//= require_tree ./admin
|
//= require_tree ./admin
|
||||||
|
|
||||||
//= require resumable.js
|
//= require resumable.js
|
||||||
|
|
|
@ -70,9 +70,9 @@ module Tilt
|
||||||
# For backwards compatibility with plugins, for now export the Global format too.
|
# For backwards compatibility with plugins, for now export the Global format too.
|
||||||
# We should eventually have an upgrade system for plugins to use ES6 or some other
|
# We should eventually have an upgrade system for plugins to use ES6 or some other
|
||||||
# resolve based API.
|
# resolve based API.
|
||||||
if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/(controllers|components|views|routes)\/(.*)/
|
if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /(discourse|admin)\/(controllers|components|views|routes)\/(.*)/
|
||||||
type = Regexp.last_match[1]
|
type = Regexp.last_match[2]
|
||||||
file_name = Regexp.last_match[2].gsub(/[\-\/]/, '_')
|
file_name = Regexp.last_match[3].gsub(/[\-\/]/, '_')
|
||||||
class_name = file_name.classify
|
class_name = file_name.classify
|
||||||
|
|
||||||
# Rails removes pluralization when calling classify
|
# Rails removes pluralization when calling classify
|
||||||
|
|
Loading…
Reference in New Issue