Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
861
Issues
861
List
Boards
Labels
Service Desk
Milestones
Merge Requests
54
Merge Requests
54
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
45ff104db892a3aa16ec345062ce154c62e1e801...6cb30e19ad24840f598a3565b9f08ec9fe718b4c
Source
6cb30e19ad24840f598a3565b9f08ec9fe718b4c
Select Git revision
...
Target
45ff104db892a3aa16ec345062ce154c62e1e801
Select Git revision
Compare
Commits (2)
(fix): cleanup and it now works with images
· 7ce2ec61
Marcelo Rivera
authored
50 minutes ago
7ce2ec61
(feat): move activity mock creator to its own file
· 6cb30e19
Marcelo Rivera
authored
48 minutes ago
6cb30e19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
38 deletions
+39
-38
channel.service.ts
src/app/modules/pro/channel/channel.service.ts
+0
-1
tile.component.ts
src/app/modules/pro/channel/tiles/media/tile.component.ts
+13
-37
mock-activity.ts
src/app/modules/pro/channel/util/mock-activity.ts
+26
-0
No files found.
src/app/modules/pro/channel/channel.service.ts
View file @
6cb30e19
...
...
@@ -8,7 +8,6 @@ import { OverlayModalService } from '../../../services/ux/overlay-modal';
import
{
BlogView
}
from
"
../../blogs/view/view
"
;
import
{
Session
}
from
'
../../../services/session
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
MediaModalComponent
}
from
"
../../media/modal/modal.component
"
;
export
type
RouterLinkToType
=
'
home
'
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/tiles/media/tile.component.ts
View file @
6cb30e19
import
{
Component
,
Input
}
from
'
@angular/core
'
;
import
isMobile
from
"
../../../../../helpers/is-mobile
"
;
import
{
Component
,
ElementRef
,
Input
,
ViewChild
}
from
'
@angular/core
'
;
import
{
MediaModalComponent
}
from
"
../../../../media/modal/modal.component
"
;
import
{
FeaturesService
}
from
"
../../../../../services/features.service
"
;
import
{
OverlayModalService
}
from
"
../../../../../services/ux/overlay-modal
"
;
import
{
Router
}
from
"
@angular/router
"
;
import
toMockActivity
from
"
../../util/mock-activity
"
;
@
Component
({
selector
:
'
m-pro--channel-tile
'
,
template
:
`
<img [src]="entity.thumbnail_src" *ngIf="getType(entity) === 'object:image'; else videoBlock">
<img
[src]="entity.thumbnail_src"
(click)="showMediaModal()"
*ngIf="getType(entity) === 'object:image'; else videoBlock"
#img
>
<ng-template #videoBlock>
<m-video
...
...
@@ -35,6 +40,7 @@ import { Router } from "@angular/router";
export
class
ProTileComponent
{
@
Input
()
entity
:
any
;
@
ViewChild
(
'
img
'
,
{
static
:
false
})
img
:
ElementRef
;
videoDimensions
:
Array
<
any
>
=
null
;
...
...
@@ -78,7 +84,7 @@ export class ProTileComponent {
}
showMediaModal
()
{
const
activity
=
t
his
.
as
Activity
(
this
.
entity
);
const
activity
=
t
oMock
Activity
(
this
.
entity
);
if
(
this
.
featuresService
.
has
(
'
media-modal
'
))
{
// Mobile (not tablet) users go to media page instead of modal
// if (isMobile() && Math.min(screen.width, screen.height) < 768) {
...
...
@@ -89,11 +95,9 @@ export class ProTileComponent {
activity
.
custom_data
.
dimensions
=
this
.
videoDimensions
;
}
else
{
// Image
// Set image dimensions if they're not already there
if
(
activity
.
custom_data
[
0
].
width
===
'
0
'
||
activity
.
custom_data
[
0
].
height
===
'
0
'
)
{
// const img: HTMLImageElement = this.batchImage.nativeElement;
// this.activity.custom_data[0].width = img.naturalWidth;
// this.activity.custom_data[0].height = img.naturalHeight;
}
const
img
:
HTMLImageElement
=
this
.
img
.
nativeElement
;
activity
.
custom_data
[
0
].
width
=
img
.
naturalWidth
;
activity
.
custom_data
[
0
].
height
=
img
.
naturalHeight
;
}
activity
.
modal_source_url
=
this
.
router
.
url
;
...
...
@@ -106,32 +110,4 @@ export class ProTileComponent {
}
}
/**
* generates an activity from an image or video
* @param entity
*/
private
asActivity
(
entity
:
any
)
{
let
obj
=
{
...
entity
,
entity_guid
:
entity
.
guid
,
custom_type
:
entity
.
subtype
,
};
console
.
warn
(
'
entity
'
,
entity
);
if
(
entity
.
subtype
===
'
video
'
)
{
obj
.
custom_data
=
{
...
entity
,
dimensions
:
this
.
videoDimensions
};
}
else
{
obj
.
custom_data
=
[{
...
entity
,
width
:
0
,
height
:
0
}];
}
return
obj
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/util/mock-activity.ts
0 → 100644
View file @
6cb30e19
/**
* generates an activity from an image or video
* @param entity
*/
export
default
function
toMockActivity
(
entity
:
any
)
{
let
obj
=
{
...
entity
,
entity_guid
:
entity
.
guid
,
custom_type
:
entity
.
subtype
,
};
if
(
entity
.
subtype
===
'
video
'
)
{
obj
.
custom_data
=
{
...
entity
,
dimensions
:
this
.
videoDimensions
};
}
else
{
obj
.
custom_data
=
[{
...
entity
,
width
:
0
,
height
:
0
}];
}
return
obj
;
}
This diff is collapsed.
Click to expand it.