Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(fix): media modal blog route
· 4a3d0af6
Marcelo Rivera
authored
Aug 29, 2019
4a3d0af6
(feat): redirect to respective entities' pages when on mobile
· eb5c7bd3
Marcelo Rivera
authored
Aug 29, 2019
eb5c7bd3
Hide whitespace changes
Inline
Side-by-side
src/app/modules/media/modal/modal.component.ts
View file @
eb5c7bd3
...
...
@@ -162,7 +162,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
if
(
this
.
redirectUrl
)
{
this
.
location
.
replaceState
(
this
.
redirectUrl
);
}
else
if
(
this
.
entityType
===
'
blog
'
)
{
this
.
location
.
replaceState
(
`/blog/
${
this
.
entity
.
slug
}
-
${
this
.
entity
.
guid
}
`
);
this
.
location
.
replaceState
(
`
${
this
.
session
.
getLoggedInUser
().
username
}
/blog/
${
this
.
entity
.
slug
}
-
${
this
.
entity
.
guid
}
`
);
}
else
{
this
.
location
.
replaceState
(
`/media/
${
this
.
entity
.
entity_guid
}
`
);
}
...
...
src/app/modules/pro/channel/tiles/media/tile.component.ts
View file @
eb5c7bd3
import
{
ChangeDetectionStrategy
,
Component
,
ElementRef
,
HostListener
,
Input
,
ViewChild
}
from
'
@angular/core
'
;
import
{
ChangeDetectionStrategy
,
Component
,
ElementRef
,
Input
,
ViewChild
}
from
'
@angular/core
'
;
import
{
MediaModalComponent
,
MediaModalParams
}
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
"
;
import
{
ProChannelService
}
from
"
../../channel.service
"
;
import
isMobile
from
"
../../../../../helpers/is-mobile
"
;
@
Component
({
selector
:
'
m-pro--channel-tile
'
,
...
...
@@ -67,13 +68,31 @@ export class ProTileComponent {
}
}
goToEntityPage
(
entity
:
any
)
{
switch
(
this
.
getType
(
entity
))
{
case
'
object:image
'
:
case
'
object:video
'
:
this
.
router
.
navigate
([
`/media/
${
entity
.
guid
}
`
]);
break
;
case
'
object:blog
'
:
let
url
=
`/blog/
${
this
.
entity
.
slug
}
-
${
this
.
entity
.
guid
}
`
;
if
(
!
window
.
Minds
.
pro
)
{
url
=
`
${
this
.
channelService
.
currentChannel
.
username
}
/
${
url
}
`
;
}
this
.
router
.
navigate
([
url
]);
break
;
}
}
showMediaModal
()
{
const
activity
=
toMockActivity
(
this
.
entity
,
this
.
entity
.
subtype
===
'
video
'
?
this
.
videoDimensions
:
null
);
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) {
// this.router.navigate([`/media/${this.entity.guid}`]);
// }
if
(
isMobile
()
&&
Math
.
min
(
screen
.
width
,
screen
.
height
)
<
768
)
{
this
.
goToEntityPage
(
this
.
entity
);
return
;
}
if
(
activity
.
custom_type
===
'
video
'
)
{
activity
.
custom_data
.
dimensions
=
this
.
videoDimensions
;
...
...