added context-menu buttons
This commit is contained in:
parent
145b8617b1
commit
7bdcc6277f
|
@ -4,16 +4,16 @@
|
||||||
</a>
|
</a>
|
||||||
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||||
|
|
||||||
<a *ngIf="!(isBoostLocked || isLocked)" href class="action-bar__link action-bar__link--boost" title="Boost" [class.boosted]="isBoosted"
|
<a *ngIf="!(isBoostLocked || isLocked)" href class="action-bar__link action-bar__link--boost" title="Boost"
|
||||||
[class.boosting]="boostIsLoading" (click)="boost()">
|
[class.boosted]="isBoosted" [class.boosting]="boostIsLoading" (click)="boost()">
|
||||||
<fa-icon [icon]="faRetweet"></fa-icon>
|
<fa-icon [icon]="faRetweet"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
<fa-icon *ngIf="isBoostLocked && !isLocked" class="action-bar__lock" title="This post cannot be boosted"
|
<fa-icon *ngIf="isBoostLocked && !isLocked" class="action-bar__lock" title="This post cannot be boosted"
|
||||||
[icon]="faLock"></fa-icon>
|
[icon]="faLock"></fa-icon>
|
||||||
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||||
|
|
||||||
<a *ngIf="!isLocked" href class="action-bar__link action-bar__link--fav" title="Favourite" [class.favorited]="isFavorited"
|
<a *ngIf="!isLocked" href class="action-bar__link action-bar__link--fav" title="Favourite"
|
||||||
[class.favoriting]="favoriteIsLoading" (click)="favorite()">
|
[class.favorited]="isFavorited" [class.favoriting]="favoriteIsLoading" (click)="favorite()">
|
||||||
<fa-icon [icon]="faStar"></fa-icon>
|
<fa-icon [icon]="faStar"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
<fa-icon *ngIf="isLocked" class="action-bar__lock" title="Account can't access this post" [icon]="faLock"></fa-icon>
|
||||||
|
@ -27,19 +27,33 @@
|
||||||
<fa-icon [icon]="faWindowCloseRegular"></fa-icon>
|
<fa-icon [icon]="faWindowCloseRegular"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href class="action-bar__link action-bar__link--more" (click)="onContextMenu($event, item)" title="More" [contextMenu]="basicMenu" [contextMenuSubject]="item">
|
<a href class="action-bar__link action-bar__link--more" (click)="onContextMenu($event, item)" title="More"
|
||||||
<fa-icon [icon]="faEllipsisH" [contextMenu]="basicMenu" [contextMenuSubject]="item" ></fa-icon>
|
[contextMenu]="basicMenu" [contextMenuSubject]="item">
|
||||||
|
<fa-icon [icon]="faEllipsisH" [contextMenu]="basicMenu" [contextMenuSubject]="item"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
<context-menu #basicMenu>
|
<context-menu #basicMenu>
|
||||||
<ng-template contextMenuItem (execute)="showMessage('Hi, ' + $event.item.name)">
|
<ng-template contextMenuItem (execute)="expandStatus()">
|
||||||
Say hi!
|
Expand status
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<!-- <ng-template contextMenuItem divider="true"></ng-template> -->
|
<ng-template contextMenuItem (execute)="copyStatusLink()">
|
||||||
<ng-template contextMenuItem let-item (execute)="showMessage($event.item.name + ' said: ' + $event.item.otherProperty)">
|
Copy link to status
|
||||||
Bye, {{item?.name}}
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<!-- <ng-template contextMenuItem passive="true">
|
<ng-template contextMenuItem divider="true"></ng-template>
|
||||||
Input something: <input type="text">
|
<ng-template contextMenuItem (execute)="mentionAccount()">
|
||||||
|
Mention @account
|
||||||
|
</ng-template>
|
||||||
|
<ng-template contextMenuItem (execute)="dmAccount()">
|
||||||
|
Direct message @account
|
||||||
|
</ng-template>
|
||||||
|
<ng-template contextMenuItem divider="true"></ng-template>
|
||||||
|
<ng-template contextMenuItem (execute)="muteAccount()">
|
||||||
|
Mute @account
|
||||||
|
</ng-template>
|
||||||
|
<ng-template contextMenuItem (execute)="blockAccount()">
|
||||||
|
Block @account
|
||||||
|
</ng-template>
|
||||||
|
<!-- <ng-template contextMenuItem (execute)="showMessage('Hi, ' + $event.item.name)">
|
||||||
|
Mute @account
|
||||||
</ng-template> -->
|
</ng-template> -->
|
||||||
</context-menu>
|
</context-menu>
|
||||||
</div>
|
</div>
|
|
@ -72,7 +72,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
||||||
const status = this.statusWrapper.status;
|
const status = this.statusWrapper.status;
|
||||||
const account = this.statusWrapper.provider;
|
const account = this.statusWrapper.provider;
|
||||||
|
|
||||||
if(status.reblog){
|
if (status.reblog) {
|
||||||
this.favoriteStatePerAccountId[account.id] = status.reblog.favourited;
|
this.favoriteStatePerAccountId[account.id] = status.reblog.favourited;
|
||||||
this.bootedStatePerAccountId[account.id] = status.reblog.reblogged;
|
this.bootedStatePerAccountId[account.id] = status.reblog.reblogged;
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,7 +133,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
boost(): boolean {
|
boost(): boolean {
|
||||||
if(this.boostIsLoading) return;
|
if (this.boostIsLoading) return;
|
||||||
|
|
||||||
this.boostIsLoading = true;
|
this.boostIsLoading = true;
|
||||||
const account = this.toolsService.getSelectedAccounts()[0];
|
const account = this.toolsService.getSelectedAccounts()[0];
|
||||||
|
@ -149,7 +149,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((boostedStatus: Status) => {
|
.then((boostedStatus: Status) => {
|
||||||
if(boostedStatus.pleroma){
|
if (boostedStatus.pleroma) {
|
||||||
this.bootedStatePerAccountId[account.id] = boostedStatus.reblog !== null; //FIXME: when Pleroma will return the good status
|
this.bootedStatePerAccountId[account.id] = boostedStatus.reblog !== null; //FIXME: when Pleroma will return the good status
|
||||||
} else {
|
} else {
|
||||||
this.bootedStatePerAccountId[account.id] = boostedStatus.reblogged;
|
this.bootedStatePerAccountId[account.id] = boostedStatus.reblogged;
|
||||||
|
@ -168,7 +168,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
favorite(): boolean {
|
favorite(): boolean {
|
||||||
if(this.favoriteIsLoading) return;
|
if (this.favoriteIsLoading) return;
|
||||||
|
|
||||||
this.favoriteIsLoading = true;
|
this.favoriteIsLoading = true;
|
||||||
const account = this.toolsService.getSelectedAccounts()[0];
|
const account = this.toolsService.getSelectedAccounts()[0];
|
||||||
|
@ -224,12 +224,43 @@ export class ActionBarComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public onContextMenu($event: MouseEvent, item: any): void {
|
public onContextMenu($event: MouseEvent, item: any): void {
|
||||||
this.contextMenuService.show.next({
|
this.contextMenuService.show.next({
|
||||||
// Optional - if unspecified, all context menu components will open
|
// Optional - if unspecified, all context menu components will open
|
||||||
contextMenu: this.basicMenu,
|
contextMenu: this.basicMenu,
|
||||||
event: $event,
|
event: $event,
|
||||||
item: item,
|
item: item,
|
||||||
});
|
});
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expandStatus(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
copyStatusLink(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mentionAccount(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
dmAccount(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
muteAccount(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockAccount(): boolean {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
& .dropdown-menu {
|
& .dropdown-menu {
|
||||||
border: solid 1px $context-menu-border-color;
|
border: solid 1px $context-menu-border-color;
|
||||||
background-color: $context-menu-background;
|
background-color: $context-menu-background;
|
||||||
padding: 3px 0;
|
padding: 2px 0;
|
||||||
border-radius: 3px;
|
border-radius: 2px;
|
||||||
//border: solid 2px $context-menu-border-color;
|
//border: solid 2px $context-menu-border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
color: $context-menu-font-color;
|
color: $context-menu-font-color;
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.5em 1em;
|
padding: 0.5em 1em;
|
||||||
padding: 5px 10px;
|
padding: 3px 10px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: all .2s;
|
transition: all .2s;
|
||||||
|
|
||||||
|
@ -33,4 +33,8 @@
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .divider {
|
||||||
|
border-top: solid 2px $context-menu-border-color;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue