Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
Minds Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
Minds
Minds Frontend
Commits
317ddbb8
Commit
317ddbb8
authored
5 years ago
by
Marcelo Rivera
Browse files
Options
Downloads
Patches
Plain Diff
(feat): use media modal in channel media feeds
parent
80e43c8c
No related branches found
Branches containing commit
No related tags found
2 merge requests
!684
Error in video player (sentry)
,
!683
Use media modal in channel media feeds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/modules/newsfeed/feeds/tiles.component.html
+4
-2
4 additions, 2 deletions
src/app/modules/newsfeed/feeds/tiles.component.html
src/app/modules/newsfeed/feeds/tiles.component.ts
+58
-1
58 additions, 1 deletion
src/app/modules/newsfeed/feeds/tiles.component.ts
with
62 additions
and
3 deletions
src/app/modules/newsfeed/feeds/tiles.component.html
+
4
−
2
View file @
317ddbb8
...
...
@@ -10,9 +10,11 @@
[ngClass]=
"{
'm-newsfeed-tiles__Tile--is-mature': attachment.shouldBeBlurred(entity)
}"
[routerLink]=
"['/newsfeed', entity.guid]"
>
<img
[src]=
"getThumbnailSrc(entity$ | async)"
/>
<img
[src]=
"getThumbnailSrc(entity$ | async)"
(click)=
"clickedImage(entity, this)"
/>
<i
*ngIf=
"attachment.shouldBeBlurred(entity)"
class=
"material-icons mature-icon"
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/feeds/tiles.component.ts
+
58
−
1
View file @
317ddbb8
import
{
Component
,
ChangeDetectionStrategy
,
Input
}
from
'
@angular/core
'
;
import
{
AttachmentService
}
from
'
../../../services/attachment
'
;
import
{
MediaModalComponent
}
from
'
../../media/modal/modal.component
'
;
import
{
OverlayModalService
}
from
'
../../../services/ux/overlay-modal
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
isMobile
from
'
../../../helpers/is-mobile
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
@
Component
({
selector
:
'
m-newsfeed__tiles
'
,
...
...
@@ -9,7 +14,12 @@ import { AttachmentService } from '../../../services/attachment';
export
class
NewsfeedTilesComponent
{
@
Input
()
entities
:
any
[]
=
[];
constructor
(
public
attachment
:
AttachmentService
)
{}
constructor
(
public
attachment
:
AttachmentService
,
private
router
:
Router
,
private
overlayModalService
:
OverlayModalService
,
private
featuresService
:
FeaturesService
)
{}
getThumbnailSrc
(
entity
:
any
)
{
let
src
:
string
=
''
;
...
...
@@ -37,4 +47,51 @@ export class NewsfeedTilesComponent {
isUnlisted
(
entity
:
any
)
{
return
entity
&&
(
entity
.
access_id
===
'
0
'
||
entity
.
access_id
===
0
);
}
clickedImage
(
entity
:
any
,
batchImage
)
{
const
isNotTablet
=
Math
.
min
(
screen
.
width
,
screen
.
height
)
<
768
;
const
pageUrl
=
`/media/
${
entity
.
entity_guid
}
`
;
if
(
isMobile
()
&&
isNotTablet
)
{
this
.
router
.
navigate
([
pageUrl
]);
return
;
}
if
(
!
this
.
featuresService
.
has
(
'
media-modal
'
))
{
this
.
router
.
navigate
([
pageUrl
]);
return
;
}
else
{
if
(
entity
.
width
===
'
0
'
||
entity
.
height
===
'
0
'
)
{
this
.
setImageDimensions
(
entity
,
batchImage
);
}
this
.
openModal
(
entity
);
}
}
// setVideoDimensions($event) {
// this.videoDimensions = $event.dimensions;
// entity.custom_data.dimensions = videoDimensions;
// }
setImageDimensions
(
entity
,
imageElement
:
HTMLImageElement
)
{
const
img
:
HTMLImageElement
=
imageElement
;
entity
.
width
=
img
.
naturalWidth
;
entity
.
height
=
img
.
naturalHeight
;
}
openModal
(
entity
)
{
entity
.
modal_source_url
=
this
.
router
.
url
;
this
.
overlayModalService
.
create
(
MediaModalComponent
,
{
entity
:
entity
,
},
{
class
:
'
m-overlayModal--media
'
,
}
)
.
present
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment