Skip to content

Commit

Permalink
Merge pull request #29 from patkap/dev
Browse files Browse the repository at this point in the history
Début d'intégration du cheminement observateur lors de la soumission de son observation
  • Loading branch information
lpofredc committed Jan 29, 2019
2 parents 12cb4a2 + 88156eb commit 34d292f
Show file tree
Hide file tree
Showing 77 changed files with 1,912 additions and 965 deletions.
3 changes: 2 additions & 1 deletion backend/gncitizen/core/taxonomy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class TMedias(db.Model):
is_public = db.Column(db.BOOLEAN)
supprime = db.Column(db.BOOLEAN)
id_type = db.Column(db.Integer)
types = db.Column(db.Integer)
source = db.Column(db.Text)
licence = db.Column(db.Text)

def __repr__(self):
return '<TMedias %r>' % self.titre
Expand Down
166 changes: 96 additions & 70 deletions backend/gncitizen/core/taxonomy/routes.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,107 @@
import requests
from flask import Blueprint, jsonify
# import requests
from flask import Blueprint, jsonify, current_app

from gncitizen.utils.env import taxhub_lists_url
# from gncitizen.utils.env import taxhub_lists_url
from gncitizen.utils.env import db
from gncitizen.utils.utilssqlalchemy import json_resp
from gncitizen.core.taxonomy.models import (
BibNoms, BibListes, CorNomListe, TMedias, Taxref)

routes = Blueprint('taxonomy', __name__)


# @routes.route('/taxonomy/lists', methods=['GET'])
# @json_resp
# def get_lists():
# """Renvoie toutes liste d'espèces
# GET
# ---
# tags:
# - TaxHub api
# definitions:
# id_liste:
# type: integer
# nb_taxons:
# type: integer
# desc_liste:
# type: string
# picto:
# type: string
# group2inpn:
# type: string
# nom_liste:
# type: string
# regne:
# type: string
# responses:
# 200:
# description: A list of all species lists
# """
# r = requests.get(taxhub_lists_url)
# if r.status_code == 200:
# result = r.json()
# return result
# else:
# return jsonify('Erreur de chargement de l \'API', r.status_code)
@routes.route('/taxonomy/lists', methods=['GET'])
@json_resp
def get_lists():
"""Renvoie toutes liste d'espèces
GET
---
tags:
- TaxHub api
definitions:
id_liste:
type: integer
nb_taxons:
type: integer
desc_liste:
type: string
picto:
type: string
group2inpn:
type: string
nom_liste:
type: string
regne:
type: string
responses:
200:
description: A list of all species lists
"""
# r = requests.get(taxhub_lists_url)
# if r.status_code == 200:
# result = r.json()
# return result
# else:
# return jsonify('Erreur de chargement de l \'API', r.status_code)
try:
data = BibListes.query.all()
# current_app.logger.debug([l.as_dict() for l in data])
return [l.as_dict() for l in data]
except Exception as e:
return {'error_message': str(e)}, 400


# @routes.route('/taxonomy/lists/<int:id>', methods=['GET'])
# @json_resp
# def get_list(id):
# """Renvoie une liste d'espèces spécifiée par son id
# GET
# ---
# tags:
# - TaxHub api
# definitions:
# id_liste:
# type: integer
# nb_taxons:
# type: integer
# desc_liste:
# type: string
# picto:
# type: string
# group2inpn:
# type: string
# nom_liste:
# type: string
# regne:
# type: string
# responses:
# 200:
# description: A list of all species lists
# """
# # taxhub_url = load_config()['TAXHUB_API_URL']
# r = requests.get(taxhub_lists_url + str(id))
# if r.status_code == 200:
# result = r.json()
# return result
# else:
# return jsonify('Erreur de chargement de l \'API', r.status_code)
@routes.route('/taxonomy/lists/<int:id>/species', methods=['GET'])
@json_resp
def get_list(id):
"""Renvoie une liste d'espèces spécifiée par son id
GET
---
tags:
- TaxHub api
definitions:
id_liste:
type: integer
nb_taxons:
type: integer
desc_liste:
type: string
picto:
type: string
group2inpn:
type: string
nom_liste:
type: string
regne:
type: string
responses:
200:
description: A list of all species lists
"""
# # taxhub_url = load_config()['TAXHUB_API_URL']
# r = requests.get(taxhub_lists_url + str(id))
# if r.status_code == 200:
# result = r.json()
# return result
# else:
# return jsonify('Erreur de chargement de l \'API', r.status_code)
try:
data = db.session.query(BibNoms, Taxref, TMedias)\
.distinct(BibNoms.cd_ref)\
.join(CorNomListe, CorNomListe.id_liste == id)\
.join(Taxref, Taxref.cd_ref == BibNoms.cd_ref)\
.outerjoin(TMedias, TMedias.cd_ref == BibNoms.cd_ref)\
.all()
# current_app.logger.debug(
# [{'nom': d[0], 'taxref': d[1]} for d in data])
return [
{
'nom': d[0].as_dict(),
'taxref': d[1].as_dict(),
'medias': d[2].as_dict() if d[2] else None
} for d in data]
except Exception as e:
return {'error_message': str(e)}, 400


# @routes.route('/taxonomy/lists/full', methods=['GET'])
Expand Down
4 changes: 2 additions & 2 deletions config/default_config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ UPLOAD_FOLDER = 'static/medias'
# Front end configuration
[FRONTEND]
PROD_MOD = false
DISPLAU_HEADER = false
DISPLAY_HEADER = false
DISPLAY_FOOTER = false
MULTILINGUAL = false

Expand All @@ -55,4 +55,4 @@ MULTILINGUAL = false
title = 'GeoNature-Citizen API'
version = 'x.x.x'
produces = ["application/json"]
consumes = ["application/json"]
consumes = ["application/json"]
2 changes: 1 addition & 1 deletion frontend/src/app/app.component.css
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.router-app {
margin-top: 106px !important;
}
}
Empty file modified frontend/src/app/app.component.html
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

import { AppConfig } from './../conf/app.config';
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';


@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class AppComponent implements OnInit{
title = 'GeoNature-citizen';
Expand Down
34 changes: 28 additions & 6 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,25 @@ import { AboutComponent } from "./about/about.component";
import { AboutCustomComponent } from "./about/custom/custom.component";
import { AboutFixedComponent } from "./about/fixed/fixed.component";
import { HomeCustomComponent } from "./home/custom/custom.component";
import { FlowComponent } from './programs/sights/modalflow/flow/flow.component'
// import { FlowService } from './programs/sights/flow/flow.service'
import { FlowDirective } from './programs/sights/modalflow/flow/flow.directive'
import { OnboardComponent } from './programs/sights/modalflow/steps/onboard/onboard.component'
import { CommittedComponent } from './programs/sights/modalflow/steps/committed/committed.component'
import { CongratsComponent } from './programs/sights/modalflow/steps/congrats/congrats.component';
import { ModalFlowComponent } from './programs/sights/modalflow/modalflow.component';
import { RewardComponent } from './programs/sights/modalflow/steps/reward/reward.component';
import { ModalFlowService } from './programs/sights/modalflow/modalflow.service';

@NgModule({
imports: [
BrowserModule,
NgbModule,
HttpModule,
HttpClientModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
routing
FormsModule,
NgbModule,
routing,
],
declarations: [
AppComponent,
Expand All @@ -62,19 +71,32 @@ import { HomeCustomComponent } from "./home/custom/custom.component";
SpeciesComponent,
AboutComponent,
AboutCustomComponent,
AboutFixedComponent
AboutFixedComponent,
FlowComponent,
FlowDirective,
OnboardComponent,
CommittedComponent,
CongratsComponent,
ModalFlowComponent,
RewardComponent,
],
providers: [
AuthService,
GncService,
GncProgramsService,
// FlowService,
ModalFlowService,
],
bootstrap: [AppComponent],
entryComponents: [
DescModalComponent,
LoginComponent,
LogoutComponent,
RegisterComponent
RegisterComponent,
OnboardComponent,
CommittedComponent,
CongratsComponent,
RewardComponent,
]
})
export class AppModule {}
26 changes: 12 additions & 14 deletions frontend/src/app/auth/login/login.component.css
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.modal-header{
background: #60b15c;
background: -moz-linear-gradient(top, #60b15c 0%, #60b15c 50%, #57a154 51%, #57a154 100%);
background: -webkit-linear-gradient(top, #60b15c 0%,#60b15c 50%,#57a154 51%,#57a154 100%);
background: linear-gradient(to bottom, #60b15c 0%,#60b15c 50%,#57a154 51%,#57a154 100%);
background-color: var(--secondary);
background-image: -moz-linear-gradient(to bottom, var(--secondary), var(--secondary-gradient));
background-image: -webkit-linear-gradient(to bottom, var(--secondary), var(--secondary-gradient));
background-image: linear-gradient(to bottom, var(--secondary), var(--secondary-gradient));
border-radius: 0px;
align-items : center;
max-height: 61px;
Expand All @@ -23,31 +23,28 @@
}

span.input-group-text {
background: #60b15c;
background-color: var(--secondary);
color: #fff;
}

.modal-body input{
border: solid 1px transparent;
background: #eee;
border : solid 1px #bbb;
transition: all .2s ease-in-out;
}

.modal-body input:focus{
background: rgb(196, 196, 196);
}

.modal-body input::placeholder{
font-style: italic;
}

.modal-body .form-row:first-child, .modal-body .form-row:nth-child(2n) {
border-bottom: solid 1px #60b15c;
border-bottom: solid 1px;
border-bottom-color: var(--secondary);
margin-bottom: 10px;
}

.modal-body button {
background: #60b15c;
background-color: var(--secondary);
color: #fff;
border: solid 1px transparent;
display: flex;
Expand All @@ -56,6 +53,7 @@ span.input-group-text {

.modal-body button:hover{
background: transparent;
color: #60b15c;
border: solid 1px #60b15c;
color: var(--secondary);
border: solid 1px;
border-color: var(--secondary)
}
Empty file modified frontend/src/app/auth/login/login.component.html
100755 → 100644
Empty file.
8 changes: 2 additions & 6 deletions frontend/src/app/auth/logout/logout.component.css
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ span.input-group-text {

.modal-body input{
border: solid 1px transparent;
background: #eee;
border : solid 1px #bbb;
transition: all .2s ease-in-out;
}

.modal-body input:focus{
background: rgb(196, 196, 196);
}

.modal-body input::placeholder{
font-style: italic;
}
Expand All @@ -56,6 +52,6 @@ span.input-group-text {

.modal-body button:hover{
background: transparent;
color: #60b15c;
color: var(--secondary);
border: solid 1px #60b15c;
}
Loading

0 comments on commit 34d292f

Please sign in to comment.