Skip to content

Commit

Permalink
Merge pull request #15111 from opf/feature/53577-handle-no-active-pro…
Browse files Browse the repository at this point in the history
…ject-attributes-in-project-overview-sidebar

Feature/53577 handle no active project attributes in project overview sidebar
  • Loading branch information
dombesz authored Mar 27, 2024
2 parents b0206c0 + beaaa31 commit 3b246a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/views/layouts/_common_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<meta name="current_project"
data-project-name="<%= h @project.name %>"
data-project-id="<%= @project.id %>"
data-project-identifier="<%= @project.identifier %>"/>
data-project-identifier="<%= @project.identifier %>"
data-project-custom-fields-count="<%= @project.project_custom_fields.visible.count %>"/>
<% end %>
<meta name="current_user"
data-name="<%= User.current.name %>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';

@Injectable({ providedIn: 'root' })
export class CurrentProjectService {
private current:{ id:string, identifier:string, name:string };
private current:{ id:string, identifier:string, name:string, customFieldsCount:string };

constructor(
private PathHelper:PathHelperService,
Expand Down Expand Up @@ -73,7 +73,11 @@ export class CurrentProjectService {
return this.getCurrent('identifier');
}

private getCurrent(key:'id'|'identifier'|'name') {
public get customFieldsCount():string|null {
return this.getCurrent('customFieldsCount');
}

private getCurrent(key:'id'|'identifier'|'name'|'customFieldsCount') {
if (this.current && this.current[key]) {
return this.current[key].toString();
}
Expand All @@ -91,6 +95,7 @@ export class CurrentProjectService {
id: element.dataset.projectId!,
name: element.dataset.projectName!,
identifier: element.dataset.projectIdentifier!,
customFieldsCount: element.dataset.projectCustomFieldsCount!,
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/features/overview/overview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class OverviewComponent extends GridPageComponent {
}

protected isTurboFrameSidebarEnabled():boolean {
return true;
return this.currentProject.customFieldsCount !== '0';
}

protected turboFrameSidebarSrc():string {
Expand Down

0 comments on commit 3b246a3

Please sign in to comment.