mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ selector custom component for ui, half the visibility page
This commit is contained in:
parent
8ff8cbc408
commit
d107978f2c
@ -1,5 +1,5 @@
|
|||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {LOCALE_ID, NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
|
|
||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRoutingModule} from './app-routing.module';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
@ -19,7 +19,6 @@ import {PicturesComponent} from './pages/pictures/pictures.component';
|
|||||||
import {AnswersComponent} from './pages/answers/answers.component';
|
import {AnswersComponent} from './pages/answers/answers.component';
|
||||||
import {EndConfirmationComponent} from './pages/end-confirmation/end-confirmation.component';
|
import {EndConfirmationComponent} from './pages/end-confirmation/end-confirmation.component';
|
||||||
import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component';
|
import {CreateOrRetrieveComponent} from './pages/create-or-retrieve/create-or-retrieve.component';
|
||||||
import {CalendarComponent} from './calendar/calendar.component';
|
|
||||||
import localeFr from '@angular/common/locales/fr';
|
import localeFr from '@angular/common/locales/fr';
|
||||||
import localeEn from '@angular/common/locales/en';
|
import localeEn from '@angular/common/locales/en';
|
||||||
import {VotingSummaryComponent} from './pages/voting-summary/voting-summary.component';
|
import {VotingSummaryComponent} from './pages/voting-summary/voting-summary.component';
|
||||||
@ -29,7 +28,7 @@ import {PasswordComponent} from './pages/password/password.component';
|
|||||||
import {HomeComponent} from './pages/home/home.component';
|
import {HomeComponent} from './pages/home/home.component';
|
||||||
import {VoteChoiceComponent} from './vote-choice/vote-choice.component';
|
import {VoteChoiceComponent} from './vote-choice/vote-choice.component';
|
||||||
import {HttpClient, HttpClientModule} from '@angular/common/http';
|
import {HttpClient, HttpClientModule} from '@angular/common/http';
|
||||||
import { MarkdownModule } from 'ngx-markdown';
|
import {MarkdownModule} from 'ngx-markdown';
|
||||||
import {
|
import {
|
||||||
MissingTranslationHandler,
|
MissingTranslationHandler,
|
||||||
MissingTranslationHandlerParams,
|
MissingTranslationHandlerParams,
|
||||||
@ -38,9 +37,10 @@ import {
|
|||||||
TranslateService
|
TranslateService
|
||||||
} from '@ngx-translate/core';
|
} from '@ngx-translate/core';
|
||||||
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
||||||
import { PollGraphicComponent } from './poll-graphic/poll-graphic.component';
|
import {PollGraphicComponent} from './poll-graphic/poll-graphic.component';
|
||||||
|
|
||||||
import { AdminComponent } from './pages/admin/admin.component';
|
import {AdminComponent} from './pages/admin/admin.component';
|
||||||
|
import {SelectorComponent} from './ui/selector/selector.component';
|
||||||
|
|
||||||
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
||||||
handle(params: MissingTranslationHandlerParams) {
|
handle(params: MissingTranslationHandlerParams) {
|
||||||
@ -70,7 +70,6 @@ export function HttpLoaderFactory(http: HttpClient) {
|
|||||||
AnswersComponent,
|
AnswersComponent,
|
||||||
EndConfirmationComponent,
|
EndConfirmationComponent,
|
||||||
CreateOrRetrieveComponent,
|
CreateOrRetrieveComponent,
|
||||||
CalendarComponent,
|
|
||||||
VotingSummaryComponent,
|
VotingSummaryComponent,
|
||||||
VotingGraphComponent,
|
VotingGraphComponent,
|
||||||
VotingChoiceComponent,
|
VotingChoiceComponent,
|
||||||
@ -79,6 +78,7 @@ export function HttpLoaderFactory(http: HttpClient) {
|
|||||||
PollGraphicComponent,
|
PollGraphicComponent,
|
||||||
VoteChoiceComponent,
|
VoteChoiceComponent,
|
||||||
AdminComponent,
|
AdminComponent,
|
||||||
|
SelectorComponent,
|
||||||
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<p>calendar works!</p>
|
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'framadate-calendar',
|
|
||||||
templateUrl: './calendar.component.html',
|
|
||||||
styleUrls: ['./calendar.component.scss']
|
|
||||||
})
|
|
||||||
export class CalendarComponent implements OnInit {
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -27,6 +27,18 @@ export const defaultDates = [
|
|||||||
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
timeList: [{literal: 'matin'}, {literal: 'midi'}, {literal: 'soir'}]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
export const defaultAnswers = [{
|
||||||
|
id: 0,
|
||||||
|
text: 'réponse de démo 1'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
text: 'réponse 2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
text: 'la réponse D'
|
||||||
|
}];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configuration of the poll, add new fields at will
|
* configuration of the poll, add new fields at will
|
||||||
@ -43,23 +55,14 @@ export class PollConfig {
|
|||||||
allowSeveralHours = 'false';
|
allowSeveralHours = 'false';
|
||||||
// access
|
// access
|
||||||
visibility = 'link_only'; // visible to anyone with the link:
|
visibility = 'link_only'; // visible to anyone with the link:
|
||||||
|
voteChoices = 'only_yes'; // possible answers to a vote choice: only "yes", "yes, maybe, no"
|
||||||
password = '';
|
password = '';
|
||||||
customUrl = '';
|
customUrl = '';
|
||||||
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
|
whoCanChangeAnswers = 'everybody';// everybody, self, nobody (= just admin)
|
||||||
dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll
|
dateList: DateOption[] = defaultDates; // sets of days as strings, config to set identical time for days in a special days poll
|
||||||
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings
|
timeList: DateOption[] = timeOfDay; // ranges of time expressed as strings
|
||||||
answers: any = [{
|
|
||||||
id: 0,
|
answers: any = defaultAnswers;
|
||||||
text: 'réponse de démo 1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
text: 'réponse 2'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
text: 'la réponse D'
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,60 @@
|
|||||||
<h1 i18n>
|
<h1 i18n>
|
||||||
{{"visibility.top_txt"|translate}}
|
{{"visibility.top_txt"|translate}}
|
||||||
{{"visibility.title"|translate}}
|
|
||||||
|
|
||||||
{{"visibility.visibility_want"|translate}}
|
|
||||||
{{"visibility.visibility_link"|translate}}
|
|
||||||
{{"visibility.visibility_nobody"|translate}}
|
|
||||||
{{"visibility.visibility_see"|translate}}
|
|
||||||
|
|
||||||
</h1>
|
</h1>
|
||||||
|
<section class="answers">
|
||||||
|
|
||||||
<section>
|
<h2>
|
||||||
<h1>
|
{{"visibility.title"|translate}}
|
||||||
{{"visibility.votes"|translate}}
|
</h2>
|
||||||
</h1>
|
<span>
|
||||||
{{"visibility.votes_possible"|translate}}
|
{{"visibility.visibility_want"|translate}}
|
||||||
{{"visibility.votes_possible_single"|translate}}
|
</span>
|
||||||
{{"visibility.votes_possible_normal"|translate}}
|
<select
|
||||||
{{"visibility.votes_possible_full"|translate}}
|
name="visible_people"
|
||||||
|
id="visible_people"
|
||||||
|
[(ngModel)]="config.visibility"
|
||||||
|
>
|
||||||
|
<option value="link">
|
||||||
|
{{"visibility.visibility_link"|translate}}
|
||||||
|
</option>
|
||||||
|
<option value="only_me">
|
||||||
|
{{"visibility.visibility_nobody"|translate}}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<span>
|
||||||
|
{{"visibility.visibility_see"|translate}}
|
||||||
|
</span>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section class="visibility">
|
|
||||||
|
|
||||||
<h1>
|
<section class="possible_votes">
|
||||||
|
<h2>
|
||||||
|
{{"visibility.votes"|translate}}
|
||||||
|
</h2>
|
||||||
|
<span>
|
||||||
|
{{"visibility.votes_possible"|translate}}
|
||||||
|
</span>
|
||||||
|
<select
|
||||||
|
name="votes"
|
||||||
|
id="votes"
|
||||||
|
[(ngModel)]="config.visibility"
|
||||||
|
>
|
||||||
|
<option value="only_yes">
|
||||||
|
{{"visibility.votes_possible_single"|translate}}
|
||||||
|
</option>
|
||||||
|
<option value="normal">
|
||||||
|
{{"visibility.votes_possible_normal"|translate}}
|
||||||
|
</option>
|
||||||
|
<option value="full">
|
||||||
|
{{"visibility.votes_possible_full"|translate}}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</section>
|
||||||
|
<section class="expiracy">
|
||||||
|
<span>
|
||||||
{{"visibility.archiving"|translate}}
|
{{"visibility.archiving"|translate}}
|
||||||
</h1>
|
</span>
|
||||||
|
|
||||||
{{"visibility.archiving_start"|translate}}
|
{{"visibility.archiving_start"|translate}}
|
||||||
{{"visibility.archiving_can"|translate}}
|
{{"visibility.archiving_can"|translate}}
|
||||||
{{"visibility.archiving_can_not"|translate}}
|
{{"visibility.archiving_can_not"|translate}}
|
||||||
|
9
src/app/ui/selector/selector.component.html
Normal file
9
src/app/ui/selector/selector.component.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<select
|
||||||
|
class="custom-selector"
|
||||||
|
name="{{selectorConfig.name}}"
|
||||||
|
id="{{selectorConfig.id}}"
|
||||||
|
[(ngModel)]="selectorConfig.selectorNgModel">
|
||||||
|
<option value="{{item.value}}" selected *ngFor="let item of selectorConfig.listItems">
|
||||||
|
{{item.label}}
|
||||||
|
</option>
|
||||||
|
</select>
|
@ -1,20 +1,20 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { CalendarComponent } from './calendar.component';
|
import { SelectorComponent } from './selector.component';
|
||||||
|
|
||||||
describe('CalendarComponent', () => {
|
describe('SelectorComponent', () => {
|
||||||
let component: CalendarComponent;
|
let component: SelectorComponent;
|
||||||
let fixture: ComponentFixture<CalendarComponent>;
|
let fixture: ComponentFixture<SelectorComponent>;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ CalendarComponent ]
|
declarations: [ SelectorComponent ]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(CalendarComponent);
|
fixture = TestBed.createComponent(SelectorComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
30
src/app/ui/selector/selector.component.ts
Normal file
30
src/app/ui/selector/selector.component.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
|
|
||||||
|
interface Item {
|
||||||
|
label: string,
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SelectorConfig {
|
||||||
|
label: string,
|
||||||
|
name: string,
|
||||||
|
id: string,
|
||||||
|
selectorNgModel: any,
|
||||||
|
listItems: Item[]
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'framadate-selector',
|
||||||
|
templateUrl: './selector.component.html',
|
||||||
|
styleUrls: ['./selector.component.scss']
|
||||||
|
})
|
||||||
|
export class SelectorComponent implements OnInit {
|
||||||
|
@Input() selectorConfig: SelectorConfig;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user