Skip to content

Commit

Permalink
Updated public comment periods to redirect to external URLs when present
Browse files Browse the repository at this point in the history
  • Loading branch information
rpyyj committed Sep 13, 2023
1 parent 0e641a3 commit bd60662
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 20 deletions.
22 changes: 20 additions & 2 deletions src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,28 @@ <h3 class="title-container__title">
Project Info
</a>
<a
*ngIf="item?.pcp && item?.type === 'Public Comment Period'"
*ngIf="
item.pcp &&
item.type === 'Public Comment Period' &&
(!item.pcp.isMet || !item.pcp.metURL)
"
class="btn btn-sm content-btn-alt"
title="View this Public Comment Period"
[routerLink]="['/p', item.project?._id, 'cp', item.pcp]"
[routerLink]="['/p', item.project?._id, 'cp', item.pcp._id]"
>
Submit/ View Comments
</a>
<a
*ngIf="
item.pcp &&
item.type === 'Public Comment Period' &&
item.pcp.isMet &&
item.pcp.metURL
"
class="btn btn-sm content-btn-alt"
href="{{ item.pcp.metURL }}"
target="_blank"
title="View this Public Comment Period"
>
Submit/ View Comments
</a>
Expand Down
4 changes: 4 additions & 0 deletions src/app/models/commentperiod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export class CommentPeriod {
informationLabel: String;
instructions: String;
isClassified: Boolean;
isMet: Boolean;
isPublished: Boolean;
isResolved: Boolean;
isVetted: String;
metURL: String;
milestone: String;
openCommentPeriod: String;
openHouses: String;
Expand Down Expand Up @@ -76,10 +78,12 @@ export class CommentPeriod {
this.downloadRoles = obj && obj.downloadRoles || null;
this.informationLabel = obj && obj.informationLabel || null;
this.instructions = obj && obj.instructions || null;
this.isMet = obj && obj.isMet || null;
this.isClassified = obj && obj.isClassified || null;
this.isPublished = obj && obj.isPublished || null;
this.isResolved = obj && obj.isResolved || null;
this.isVetted = obj && obj.isVetted || null;
this.metURL = obj && obj.metURL || null;
this.milestone = obj && obj.milestone || null;
this.openHouses = obj && obj.openHouses || null;
this.periodType = obj && obj.periodType || null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export class NewsListTableRowsComponent extends TableRowComponent {


goToCP(activity) {
this.router.navigate(['p', activity.project._id, 'cp', activity.pcp]);
if (activity.pcp.isMet && activity.pcp.metURL) {
window.open(activity.pcp.metURL, '_blank');
} else {
this.router.navigate(['p', activity.project._id, 'cp', activity.pcp._id]);
}
}

isSingleDoc(item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,51 @@
<h4>{{(rowData.name.toUpperCase() || '-')}}</h4>
</div>
<div class="col-md-12 col-lg-6 text-lg-right">
<a *ngIf="rowData.commentPeriod?.commentPeriodStatus === 'Open'"
<a *ngIf="
rowData.commentPeriod?.commentPeriodStatus === 'Open' &&
(!rowData.commentPeriod?.isMet || !rowData.commentPeriod?.metURL)
"
class="btn btn-primary view-pcp-btn"
title="View this Public Comment Period"
[routerLink]="['/pn', rowData._id, 'cp', rowData.commentPeriod?._id]">
[routerLink]="['/pn', rowData._id, 'cp', rowData.commentPeriod?._id]"
>
<div class="pcp-indicator pcp-indicator-active"></div>
Open Comment Period - View/Submit
</a>
<a *ngIf="rowData.commentPeriod?.commentPeriodStatus === 'Closed'"
<a *ngIf="
rowData.commentPeriod?.commentPeriodStatus === 'Open' &&
rowData.commentPeriod?.isMet &&
!rowData.commentPeriod?.metURL
"
class="btn btn-primary view-pcp-btn"
href="{{ rowData.commentPeriod.metURL }}"
target="_blank"
title="View this Public Comment Period"
[routerLink]="['/pn', rowData._id, 'cp', rowData.commentPeriod?._id]">
>
<div class="pcp-indicator pcp-indicator-active"></div>
Open Comment Period - View/Submit
</a>
<a *ngIf="
rowData.commentPeriod?.commentPeriodStatus === 'Closed' &&
(!rowData.commentPeriod?.isMet || !rowData.commentPeriod?.metURL)
"
class="btn btn-primary view-pcp-btn"
title="View this Public Comment Period"
[routerLink]="['/pn', rowData._id, 'cp', rowData.commentPeriod?._id]"
>
<div class="pcp-indicator pcp-indicator-inactive"></div>
View Completed Comment Period
</a>
<a *ngIf="
rowData.commentPeriod?.commentPeriodStatus === 'Closed' &&
rowData.commentPeriod?.isMet &&
!rowData.commentPeriod?.metURL
"
class="btn btn-primary view-pcp-btn"
href="{{ rowData.commentPeriod.metURL }}"
target="_blank"
title="View this Public Comment Period"
>
<div class="pcp-indicator pcp-indicator-inactive"></div>
View Completed Comment Period
</a>
Expand Down Expand Up @@ -86,4 +120,4 @@ <h4>{{(rowData.name.toUpperCase() || '-')}}</h4>
<p class="value">{{getTrigger(rowData) || "-" }}</p>
</div>
</div>
</div>
</div>
6 changes: 5 additions & 1 deletion src/app/project/commenting-tab/commenting-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export class CommentingTabComponent implements OnInit, OnDestroy {
}

goToCP(commentPeriod) {
this.router.navigate(['p', this.currentProject._id, 'cp', commentPeriod._id]);
if (commentPeriod.isMet && commentPeriod.metURL) {
window.open(commentPeriod.metURL, '_blank');
} else {
this.router.navigate(['p', this.currentProject._id, 'cp', commentPeriod._id]);
}
}

getCommentPeriods(projectId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</a>
<button *ngIf="rowData?.pcp"
class="btn content-btn-alt"
(click)="goToItem(rowData)">
(click)="goToCP(rowData)">
<span>Submit/ View Comment(s)</span>
</button>
</div>
</td>
<td scope="row"
data-label="Date"
class="col-2"
tabindex="0">{{rowData.dateAdded | date:'longDate'}}</td>
tabindex="0">{{rowData.dateAdded | date:'longDate'}}</td>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ export class ActivitiesListTableRowsComponent extends TableRowComponent {
super();
}

goToItem(item) {
this.router.navigate(['p', item.project._id, 'cp', item.pcp]);
goToCP(activity) {
if (activity.pcp.isMet && activity.pcp.metURL) {
window.open(activity.pcp.metURL, '_blank');
} else {
this.router.navigate(['p', activity.project._id, 'cp', activity.pcp._id]);
}
}

isSingleDoc(item) {
Expand Down
6 changes: 5 additions & 1 deletion src/app/project/project.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ export class ProjectComponent implements OnInit, OnDestroy, AfterViewInit {
}

public goToViewComments() {
this.router.navigate(['/p', this.project._id, 'cp', this.project.commentPeriodForBanner._id, 'details']);
if (this.project.commentPeriodForBanner.isMet && this.project.commentPeriodForBanner.metURL) {
window.open(this.project.commentPeriodForBanner.metURL, '_blank');
} else {
this.router.navigate(['/p', this.project._id, 'cp', this.project.commentPeriodForBanner._id, 'details']);
}
}

public handleSidebarToggle(event) {
Expand Down
10 changes: 4 additions & 6 deletions src/app/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,11 @@ export class ApiService {
'project',
'dateStarted',
'dateCompleted',
'instructions'
'instructions',
'isMet',
'metURL',
];
// TODO: May want to pass this as a parameter in the future.
const sort = '&sortBy=-dateStarted';

let queryString = 'commentperiod?project=' + projId + '&fields=' + this.buildValues(fields) + '&';
if (sort !== null) { queryString += `sortBy=${sort}&`; }
const queryString = `commentperiod?project=${projId}&sortBy=-dateStarted&fields=${this.buildValues(fields)}`;
return this.http.get<Object>(`${this.apiPath}/${queryString}`, {});
}

Expand Down

0 comments on commit bd60662

Please sign in to comment.