Skip to content

Commit 5b14c75

Browse files
committed
Merge branch 'develop'
2 parents 9680dae + 01bb58b commit 5b14c75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3115
-2690
lines changed

browserslist .browserslistrc

File renamed without changes.

angular.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,21 @@
6969
"glob": "**/*",
7070
"input": "node_modules/chart.js/dist/",
7171
"output": "./assets/lib/chartjs"
72+
},
73+
{
74+
"glob": "**/*",
75+
"input": "node_modules/ace-builds/src-min",
76+
"output": "./assets/ace-builds/"
7277
}
7378
],
7479
"styles": [
75-
"node_modules/select2/dist/css/select2.min.css",
76-
"src/styles.css"
80+
"src/styles.css",
81+
"node_modules/summernote/dist/summernote-lite.min.css"
7782
],
7883
"scripts": [
7984
"node_modules/marked/lib/marked.js",
8085
"src/assets/plugins/simplemde/simplemde.start.js",
81-
"node_modules/select2/dist/js/select2.min.js"
86+
"node_modules/summernote/dist/summernote-lite.min.js"
8287
]
8388
},
8489
"configurations": {

e2e/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../tsconfig.base.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
55
"module": "commonjs",
6-
"target": "es5",
6+
"target": "es2018",
77
"types": [
88
"jasmine",
99
"jasminewd2",

package-lock.json

+2,330-2,522
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+37-38
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "les-projets-cagnottes",
3-
"version": "0.5.4",
3+
"version": "0.6.0",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
@@ -12,57 +12,56 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/animations": "^9.1.9",
16-
"@angular/cdk": "^9.2.4",
17-
"@angular/common": "^9.1.9",
18-
"@angular/compiler": "^9.1.9",
19-
"@angular/core": "^9.1.9",
20-
"@angular/flex-layout": "^9.0.0-beta.31",
21-
"@angular/forms": "^9.1.9",
22-
"@angular/localize": "~9.1.9",
23-
"@angular/platform-browser": "^9.1.9",
24-
"@angular/platform-browser-dynamic": "^9.1.9",
25-
"@angular/router": "^9.1.9",
26-
"@fortawesome/fontawesome-free": "^5.13.0",
15+
"@angular/animations": "^10.0.2",
16+
"@angular/cdk": "^10.0.1",
17+
"@angular/common": "^10.0.2",
18+
"@angular/compiler": "^10.0.2",
19+
"@angular/core": "^10.0.2",
20+
"@angular/forms": "^10.0.2",
21+
"@angular/localize": "~10.0.2",
22+
"@angular/platform-browser": "^10.0.2",
23+
"@angular/platform-browser-dynamic": "^10.0.2",
24+
"@angular/router": "^10.0.2",
25+
"@fortawesome/fontawesome-free": "^5.13.1",
2726
"admin-lte": "^3.0.5",
2827
"bootstrap": "^4.5.0",
2928
"core-js": "^3.6.5",
30-
"ionicons": "^5.0.1",
29+
"ionicons": "^5.1.2",
3130
"jquery": "^3.5.1",
3231
"jquery-slimscroll": "^1.3.8",
33-
"ng-select2": "^1.2.2",
3432
"ngx-bootstrap": "^5.6.1",
35-
"ngx-markdown": "^9.1.1",
36-
"rxjs": "^6.5.5",
37-
"rxjs-compat": "^6.5.5",
38-
"select2": "^4.0.13",
33+
"ngx-markdown": "^10.0.0",
34+
"ngx-summernote": "^0.7.7",
35+
"rxjs": "^6.6.0",
36+
"rxjs-compat": "^6.6.0",
3937
"simplemde": "^1.11.2",
40-
"tslib": "^1.13.0",
38+
"summernote": "^0.8.18",
39+
"tslib": "^2.0.0",
4140
"zone.js": "^0.10.3"
4241
},
4342
"devDependencies": {
44-
"@angular-devkit/build-angular": "~0.901.7",
45-
"@angular/cli": "^9.1.7",
46-
"@angular/compiler-cli": "^9.1.9",
47-
"@angular/language-service": "^9.1.9",
48-
"@types/jasmine": "^3.5.10",
43+
"@angular-devkit/build-angular": "~0.1000.1",
44+
"@angular/cli": "^10.0.1",
45+
"@angular/compiler-cli": "^10.0.2",
46+
"@angular/language-service": "^10.0.2",
47+
"@types/jasmine": "^3.5.11",
4948
"@types/jasminewd2": "^2.0.8",
50-
"@types/jquery": "^3.3.38",
51-
"@types/node": "^14.0.5",
52-
"codelyzer": "^5.2.2",
53-
"jasmine-core": "^3.5.0",
54-
"jasmine-spec-reporter": "^5.0.2",
55-
"karma": "^5.0.5",
56-
"karma-chrome-launcher": "^3.1.0",
49+
"@types/jquery": "^3.5.0",
50+
"@types/node": "^14.0.14",
51+
"codelyzer": "^6.0.0",
52+
"jasmine-core": "~3.5.0",
53+
"jasmine-spec-reporter": "~5.0.0",
54+
"karma": "~5.0.0",
55+
"karma-chrome-launcher": "~3.1.0",
5756
"karma-cli": "^2.0.0",
5857
"karma-coverage-istanbul-reporter": "~3.0.2",
59-
"karma-jasmine": "^3.1.1",
60-
"karma-jasmine-html-reporter": "^1.5.4",
61-
"protractor": "^7.0.0",
58+
"karma-jasmine": "~3.3.0",
59+
"karma-jasmine-html-reporter": "^1.5.0",
60+
"protractor": "~7.0.0",
6261
"rxjs-tslint": "^0.1.8",
63-
"ts-node": "~8.10.1",
64-
"tslint": "^6.1.2",
65-
"typescript": "~3.8.3",
62+
"ts-node": "~8.10.2",
63+
"tslint": "~6.1.0",
64+
"typescript": "~3.9.6",
6665
"webpack": "^4.43.0"
6766
}
6867
}

