diff --git a/src/app/app.component.html b/src/app/app.component.html
index 4ed856c6..d0bc68e2 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -6,7 +6,7 @@
>
proposé par
Frama
diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts
index 2acacd01..06d71694 100644
--- a/src/app/config/PollConfig.ts
+++ b/src/app/config/PollConfig.ts
@@ -46,8 +46,8 @@ export class PollConfig {
password = '';
customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend
- urlPublic = environment.baseApiHref + '/default-url';
- urlAdmin = environment.baseApiHref + '/default-url/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
+ urlPublic = environment.baseHref + '/#/poll/id/3';
+ urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
diff --git a/src/app/config/Routes.ts b/src/app/config/Routes.ts
index 45deca18..67df9d67 100644
--- a/src/app/config/Routes.ts
+++ b/src/app/config/Routes.ts
@@ -36,6 +36,7 @@ export const Routes =
{path: 'step/end', component: EndConfirmationComponent},
{path: 'graphic/:poll', component: PollGraphicComponent},
{path: 'vote/poll/id/:poll', component: PollDisplayComponent},
+ {path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent},
{path: 'votechoice', component: VoteChoiceComponent},
{path: 'voting', component: VotingComponent},
{path: 'step/password', component: PasswordComponent},
diff --git a/src/app/pages/poll-display/poll-display.component.ts b/src/app/pages/poll-display/poll-display.component.ts
index a1f8240c..a3481fd4 100644
--- a/src/app/pages/poll-display/poll-display.component.ts
+++ b/src/app/pages/poll-display/poll-display.component.ts
@@ -19,16 +19,30 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
}
ngOnInit() {
- this.config.currentPoll;
+ this.config.currentPoll;
// fetch poll with its ID or slug.
const id = this.activeRoute.snapshot.params.poll;
+ const pollSlug = this.activeRoute.snapshot.params.pollSlug;
if (id) {
- this.config.pollId = id;
+
// store it in the poll property here
this.config.getPollById(id).subscribe(
(res: any) => {
+ this.config.pollId = id;
this.config.currentPoll = res;
+ this.config.loading = false;
+ }, (e) => {
+ // handle need for a password
+ this.config.handleError(e)
+ }
+ );
+ } else if (pollSlug) {
+ this.config.getPollByURL(pollSlug).subscribe(
+ (res: any) => {
+ this.config.pollId = res.id;
+ this.config.currentPoll = res;
+ this.config.loading = false;
}, (e) => {
// handle need for a password
this.config.handleError(e)
diff --git a/src/app/pages/visibility/visibility.component.html b/src/app/pages/visibility/visibility.component.html
index e1c81b7c..7a3f2f91 100644
--- a/src/app/pages/visibility/visibility.component.html
+++ b/src/app/pages/visibility/visibility.component.html
@@ -114,7 +114,7 @@
{{"visibility.access_instructions"|translate}}
- {{baseUrl + '/' + config.customUrl}}
+ {{environment.baseHref + '#/poll/slug/' + config.customUrl}}