In Ember 2.0 `this.resource` is deprecated

This commit is contained in:
Robin Ward 2016-11-02 13:38:54 -04:00
parent 71fa9541fa
commit 464f509941
3 changed files with 43 additions and 43 deletions

View File

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

View File

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

View File

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