Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
98 changes: 88 additions & 10 deletions assets/scripts/fe/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion assets/scripts/fe/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';

import { UIRouterModule } from '@uirouter/angular';
Expand All @@ -7,6 +8,7 @@ import { APP_STATES } from './commons/states/app.states';

import { PublicModule } from './components/public/public.module';
import { AppComponent } from './app.component';
import { GlobalModule } from './components/global/global.module';

@NgModule({
declarations: [
Expand All @@ -15,7 +17,9 @@ import { AppComponent } from './app.component';
imports: [
BrowserModule,
UIRouterModule.forRoot(APP_STATES),
PublicModule
PublicModule,
HttpClientModule,
GlobalModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
15 changes: 15 additions & 0 deletions assets/scripts/fe/src/app/commons/services/search.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TestBed, inject } from '@angular/core/testing';

import { SearchService } from './search.service';

describe('SearchService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [SearchService]
});
});

it('should be created', inject([SearchService], (service: SearchService) => {
expect(service).toBeTruthy();
}));
});
26 changes: 26 additions & 0 deletions assets/scripts/fe/src/app/commons/services/search.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { QUESTIONS_API_SEARCH } from '../../constants/endpoints';


@Injectable({
providedIn: 'root'
})
export class SearchService {

constructor(
private http: HttpClient
) { }

data = '';

getQuestions(page){
return this.http.get(QUESTIONS_API_SEARCH(page, this.data));
}

searchQuestions(data: string){
this.data = data;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FiltersModule } from './filters.module';

describe('FiltersModule', () => {
let filtersModule: FiltersModule;

beforeEach(() => {
filtersModule = new FiltersModule();
});

it('should create an instance', () => {
expect(filtersModule).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

@NgModule({
imports: [
CommonModule
],
declarations: []
})
export class FiltersModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<form action="">
Copy link

@mcandidier mcandidier Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't leave action attr to empty, better to remove if empty

<input type="radio" name="sortby" value="relevance"> Relevance
<input type="radio" name="sortby" value="date"> Date
<input type="radio" name="sortby" value="answers"> Answers
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { QuestionFilterComponent } from './question-filter.component';

describe('QuestionFilterComponent', () => {
let component: QuestionFilterComponent;
let fixture: ComponentFixture<QuestionFilterComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QuestionFilterComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(QuestionFilterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-question-filter',
templateUrl: './question-filter.component.html',
styleUrls: ['./question-filter.component.css']
})
export class QuestionFilterComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { FormsModule } from './forms.module';

describe('FormsModule', () => {
let formsModule: FormsModule;

beforeEach(() => {
formsModule = new FormsModule();
});

it('should create an instance', () => {
expect(formsModule).toBeTruthy();
});
});
Loading