src/app/_entities/idea.ts

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { IdeaModel } from '../_models';
2+
3+
import { Organization } from './organization';
4+
import { User } from './user';
5+
6+
export class Idea extends IdeaModel {
7+
8+
submitter: User = new User();
9+
organization: Organization = new Organization();
10+
followers: User[] = [];
11+
tags: any[] = [];
12+
13+
static fromModel(model: IdeaModel): Idea {
14+
var entity = new Idea();
15+
entity.id = model.id;
16+
entity.createdAt = model.createdAt;
17+
entity.createdBy = model.createdBy;
18+
entity.updatedAt = model.updatedAt;
19+
entity.updatedBy = model.updatedBy;
20+
entity.icon = model.icon;
21+
entity.shortDescription = model.shortDescription;
22+
entity.longDescription = model.longDescription;
23+
entity.hasAnonymousCreator = model.hasAnonymousCreator;
24+
entity.hasLeaderCreator = model.hasLeaderCreator;
25+
entity.submitter = new User();
26+
entity.submitter.id = model.submitter.id;
27+
entity.organization = new Organization();
28+
entity.organization.id = model.organization.id;
29+
return entity;
30+
}
31+
32+
static valuesOf(models: IdeaModel[]): Idea[] {
33+
var entities = [];
34+
models.forEach(model => entities.push(this.fromModel(model)));
35+
return entities;
36+
}
37+
38+
setSubmitter(submitters: User[]) {
39+
var result = submitters.find(submitter => this.submitter.id === submitter.id);
40+
result !== undefined ? this.submitter = result : null;
41+
}
42+
43+
}

src/app/_entities/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from './budget';
44
export * from './campaign';
55
export * from './content';
66
export * from './donation';
7+
export * from './idea';
78
export * from './organization';
89
export * from './organization.authority';
910
export * from './slack.team';

