register must redirect to dashboard

stable
Juanfran 2016-11-15 10:49:31 +01:00
parent 32a19cb23d
commit a816f45bbd
3 changed files with 2 additions and 23 deletions

View File

@ -32,11 +32,6 @@ NavigationBarDirective = (currentUserService, navigationBarService, locationServ
locationService.url(navUrlsService.resolve("login")) locationService.url(navUrlsService.resolve("login"))
locationService.search({next: nextUrl}) locationService.search({next: nextUrl})
scope.vm.register = ->
nextUrl = encodeURIComponent(locationService.url())
locationService.url(navUrlsService.resolve("register"))
locationService.search({next: nextUrl})
scope.$on "$routeChangeSuccess", () -> scope.$on "$routeChangeSuccess", () ->
if locationService.path() == "/" if locationService.path() == "/"
scope.vm.active = true scope.vm.active = true

View File

@ -130,19 +130,3 @@ describe "navigationBarDirective", () ->
expect(mocks.locationService.url.calledWith("/login")).to.be.true expect(mocks.locationService.url.calledWith("/login")).to.be.true
expect(mocks.locationService.search.calledWith({next: encodeURIComponent(nextUrl)})).to.be.true expect(mocks.locationService.search.calledWith({next: encodeURIComponent(nextUrl)})).to.be.true
expect(vm.publicRegisterEnabled).to.be.true expect(vm.publicRegisterEnabled).to.be.true
it "navigation bar register", () ->
mocks.navUrls.resolve.withArgs("register").returns("/register")
nextUrl = "/discover/search?order_by=-total_activity_last_month"
mocks.locationService.url.returns(nextUrl)
elm = createDirective()
scope.$apply()
vm = elm.isolateScope().vm
expect(mocks.locationService.url.callCount).to.be.equal(0)
expect(mocks.locationService.search.callCount).to.be.equal(0)
vm.register()
expect(mocks.locationService.url.callCount).to.be.equal(2)
expect(mocks.locationService.search.callCount).to.be.equal(1)
expect(mocks.locationService.url.calledWith("/register")).to.be.true
expect(mocks.locationService.search.calledWith({next: encodeURIComponent(nextUrl)})).to.be.true
expect(vm.publicRegisterEnabled).to.be.true

View File

@ -30,9 +30,9 @@ nav.navbar(ng-if="vm.isEnabledHeader")
translate="LOGIN_COMMON.ACTION_SIGN_IN" translate="LOGIN_COMMON.ACTION_SIGN_IN"
) )
a.register( a.register(
ng-click="vm.register()" href="#"
ng-if="vm.publicRegisterEnabled" ng-if="vm.publicRegisterEnabled"
href="#", tg-nav="register"
title="{{ 'REGISTER_FORM.ACTION_SIGN_UP' | translate }}" title="{{ 'REGISTER_FORM.ACTION_SIGN_UP' | translate }}"
translate="REGISTER_FORM.ACTION_SIGN_UP" translate="REGISTER_FORM.ACTION_SIGN_UP"
) )