Skip to content

Commit c955816

Browse files
committed
Move subscription button to DSO edit menu
1 parent 404ccd9 commit c955816

8 files changed

Lines changed: 37 additions & 158 deletions

src/app/collection-page/collection-page.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
</ds-comcol-page-content>
3535
</header>
3636
<ds-dso-edit-menu></ds-dso-edit-menu>
37-
<div class="pl-2 space-children-mr">
38-
<ds-dso-page-subscription-button [dso]="collection"></ds-dso-page-subscription-button>
39-
</div>
4037
</div>
4138
<section class="comcol-page-browse-section">
4239
<!-- Browse-By Links -->

src/app/community-page/community-page.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
</ds-comcol-page-content>
2222
</header>
2323
<ds-dso-edit-menu></ds-dso-edit-menu>
24-
<div class="pl-2 space-children-mr">
25-
<ds-dso-page-subscription-button [dso]="communityPayload"></ds-dso-page-subscription-button>
26-
</div>
2724
</div>
2825
<section class="comcol-page-browse-section">
2926

src/app/shared/dso-page/dso-edit-menu.resolver.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import { getDSORoute } from '../../app-routing-paths';
2121
import { ResearcherProfileDataService } from '../../core/profile/researcher-profile-data.service';
2222
import { NotificationsService } from '../notifications/notifications.service';
2323
import { TranslateService } from '@ngx-translate/core';
24+
import { SubscriptionModalComponent } from '../subscriptions/subscription-modal/subscription-modal.component';
25+
import { Community } from '../../core/shared/community.model';
26+
import { Collection } from '../../core/shared/collection.model';
2427

2528
/**
2629
* Creates the menus for the dspace object pages
@@ -84,6 +87,7 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
8487
getDsoMenus(dso, route, state): Observable<MenuSection[]>[] {
8588
return [
8689
this.getItemMenu(dso),
90+
this.getComColMenu(dso),
8791
this.getCommonMenu(dso, state)
8892
];
8993
}
@@ -178,6 +182,39 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
178182
}
179183
}
180184

185+
/**
186+
* Get Community/Collection-specific menus
187+
*/
188+
protected getComColMenu(dso): Observable<MenuSection[]> {
189+
if (dso instanceof Community || dso instanceof Collection) {
190+
return combineLatest([
191+
this.authorizationService.isAuthorized(FeatureID.CanSubscribe, dso.self),
192+
]).pipe(
193+
map(([canSubscribe]) => {
194+
return [
195+
{
196+
id: 'subscribe',
197+
active: false,
198+
visible: canSubscribe,
199+
model: {
200+
type: MenuItemType.ONCLICK,
201+
text: 'subscriptions.tooltip',
202+
function: () => {
203+
const modalRef = this.modalService.open(SubscriptionModalComponent);
204+
modalRef.componentInstance.dso = dso;
205+
}
206+
} as OnClickMenuItemModel,
207+
icon: 'bell',
208+
index: 4
209+
},
210+
];
211+
})
212+
);
213+
} else {
214+
return observableOf([]);
215+
}
216+
}
217+
181218
/**
182219
* Claim a researcher by creating a profile
183220
* Shows notifications and/or hides the menu section on success/error

src/app/shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component.html

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/app/shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component.scss

Whitespace-only changes.

src/app/shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component.spec.ts

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/app/shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/app/shared/shared.module.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ import {
273273
AdvancedClaimedTaskActionRatingComponent
274274
} from './mydspace-actions/claimed-task/rating/advanced-claimed-task-action-rating.component';
275275
import { ClaimedTaskActionsDeclineTaskComponent } from './mydspace-actions/claimed-task/decline-task/claimed-task-actions-decline-task.component';
276-
import {
277-
DsoPageSubscriptionButtonComponent
278-
} from './dso-page/dso-page-subscription-button/dso-page-subscription-button.component';
279276
import { EpersonGroupListComponent } from './eperson-group-list/eperson-group-list.component';
280277
import { EpersonSearchBoxComponent } from './eperson-group-list/eperson-search-box/eperson-search-box.component';
281278
import { GroupSearchBoxComponent } from './eperson-group-list/group-search-box/group-search-box.component';
@@ -395,7 +392,6 @@ const COMPONENTS = [
395392
ItemPageTitleFieldComponent,
396393
ThemedSearchNavbarComponent,
397394
ListableNotificationObjectComponent,
398-
DsoPageSubscriptionButtonComponent,
399395
MetadataFieldWrapperComponent,
400396
ContextHelpWrapperComponent,
401397
EpersonGroupListComponent,

0 commit comments

Comments
 (0)