mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
46063: working CSS truncation, but were switching to JS again...
This commit is contained in:
@@ -9,34 +9,34 @@ import { TruncatableService } from './truncatable.service';
|
||||
styleUrls: ['./truncatable.component.scss']
|
||||
})
|
||||
export class TruncatableComponent {
|
||||
@Input() minLines: number;
|
||||
@Input() maxLines: number;
|
||||
@Input() initialExpand = false;
|
||||
@Input() id: string;
|
||||
@Input() content;
|
||||
private lines: number;
|
||||
@Input() onHover = false;
|
||||
|
||||
public constructor(private service: TruncatableService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.initialExpand) {
|
||||
this.service.toggle(this.id);
|
||||
}
|
||||
this.setLines();
|
||||
}
|
||||
|
||||
public toggleCollapse() {
|
||||
this.service.toggle(this.id);
|
||||
this.setLines();
|
||||
}
|
||||
|
||||
private setLines() {
|
||||
if (this.service.isCollapsed(this.id)) {
|
||||
this.lines = this.minLines;
|
||||
this.service.expand(this.id);
|
||||
} else {
|
||||
this.lines = this.maxLines;
|
||||
this.service.collapse(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public hoverCollapse() {
|
||||
if (this.onHover) {
|
||||
this.service.collapse(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public hoverExpand() {
|
||||
if (this.onHover) {
|
||||
this.service.expand(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public toggle() {
|
||||
this.service.toggle(this.id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user