src/app/_models/generic.model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
export class GenericModel {
3-
id: number;
3+
id: number = 0;
44

55
static valueOf(id: number): GenericModel {
66
var generic = new GenericModel();

src/app/_models/idea.model.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { GenericModel } from './generic.model';
2+
import { AuditModel } from './audit.model';
3+
4+
export class IdeaModel extends AuditModel {
5+
icon: string = '';
6+
shortDescription: string = '';
7+
longDescription: string = '';
8+
hasAnonymousCreator: boolean = false;
9+
hasLeaderCreator: boolean = false;
10+
submitter: GenericModel = new GenericModel();
11+
organization: GenericModel = new GenericModel();
12+
}

src/app/_models/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export * from './campaign.model';
77
export * from './content.model';
88
export * from './donation.model';
99
export * from './generic.model';
10+
export * from './idea.model';
1011
export * from './organization.model';
1112
export * from './organization.authority.model';
1213
export * from './role';

src/app/_services/authentication.service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export class AuthenticationService {
2020
constructor(private http: HttpClient) {
2121
this.currentUserSubject = new BehaviorSubject<User>(JSON.parse(localStorage.getItem('currentUser')));
2222
this.currentUser = this.currentUserSubject.asObservable();
23-
this.currentOrganizationSubject = new BehaviorSubject<Organization>(JSON.parse(localStorage.getItem('currentOrganization')));
23+
if(localStorage.getItem('currentOrganization') != undefined) {
24+
this.currentOrganizationSubject = new BehaviorSubject<Organization>(JSON.parse(localStorage.getItem('currentOrganization')));
25+
} else {
26+
this.currentOrganizationSubject = new BehaviorSubject<Organization>(new Organization());
27+
}
2428
this.currentOrganization = this.currentOrganizationSubject.asObservable();
2529
}
2630

@@ -63,7 +67,7 @@ export class AuthenticationService {
6367
user.organizations = Organization.fromModels(responses[3]);
6468
localStorage.setItem('currentUser', JSON.stringify(user));
6569
this.currentUserSubject.next(user);
66-
if(this.currentOrganizationValue === null && user.organizations.length >= 0) {
70+
if(this.currentOrganizationValue.id <= 0 && user.organizations.length >= 0) {
6771
this.setCurrentOrganization(user.organizations[0]);
6872
}
6973
return user;

src/app/_services/idea.service.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient } from '@angular/common/http';
3+
import { environment } from '../../environments/environment';
4+
5+
import { IdeaModel } from '../_models';
6+
7+
@Injectable({ providedIn: 'root' })
8+
export class IdeaService {
9+
constructor(private http: HttpClient) { }
10+
11+
create(idea: IdeaModel) {
12+
return this.http.post(`${environment.apiUrl}/idea`, idea);
13+
}
14+
15+
update(idea: IdeaModel) {
16+
return this.http.put(`${environment.apiUrl}/idea`, idea);
17+
}
18+
19+
}

src/app/_services/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export * from './budget.service';
66
export * from './campaign.service';
77
export * from './content.service';
88
export * from './donation.service';
9+
export * from './idea.service';
910
export * from './organization.service';
1011
export * from './pager.service';
1112
export * from './slack.team.service';

src/app/_services/main.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export class MainService {
1212
return this.http.get(`${environment.apiUrl}/logs`, {responseType: 'text'});
1313
}
1414

15-
}
15+
}

src/app/_services/organization.service.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { OrganizationModel } from '../_models/organization.model';
88
import { OrganizationAuthorityModel } from '../_models/organization.authority.model';
99

1010
import { User } from '../_entities/user';
11-
import { ContentModel, CampaignModel } from '../_models';
11+
import { ContentModel, CampaignModel, IdeaModel } from '../_models';
1212
import { Organization } from '../_entities';
1313

1414
@Injectable({
@@ -70,6 +70,13 @@ export class OrganizationService {
7070
return this.http.get<CampaignModel[]>(`${environment.apiUrl}/organization/${id}/campaigns`, { params });
7171
}
7272

73+
getIdeas(id: number, offset: number, limit: number) {
74+
const params = new HttpParams()
75+
.set('offset', offset.toString())
76+
.set('limit', limit.toString())
77+
return this.http.get<IdeaModel[]>(`${environment.apiUrl}/organization/${id}/ideas`, { params });
78+
}
79+
7380
getMembers(organizationId: number, offset, limit) {
7481
const params = new HttpParams()
7582
.set('offset', offset)

src/app/_services/user.service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { OrganizationAuthority } from '../_entities/organization.authority';
88

99
@Injectable({ providedIn: 'root' })
1010
export class UserService {
11-
1211
constructor(private http: HttpClient) { }
1312

1413
list(offset: number, limit: number) {

src/app/about/about.component.html

-4
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,12 @@ <h2 id="libraries">2. Bibliothèques</h2>
7979
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
8080
<dt>JQuery Slimscroll</dt>
8181
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a> et <a href="https://opensource.org/licenses/gpl-license">The GPL License</a></dd>
82-
<dt>NG Select2</dt>
83-
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
8482
<dt>NGX Bootstrap</dt>
8583
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
8684
<dt>NGX Markdown</dt>
8785
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
8886
<dt>RXJS</dt>
8987
<dd><a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a></dd>
90-
<dt>Select2</dt>
91-
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
9288
<dt>SimpleMDE - Markdown Editor</dt>
9389
<dd><a href="https://opensource.org/licenses/MIT">The MIT License</a></dd>
9490
<dt>Tslib</dt>

src/app/app-routing.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { ReportComponent } from './app/report/report.component';
1515
import { GettingStartedComponent } from './app/documentation/getting-started/getting-started.component';
1616
import { AboutComponent } from './about/about.component';
1717
import { AdminComponent } from './app/admin/admin.component';
18+
import { ListIdeasComponent } from './app/ideas/list-ideas/list-ideas.component';
1819

1920
const routes: Routes = [
2021
{
@@ -33,6 +34,7 @@ const routes: Routes = [
3334
{ path: 'campaigns/:id/edit', component: EditCampaignComponent },
3435
{ path: 'campaigns/:id', component: ViewCampaignComponent },
3536
{ path: 'campaigns', component: ListCampaignsComponent },
37+
{ path: 'ideas', component: ListIdeasComponent },
3638
{ path: 'budgets', component: BudgetsComponent },
3739
{ path: 'profile', component: ProfileComponent },
3840
{ path: 'report', component: ReportComponent },

src/app/app.module.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
55
import { RouterModule } from '@angular/router';
66
import { MarkdownModule } from 'ngx-markdown';
77
import { ModalModule } from 'ngx-bootstrap/modal';
8-
import { NgSelect2Module } from 'ng-select2';
8+
import { NgxSummernoteModule } from 'ngx-summernote';
99

1010
import { AppRoutingModule } from './app-routing.module';
1111
import { AppComponent } from './app.component';
@@ -29,7 +29,7 @@ import { ReportComponent } from './app/report/report.component';
2929
import { GettingStartedComponent } from './app/documentation/getting-started/getting-started.component';
3030
import { AboutComponent } from './about/about.component';
3131
import { AdminComponent } from './app/admin/admin.component';
32-
32+
import { ListIdeasComponent } from './app/ideas/list-ideas/list-ideas.component';
3333

3434
@NgModule({
3535
declarations: [
@@ -48,15 +48,16 @@ import { AdminComponent } from './app/admin/admin.component';
4848
ReportComponent,
4949
GettingStartedComponent,
5050
AboutComponent,
51-
AdminComponent
51+
AdminComponent,
52+
ListIdeasComponent
5253
],
5354
imports: [
5455
BrowserModule,
5556
AppRoutingModule,
5657
FormsModule,
58+
NgxSummernoteModule,
5759
ReactiveFormsModule,
5860
HttpClientModule,
59-
NgSelect2Module,
6061
MarkdownModule.forRoot(),
6162
ModalModule.forRoot(),
6263
RouterModule.forRoot([])

src/app/app/budgets/budgets.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h3 class="card-title"><span i18n="@@organization">Organization</span> : {{ orga
4848
<input formControlName="endDate" type="date" id="endDate" name="endDate">
4949
</td>
5050
<td>
51-
<select class="form-control select2" style="width: 100%;" formControlName="rules">
51+
<select class="form-control" style="width: 100%;" formControlName="rules">
5252
<option *ngFor="let item of organizations[i].contents; index as k" value="{{ k }}">{{ item.name }}</option>
5353
</select>
5454
</td>

0 commit comments

Comments
 (0)