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
896
Issues
896
List
Boards
Labels
Service Desk
Milestones
Merge Requests
49
Merge Requests
49
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
2de08fc158543d5669e5e807b9ab046b2d92b0f8...b7bcce4aca18fe9cebf97d4d96ca1c054a7ed160
Source
b7bcce4aca18fe9cebf97d4d96ca1c054a7ed160
Select Git revision
...
Target
2de08fc158543d5669e5e807b9ab046b2d92b0f8
Select Git revision
Compare
Commits (2)
(feat): media modal should support blogs
· 8e4096b1
Marcelo Rivera
authored
32 minutes ago
8e4096b1
Merge branch 'epic/minds-pro' of
https://gitlab.com/minds/front
into epic/minds-pro
· b7bcce4a
Marcelo Rivera
authored
31 minutes ago
b7bcce4a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
18 deletions
+114
-18
activity.ts
src/app/modules/legacy/components/cards/activity/activity.ts
+1
-1
remind.ts
src/app/modules/legacy/components/cards/remind/remind.ts
+1
-1
modal.component.html
src/app/modules/media/modal/modal.component.html
+27
-1
modal.component.scss
src/app/modules/media/modal/modal.component.scss
+42
-0
modal.component.ts
src/app/modules/media/modal/modal.component.ts
+34
-6
channel.service.ts
src/app/modules/pro/channel/channel.service.ts
+0
-4
tile.component.ts
src/app/modules/pro/channel/tiles/media/tile.component.ts
+9
-5
No files found.
src/app/modules/legacy/components/cards/activity/activity.ts
View file @
b7bcce4a
...
...
@@ -479,7 +479,7 @@ export class Activity implements OnInit {
openModal
()
{
this
.
activity
.
modal_source_url
=
this
.
router
.
url
;
this
.
overlayModal
.
create
(
MediaModalComponent
,
this
.
activity
,
{
this
.
overlayModal
.
create
(
MediaModalComponent
,
{
entity
:
this
.
activity
}
,
{
class
:
'
m-overlayModal--media
'
}).
present
();
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/remind/remind.ts
View file @
b7bcce4a
...
...
@@ -187,7 +187,7 @@ export class Remind {
openModal
()
{
this
.
activity
.
modal_source_url
=
this
.
router
.
url
;
this
.
overlayModal
.
create
(
MediaModalComponent
,
this
.
activity
,
{
this
.
overlayModal
.
create
(
MediaModalComponent
,
{
entity
:
this
.
activity
}
,
{
class
:
'
m-overlayModal--media
'
}).
present
();
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.html
View file @
b7bcce4a
...
...
@@ -21,9 +21,34 @@
<!-- MEDIA STAGE -->
<div
class=
"m-mediaModal__stage"
>
<div
class=
"m-mediaModal__mediaWrapper m-mediaModal__mediaWrapper--blog"
*ngIf=
"entityType === 'blog'"
[style.width]=
"mediaWidth + 'px'"
[style.height]=
"mediaHeight + 'px'"
>
<!-- [@slowFadeAnimation]="isLoading ? 'out' : 'in'" -->
<minds-banner
[src]=
"entity.thumbnail_src"
[object]=
"entity"
*ngIf=
"entity.header_bg"
></minds-banner>
<div
class=
"mdl-grid"
style=
"max-width:740px"
>
<div
class=
"mdl-grid"
style=
"width:100%"
>
<div
class=
"mdl-cell mdl-cell--12-col"
>
<h1
class=
"m-blog--title"
>
{{entity.title}}
</h1>
</div>
</div>
<div
style=
"width:100%; padding:8px; position:relative;"
>
<div
class=
"mdl-cell mdl-cell--12-col minds-blog-body"
[innerHtml]=
"entity.description | safe"
[hidden]=
"!entity.description"
></div>
</div>
</div>
</div>
<!-- MEDIA: IMAGE -->
<div
class=
"m-mediaModal__mediaWrapper m-mediaModal__mediaWrapper--image"
*ngIf=
"!isVideo"
*ngIf=
"!isVideo
&& entityType === 'image'
"
[style.width]=
"mediaWidth + 'px'"
[style.height]=
"mediaHeight + 'px'"
[@
slowFadeAnimation]=
"isLoading ? 'out' : 'in'"
...
...
@@ -55,6 +80,7 @@
[torrent]=
"[{ res: '360', key: entity.custom_data.guid + '/360.mp4' }]"
(videoCanPlayThrough)=
"isLoaded()"
[@
slowFadeAnimation]=
"isLoading ? 'out' : 'in'"
#player
>
<video-ads
[player]=
"player"
*ngIf=
"entity.monetized"
></video-ads>
</m-video>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.scss
View file @
b7bcce4a
...
...
@@ -100,6 +100,48 @@ m-overlay-modal {
}
}
.m-mediaModal__mediaWrapper--blog
{
line-height
:
initial
;
overflow-y
:
auto
;
text-align
:
left
;
@include
m-theme
()
{
color
:
themed
(
$m-white-always
);
}
h1
.m-blog--title
{
font-weight
:
600
;
font-size
:
42px
;
letter-spacing
:
1
.5px
;
font-family
:
'Roboto'
,
Helvetica
,
sans-serif
;
text-rendering
:
optimizeLegibility
;
-webkit-font-smoothing
:
antialiased
;
text-align
:
left
;
}
p
{
@include
m-theme
()
{
color
:
themed
(
$m-white-always
);
}
}
.minds-blog-body
img
{
@media
screen
and
(
max-width
:
891px
)
{
width
:
100vw
;
}
max-width
:
initial
;
height
:
auto
;
width
:
80%
;
margin
:
0
-100px
;
}
.m-blog--image--caption
{
@include
m-theme
()
{
color
:
themed
(
$m-white-always
);
}
}
}
.m-mediaModal__stage
{
display
:
flex
;
align-items
:center
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.ts
View file @
b7bcce4a
...
...
@@ -9,6 +9,11 @@ import { AnalyticsService } from '../../../services/analytics';
import
{
MindsVideoComponent
}
from
'
../components/video/video.component
'
;
import
isMobileOrTablet
from
'
../../../helpers/is-mobile-or-tablet
'
;
export
type
MediaModalParams
=
{
redirectUrl
?:
string
,
entity
:
any
,
};
@
Component
({
selector
:
'
m-media--modal
'
,
templateUrl
:
'
modal.component.html
'
,
...
...
@@ -40,14 +45,17 @@ import isMobileOrTablet from '../../../helpers/is-mobile-or-tablet';
export
class
MediaModalComponent
implements
OnInit
,
OnDestroy
{
minds
=
window
.
Minds
;
entity
:
any
=
{};
redirectUrl
:
string
;
isLoading
:
boolean
=
true
;
navigatedAway
:
boolean
=
false
;
fullscreenHovering
:
boolean
=
false
;
// Used for fullscreen button transformation
isTablet
:
boolean
=
false
;
isFullscreen
:
boolean
=
false
;
isVideo
:
boolean
=
false
;
// Otherwise it's an image
isVideo
:
boolean
=
false
;
entityType
:
string
;
aspectRatio
:
number
;
modalWidth
:
number
;
...
...
@@ -83,8 +91,9 @@ export class MediaModalComponent implements OnInit, OnDestroy {
routerSubscription
:
Subscription
;
@
Input
(
'
entity
'
)
set
data
(
entity
)
{
this
.
entity
=
entity
;
@
Input
(
'
entity
'
)
set
data
(
params
:
MediaModalParams
)
{
this
.
entity
=
params
.
entity
;
this
.
redirectUrl
=
params
.
redirectUrl
||
null
;
this
.
entityWidth
=
0
;
this
.
entityHeight
=
0
;
}
...
...
@@ -139,13 +148,24 @@ export class MediaModalComponent implements OnInit, OnDestroy {
this
.
isTablet
=
isMobileOrTablet
()
&&
Math
.
min
(
screen
.
width
,
screen
.
height
)
>=
768
;
this
.
isVideo
=
this
.
entity
.
custom_type
===
'
video
'
;
this
.
entityType
=
this
.
entity
.
custom_type
||
this
.
getEntityType
(
this
.
entity
);
this
.
analyticsService
.
send
(
'
pageview
'
,
{
url
:
`/media/
${
this
.
entity
.
entity_guid
}
?ismodal=true`
});
if
(
this
.
entityType
===
'
blog
'
)
{
this
.
isLoaded
();
}
this
.
analyticsService
.
send
(
'
pageview
'
,
{
url
:
`/media/
${
this
.
entity
.
entity_guid
}
?ismodal=true`
});
// * LOCATION & ROUTING * -----------------------------------------------------------------------------------
// Change the url to point to media page so user can easily share link
// (but don't actually redirect)
this
.
location
.
replaceState
(
`/media/
${
this
.
entity
.
entity_guid
}
`
);
if
(
this
.
redirectUrl
)
{
this
.
location
.
replaceState
(
this
.
redirectUrl
);
}
else
if
(
this
.
entityType
===
'
blog
'
)
{
this
.
location
.
replaceState
(
`/blog/
${
this
.
entity
.
slug
}
-
${
this
.
entity
.
guid
}
`
);
}
else
{
this
.
location
.
replaceState
(
`/media/
${
this
.
entity
.
entity_guid
}
`
);
}
// When user clicks a link from inside the modal
this
.
routerSubscription
=
this
.
router
.
events
.
subscribe
((
event
:
Event
)
=>
{
...
...
@@ -167,11 +187,15 @@ export class MediaModalComponent implements OnInit, OnDestroy {
// * DIMENSION CALCULATIONS * ---------------------------------------------------------------------
if
(
!
this
.
isVideo
)
{
if
(
!
this
.
isVideo
&&
this
.
entityType
===
'
image
'
)
{
// Image
this
.
entityWidth
=
this
.
entity
.
custom_data
[
0
].
width
;
this
.
entityHeight
=
this
.
entity
.
custom_data
[
0
].
height
;
this
.
thumbnail
=
`
${
this
.
minds
.
cdn_url
}
fs/v1/thumbnail/
${
this
.
entity
.
entity_guid
}
/xlarge`
;
}
else
if
(
this
.
entityType
===
'
blog
'
)
{
this
.
entityWidth
=
this
.
entity
.
custom_data
[
0
].
dimensions
.
width
;
this
.
entityHeight
=
this
.
entity
.
custom_data
[
0
].
dimensions
.
height
;
this
.
thumbnail
=
`
${
this
.
minds
.
cdn_url
}
fs/v1/thumbnail/
${
this
.
entity
.
entity_guid
}
/xlarge`
;
}
else
{
this
.
entityWidth
=
this
.
entity
.
custom_data
.
dimensions
.
width
;
this
.
entityHeight
=
this
.
entity
.
custom_data
.
dimensions
.
height
;
...
...
@@ -434,6 +458,10 @@ export class MediaModalComponent implements OnInit, OnDestroy {
}
}
getEntityType
(
entity
:
any
)
{
return
entity
.
type
===
'
object
'
?
`
${
entity
.
type
}
:
${
entity
.
subtype
}
`
:
entity
.
type
;
}
ngOnDestroy
()
{
if
(
this
.
routerSubscription
)
{
this
.
routerSubscription
.
unsubscribe
();
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/channel.service.ts
View file @
b7bcce4a
...
...
@@ -5,7 +5,6 @@ import { Client } from '../../../services/api/client';
import
{
EntitiesService
}
from
'
../../../common/services/entities.service
'
;
import
normalizeUrn
from
'
../../../helpers/normalize-urn
'
;
import
{
OverlayModalService
}
from
'
../../../services/ux/overlay-modal
'
;
import
{
BlogView
}
from
"
../../blogs/view/view
"
;
import
{
Session
}
from
'
../../../services/session
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
...
...
@@ -180,9 +179,6 @@ export class ProChannelService {
case
'
group
'
:
window
.
open
(
`
${
window
.
Minds
.
site_url
}
groups/profile/
${
entity
.
guid
}
`
,
'
_blank
'
);
break
;
case
'
object:blog
'
:
modalServiceContext
.
create
(
BlogView
,
entity
).
present
();
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/tiles/media/tile.component.ts
View file @
b7bcce4a
import
{
ChangeDetectionStrategy
,
Component
,
ElementRef
,
HostListener
,
Input
,
ViewChild
}
from
'
@angular/core
'
;
import
{
MediaModalComponent
}
from
"
../../../../media/modal/modal.component
"
;
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
"
;
...
...
@@ -61,10 +61,8 @@ export class ProTileComponent {
switch
(
this
.
getType
(
this
.
entity
))
{
case
'
object:image
'
:
case
'
object:video
'
:
this
.
showMediaModal
();
break
;
case
'
object:blog
'
:
this
.
channelService
.
open
(
this
.
entity
,
this
.
modalService
);
this
.
showMediaModal
(
);
break
;
}
}
...
...
@@ -88,7 +86,13 @@ export class ProTileComponent {
activity
.
modal_source_url
=
this
.
router
.
url
;
this
.
modalService
.
create
(
MediaModalComponent
,
activity
,
{
const
params
:
MediaModalParams
=
{
entity
:
activity
};
if
(
window
.
Minds
.
pro
&&
this
.
getType
(
this
.
entity
)
===
'
object:blog
'
)
{
params
.
redirectUrl
=
`/blog/
${
this
.
entity
.
slug
}
-
${
this
.
entity
.
guid
}
`
;
}
this
.
modalService
.
create
(
MediaModalComponent
,
params
,
{
class
:
'
m-overlayModal--media
'
}).
present
();
}
else
{
...
...
This diff is collapsed.
Click to expand it.