forked from tykayn/funky-framadate-front
poll routing hints in the app, demo precision in header
This commit is contained in:
parent
b06a44fb98
commit
8322a9a83a
@ -6,7 +6,7 @@
|
|||||||
>
|
>
|
||||||
<h1 >
|
<h1 >
|
||||||
<span class="logo_first" >Frama</span >
|
<span class="logo_first" >Frama</span >
|
||||||
<span class="logo_second" >date</span >
|
<span class="logo_second" >date</span > (démo)
|
||||||
</h1 >
|
</h1 >
|
||||||
<div class="legend" >proposé par
|
<div class="legend" >proposé par
|
||||||
<span class="legend_first" >Frama</span >
|
<span class="legend_first" >Frama</span >
|
||||||
|
@ -46,8 +46,8 @@ export class PollConfig {
|
|||||||
password = '';
|
password = '';
|
||||||
customUrl = ''; // custom slug in the url, must be unique
|
customUrl = ''; // custom slug in the url, must be unique
|
||||||
customUrlIsUnique = null; // given by the backend
|
customUrlIsUnique = null; // given by the backend
|
||||||
urlPublic = environment.baseApiHref + '/default-url';
|
urlPublic = environment.baseHref + '/#/poll/id/3';
|
||||||
urlAdmin = environment.baseApiHref + '/default-url/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
||||||
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
|
canModifyAnswers = 1;// everybody, self, nobody (= just admin)
|
||||||
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
|
whoModifiesAnswers = "self";// everybody, self, nobody (= just admin)
|
||||||
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
|
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
|
||||||
|
@ -36,6 +36,7 @@ export const Routes =
|
|||||||
{path: 'step/end', component: EndConfirmationComponent},
|
{path: 'step/end', component: EndConfirmationComponent},
|
||||||
{path: 'graphic/:poll', component: PollGraphicComponent},
|
{path: 'graphic/:poll', component: PollGraphicComponent},
|
||||||
{path: 'vote/poll/id/:poll', component: PollDisplayComponent},
|
{path: 'vote/poll/id/:poll', component: PollDisplayComponent},
|
||||||
|
{path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent},
|
||||||
{path: 'votechoice', component: VoteChoiceComponent},
|
{path: 'votechoice', component: VoteChoiceComponent},
|
||||||
{path: 'voting', component: VotingComponent},
|
{path: 'voting', component: VotingComponent},
|
||||||
{path: 'step/password', component: PasswordComponent},
|
{path: 'step/password', component: PasswordComponent},
|
||||||
|
@ -23,12 +23,26 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
|
|||||||
|
|
||||||
// fetch poll with its ID or slug.
|
// fetch poll with its ID or slug.
|
||||||
const id = this.activeRoute.snapshot.params.poll;
|
const id = this.activeRoute.snapshot.params.poll;
|
||||||
|
const pollSlug = this.activeRoute.snapshot.params.pollSlug;
|
||||||
if (id) {
|
if (id) {
|
||||||
this.config.pollId = id;
|
|
||||||
// store it in the poll property here
|
// store it in the poll property here
|
||||||
this.config.getPollById(id).subscribe(
|
this.config.getPollById(id).subscribe(
|
||||||
(res: any) => {
|
(res: any) => {
|
||||||
|
this.config.pollId = id;
|
||||||
this.config.currentPoll = res;
|
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) => {
|
}, (e) => {
|
||||||
// handle need for a password
|
// handle need for a password
|
||||||
this.config.handleError(e)
|
this.config.handleError(e)
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
{{"visibility.access_instructions"|translate}}
|
{{"visibility.access_instructions"|translate}}
|
||||||
</sub >
|
</sub >
|
||||||
<div class="preview-url" >
|
<div class="preview-url" >
|
||||||
{{baseUrl + '/' + config.customUrl}}
|
{{environment.baseHref + '#/poll/slug/' + config.customUrl}}
|
||||||
</div >
|
</div >
|
||||||
<br >
|
<br >
|
||||||
<label for="passwordAccess" >
|
<label for="passwordAccess" >
|
||||||
|
@ -11,6 +11,7 @@ import {environment} from "../../../environments/environment";
|
|||||||
export class VisibilityComponent extends BaseComponent implements OnInit {
|
export class VisibilityComponent extends BaseComponent implements OnInit {
|
||||||
showCustomPassword = false;
|
showCustomPassword = false;
|
||||||
baseUrl = environment.baseApiHref;
|
baseUrl = environment.baseApiHref;
|
||||||
|
environment = environment;
|
||||||
|
|
||||||
constructor(public config: ConfigService) {
|
constructor(public config: ConfigService) {
|
||||||
super(config);
|
super(config);
|
||||||
|
@ -28,6 +28,7 @@ export class ConfigService extends PollConfig {
|
|||||||
super();
|
super();
|
||||||
// fill in mock values if we are not in production environment
|
// fill in mock values if we are not in production environment
|
||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
|
console.info(' ######### framadate ######### we are not in production env, filling with mock values');
|
||||||
this.currentPoll = mockPoll3;
|
this.currentPoll = mockPoll3;
|
||||||
this.myPolls = mockMyPolls;
|
this.myPolls = mockMyPolls;
|
||||||
this.dateList = defaultDates;
|
this.dateList = defaultDates;
|
||||||
@ -44,6 +45,7 @@ export class ConfigService extends PollConfig {
|
|||||||
this.messageService.clear();
|
this.messageService.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// utils functions
|
||||||
/**
|
/**
|
||||||
* generate unique id to have a default url for future poll
|
* generate unique id to have a default url for future poll
|
||||||
*/
|
*/
|
||||||
@ -54,6 +56,10 @@ export class ConfigService extends PollConfig {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* make a uniq slug for the current poll creation
|
||||||
|
* @param str
|
||||||
|
*/
|
||||||
makeSlug(str?: string) {
|
makeSlug(str?: string) {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
str = this.creationDate.getFullYear() + '_' + (this.creationDate.getMonth() + 1) + '_' + this.creationDate.getDate() + '_' + this.myName + '_' + this.title;
|
str = this.creationDate.getFullYear() + '_' + (this.creationDate.getMonth() + 1) + '_' + this.creationDate.getDate() + '_' + this.myName + '_' + this.title;
|
||||||
@ -96,9 +102,6 @@ export class ConfigService extends PollConfig {
|
|||||||
*/
|
*/
|
||||||
getPollConfig() {
|
getPollConfig() {
|
||||||
const jsonConfig = {
|
const jsonConfig = {
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
|
|
||||||
owner: {
|
owner: {
|
||||||
email: this.myEmail,
|
email: this.myEmail,
|
||||||
pseudo: this.myName,
|
pseudo: this.myName,
|
||||||
@ -118,7 +121,6 @@ export class ConfigService extends PollConfig {
|
|||||||
dateList: this.dateList,
|
dateList: this.dateList,
|
||||||
timeList: this.timeList,
|
timeList: this.timeList,
|
||||||
answers: this.answers,
|
answers: this.answers,
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return jsonConfig
|
return jsonConfig
|
||||||
}
|
}
|
||||||
@ -226,13 +228,7 @@ export class ConfigService extends PollConfig {
|
|||||||
getPollByURL(url: string) {
|
getPollByURL(url: string) {
|
||||||
|
|
||||||
this.todo();
|
this.todo();
|
||||||
// this.http.get(`${this.baseHref}/poll/${url}`, this.makeHeaders()).subscribe(
|
return this.http.get(`${this.baseHref}/poll/slug/${url}`, this.makeHeaders())
|
||||||
// (res: any) => {
|
|
||||||
// this.myPolls = res.data;
|
|
||||||
// }, (e) => {
|
|
||||||
// this.handleError(e)
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user