From 464f5099413de02ec59f9e9fda9aca4b128790d8 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 2 Nov 2016 13:38:54 -0400 Subject: [PATCH] In Ember 2.0 `this.resource` is deprecated --- .../admin/routes/admin-route-map.js.es6 | 50 +++++++++---------- .../discourse/mapping-router.js.es6 | 4 +- .../discourse/routes/app-route-map.js.es6 | 32 ++++++------ 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/app/assets/javascripts/admin/routes/admin-route-map.js.es6 b/app/assets/javascripts/admin/routes/admin-route-map.js.es6 index 69b51e5cabb..9b1b2c72c25 100644 --- a/app/assets/javascripts/admin/routes/admin-route-map.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-route-map.js.es6 @@ -3,11 +3,11 @@ export default { map() { this.route('dashboard', { path: '/' }); - this.resource('adminSiteSettings', { path: '/site_settings' }, function() { - this.resource('adminSiteSettingsCategory', { path: 'category/:category_id'} ); + this.route('adminSiteSettings', { path: '/site_settings', resetNamespace: true }, function() { + this.route('adminSiteSettingsCategory', { path: 'category/:category_id', resetNamespace: true} ); }); - this.resource('adminEmail', { path: '/email'}, function() { + this.route('adminEmail', { path: '/email', resetNamespace: true}, function() { this.route('sent'); this.route('skipped'); this.route('bounced'); @@ -16,72 +16,72 @@ export default { this.route('previewDigest', { path: '/preview-digest' }); }); - this.resource('adminCustomize', { path: '/customize' } ,function() { + this.route('adminCustomize', { path: '/customize', resetNamespace: true } ,function() { this.route('colors'); - this.resource('adminCustomizeCssHtml', { path: 'css_html' }, function() { + this.route('adminCustomizeCssHtml', { path: 'css_html', resetNamespace: true }, function() { this.route('show', {path: '/:site_customization_id/:section'}); }); - this.resource('adminSiteText', { path: '/site_texts' }, function() { + this.route('adminSiteText', { path: '/site_texts', resetNamespace: true }, function() { this.route('edit', { path: '/:id' }); }); - this.resource('adminUserFields', { path: '/user_fields' }); - this.resource('adminEmojis', { path: '/emojis' }); - this.resource('adminPermalinks', { path: '/permalinks' }); - this.resource('adminEmbedding', { path: '/embedding' }); - this.resource('adminCustomizeEmailTemplates', { path: '/email_templates' }, function() { + this.route('adminUserFields', { path: '/user_fields', resetNamespace: true }); + this.route('adminEmojis', { path: '/emojis', resetNamespace: true }); + this.route('adminPermalinks', { path: '/permalinks', resetNamespace: true }); + this.route('adminEmbedding', { path: '/embedding', resetNamespace: true }); + this.route('adminCustomizeEmailTemplates', { path: '/email_templates', resetNamespace: true }, function() { this.route('edit', { path: '/:id' }); }); }); - this.resource('adminApi', { path: '/api' }, function() { - this.resource('adminApiKeys', { path: '/keys' }); + this.route('adminApi', { path: '/api', resetNamespace: true }, function() { + this.route('adminApiKeys', { path: '/keys', resetNamespace: true }); - this.resource('adminWebHooks', { path: '/web_hooks' }, function() { + this.route('adminWebHooks', { path: '/web_hooks', resetNamespace: true }, function() { this.route('show', { path: '/:web_hook_id' }); this.route('showEvents', { path: '/:web_hook_id/events' }); }); }); - this.resource('admin.backups', { path: '/backups' }, function() { + this.route('admin.backups', { path: '/backups', resetNamespace: true }, function() { this.route('logs'); }); - this.resource('adminReports', { path: '/reports/:type' }); + this.route('adminReports', { path: '/reports/:type', resetNamespace: true }); - this.resource('adminFlags', { path: '/flags' }, function() { + this.route('adminFlags', { path: '/flags', resetNamespace: true }, function() { this.route('list', { path: '/:filter' }); }); - this.resource('adminLogs', { path: '/logs' }, function() { + this.route('adminLogs', { path: '/logs', resetNamespace: true }, function() { this.route('staffActionLogs', { path: '/staff_action_logs' }); this.route('screenedEmails', { path: '/screened_emails' }); this.route('screenedIpAddresses', { path: '/screened_ip_addresses' }); this.route('screenedUrls', { path: '/screened_urls' }); }); - this.resource('adminGroups', { path: '/groups' }, function() { + this.route('adminGroups', { path: '/groups', resetNamespace: true }, function() { this.route('bulk'); this.route('bulkComplete', { path: 'bulk-complete' }); - this.resource('adminGroupsType', { path: '/:type' }, function() { - this.resource('adminGroup', { path: '/:name' }); + this.route('adminGroupsType', { path: '/:type', resetNamespace: true }, function() { + this.route('adminGroup', { path: '/:name', resetNamespace: true }); }); }); - this.resource('adminUsers', { path: '/users' }, function() { - this.resource('adminUser', { path: '/:user_id/:username' }, function() { + this.route('adminUsers', { path: '/users', resetNamespace: true }, function() { + this.route('adminUser', { path: '/:user_id/:username', resetNamespace: true }, function() { this.route('badges'); this.route('tl3Requirements', { path: '/tl3_requirements' }); }); - this.resource('adminUsersList', { path: '/list' }, function() { + this.route('adminUsersList', { path: '/list', resetNamespace: true }, function() { this.route('show', { path: '/:filter' }); }); }); - this.resource('adminBadges', { path: '/badges' }, function() { + this.route('adminBadges', { path: '/badges', resetNamespace: true }, function() { this.route('show', { path: '/:badge_id' }); }); } diff --git a/app/assets/javascripts/discourse/mapping-router.js.es6 b/app/assets/javascripts/discourse/mapping-router.js.es6 index 0223dfe41be..306910624c9 100644 --- a/app/assets/javascripts/discourse/mapping-router.js.es6 +++ b/app/assets/javascripts/discourse/mapping-router.js.es6 @@ -61,14 +61,14 @@ export function mapRoutes() { // Apply other resources next. A little hacky but works! standalone.forEach(function(r) { - router.resource(r, {path: paths[r]}, function() { + router.route(r, {path: paths[r], resetNamespace: true}, function() { var res = this; resources[r].forEach(function(m) { m.call(res); }); var s = segments[r]; if (s) { var full = r + '.' + s; - res.resource(s, {path: paths[full]}, function() { + res.route(s, {path: paths[full], resetNamespace: true}, function() { var nestedRes = this; resources[full].forEach(function(m) { m.call(nestedRes); }); }); diff --git a/app/assets/javascripts/discourse/routes/app-route-map.js.es6 b/app/assets/javascripts/discourse/routes/app-route-map.js.es6 index 002f998c359..76f3803c9f8 100644 --- a/app/assets/javascripts/discourse/routes/app-route-map.js.es6 +++ b/app/assets/javascripts/discourse/routes/app-route-map.js.es6 @@ -4,17 +4,17 @@ export default function() { // Error page this.route('exception', { path: '/exception' }); - this.resource('about', { path: '/about' }); + this.route('about', { path: '/about', resetNamespace: true }); // Topic routes - this.resource('topic', { path: '/t/:slug/:id' }, function() { + this.route('topic', { path: '/t/:slug/:id', resetNamespace: true }, function() { this.route('fromParams', { path: '/' }); this.route('fromParamsNear', { path: '/:nearPost' }); }); - this.resource('topicBySlug', { path: '/t/:slug' }); + this.route('topicBySlug', { path: '/t/:slug', resetNamespace: true }); this.route('topicUnsubscribe', { path: '/t/:slug/:id/unsubscribe' }); - this.resource('discovery', { path: '/' }, function() { + this.route('discovery', { path: '/', resetNamespace: true }, function() { // top this.route('top'); this.route('topParentCategory', { path: '/c/:slug/l/top' }); @@ -50,7 +50,7 @@ export default function() { this.route(defaultHomepage(), { path: '/' }); }); - this.resource('group', { path: '/groups/:name' }, function() { + this.route('group', { path: '/groups/:name', resetNamespace: true }, function() { this.route('members'); this.route('posts'); this.route('topics'); @@ -59,10 +59,10 @@ export default function() { }); // User routes - this.resource('users'); - this.resource('user', { path: '/users/:username' }, function() { + this.route('users', { resetNamespace: true }); + this.route('user', { path: '/users/:username', resetNamespace: true }, function() { this.route('summary'); - this.resource('userActivity', { path: '/activity' }, function() { + this.route('userActivity', { path: '/activity', resetNamespace: true }, function() { this.route('topics'); this.route('replies'); this.route('likesGiven', {path: 'likes-given'}); @@ -70,7 +70,7 @@ export default function() { this.route('pending'); }); - this.resource('userNotifications', {path: '/notifications'}, function(){ + this.route('userNotifications', {path: '/notifications', resetNamespace: true}, function(){ this.route('responses'); this.route('likesReceived', { path: 'likes-received'}); this.route('mentions'); @@ -81,14 +81,14 @@ export default function() { this.route('flaggedPosts', { path: '/flagged-posts' }); this.route('deletedPosts', { path: '/deleted-posts' }); - this.resource('userPrivateMessages', { path: '/messages' }, function() { + this.route('userPrivateMessages', { path: '/messages', resetNamespace: true }, function() { this.route('sent'); this.route('archive'); this.route('group', { path: 'group/:name'}); this.route('groupArchive', { path: 'group/:name/archive'}); }); - this.resource('preferences', function() { + this.route('preferences', { resetNamespace: true }, function() { this.route('username'); this.route('email'); this.route('about', { path: '/about-me' }); @@ -96,7 +96,7 @@ export default function() { this.route('card-badge', { path: '/card-badge' }); }); - this.resource('userInvited', { path: '/invited' }, function() { + this.route('userInvited', { path: '/invited', resetNamespace: true }, function() { this.route('show', { path: '/:filter' }); }); @@ -114,15 +114,15 @@ export default function() { this.route('new-topic', {path: '/new-topic'}); this.route('new-message', {path: '/new-message'}); - this.resource('badges', function() { + this.route('badges', { resetNamespace: true }, function() { this.route('show', {path: '/:id/:slug'}); }); - this.resource('queued-posts', { path: '/queued-posts' }); + this.route('queued-posts', { path: '/queued-posts', resetNamespace: true }); this.route('full-page-search', {path: '/search'}); - this.resource('tags', function() { + this.route('tags', { resetNamespace: true }, function() { this.route('show', {path: '/:tag_id'}); this.route('showCategory', {path: '/c/:category/:tag_id'}); this.route('showParentCategory', {path: '/c/:parent_category/:category/:tag_id'}); @@ -135,7 +135,7 @@ export default function() { this.route('show', {path: 'intersection/:tag_id/*additional_tags'}); }); - this.resource('tagGroups', {path: '/tag_groups'}, function() { + this.route('tagGroups', {path: '/tag_groups', resetNamespace: true}, function() { this.route('show', {path: '/:id'}); }); }