Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handles 404 #397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ def index
if signed_in?
render 'dashboard/index'
else
#TODO: need to subclass devise controller in order
#to default the `dashboard/` route to this...
redirect_to '/dashboard/users/sign_in'
end
end

def not_found
# Simply reloads Angular SPA at homepage
redirect_to '/'
end

def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update).push(organizer_ids: [])
devise_parameter_sanitizer.for(:sign_up).push(:name, organizers_attributes: [:name, :description])
Expand Down
82 changes: 48 additions & 34 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,53 @@ if (!(Modernizr.borderradius &&
storage: 'localStorage'
});

$routeProvider.when('/explore', {
controller: 'ExploreController',
templateUrl: 'explore/ExploreView.html'
}).when('/explore/:term', {
controller: 'ExploreController',
templateUrl: 'explore/ExploreView.html'
}).when('/opportunity-instances/:uid', {
controller: 'OpportunityInstancesController',
templateUrl: 'opportunity-instances/OpportunityInstancesView.html'
}).when('/dashboard', {
controller: 'DashboardController',
templateUrl: 'dashboard/DashboardView.html'
}).when('/dashboard/organizers', {
controller: 'OrganizersDashboardChooserController',
templateUrl: 'dashboard/organizers/OrganizersDashboardChooserView.html'
}).when('/dashboard/organizers/:organizer', {
controller: 'OrganizersDashboardController',
templateUrl: 'dashboard/organizers/OrganizersDashboardView.html'
}).when('/users/login', {
controller: 'LoginController',
templateUrl: 'users/auth/login/LoginView.html'
}).when('/users/register', {
templateUrl: 'users/auth/register/RegisterView.html'
}).when('/users/register/learners', {
controller: 'RegisterLearnersController',
templateUrl: 'users/auth/register/learners/RegisterLearnersView.html'
}).when('/users/register/organizers', {
controller: 'RegisterOrganizersController',
templateUrl: 'users/auth/register/organizers/RegisterOrganizersView.html'
}).when('/', {
controller: 'HomeController',
templateUrl: 'home/HomeView.html'
});
$routeProvider
.when('/explore', {
controller: 'ExploreController',
templateUrl: 'explore/ExploreView.html'
})
.when('/explore/:term', {
controller: 'ExploreController',
templateUrl: 'explore/ExploreView.html'
})
.when('/opportunity-instances/:uid', {
controller: 'OpportunityInstancesController',
templateUrl: 'opportunity-instances/OpportunityInstancesView.html'
})
.when('/dashboard', {
controller: 'DashboardController',
templateUrl: 'dashboard/DashboardView.html'
})
.when('/dashboard/organizers', {
controller: 'OrganizersDashboardChooserController',
templateUrl: 'dashboard/organizers/OrganizersDashboardChooserView.html'
})
.when('/dashboard/organizers/:organizer', {
controller: 'OrganizersDashboardController',
templateUrl: 'dashboard/organizers/OrganizersDashboardView.html'
})
.when('/users/login', {
controller: 'LoginController',
templateUrl: 'users/auth/login/LoginView.html'
})
.when('/users/register', {
templateUrl: 'users/auth/register/RegisterView.html'
})
.when('/users/register/learners', {
controller: 'RegisterLearnersController',
templateUrl: 'users/auth/register/learners/RegisterLearnersView.html'
})
.when('/users/register/organizers', {
controller: 'RegisterOrganizersController',
templateUrl: 'users/auth/register/organizers/RegisterOrganizersView.html'
})
.when('/', {
controller: 'HomeController',
templateUrl: 'home/HomeView.html'
})
.otherwise({
redirectTo: '/'
});
}).run(['$log', '$rootScope', 'AuthService', '$location',
function($log, $rootScope, AuthService, $location) {

Expand Down Expand Up @@ -105,4 +119,4 @@ if (!(Modernizr.borderradius &&
}
}
]);
}
}
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@
get '/organizers/for-current-user.json', to: 'organizers#for_current_user'
end
end

get '*unmatched_route', to: 'application#not_found'
end