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
864
Issues
864
List
Boards
Labels
Service Desk
Milestones
Merge Requests
53
Merge Requests
53
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
Commits
44e3c610
Commit
44e3c610
authored
11 hours ago
by
Olivia Madrid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): Media modal - show activity message in modal
parent
215074b8
feat/media-modal-1539
1 merge request
!467
[Sprint/KiltedKoala](feat): Media modal
Pipeline
#77002692
passed with stages
in 52 minutes and 28 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
29 deletions
+52
-29
read-more.directive.ts
src/app/common/read-more/read-more.directive.ts
+20
-14
modal.component.html
src/app/modules/media/modal/modal.component.html
+18
-10
modal.component.scss
src/app/modules/media/modal/modal.component.scss
+4
-0
modal.component.ts
src/app/modules/media/modal/modal.component.ts
+10
-5
No files found.
src/app/common/read-more/read-more.directive.ts
View file @
44e3c610
import
{
Directive
,
ElementRef
,
ContentChild
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Directive
,
ElementRef
,
ContentChild
,
ChangeDetectorRef
,
Input
}
from
'
@angular/core
'
;
import
{
ReadMoreButtonComponent
}
from
'
./button.component
'
;
@
Directive
({
...
...
@@ -8,28 +8,34 @@ export class ReadMoreDirective {
_element
:
any
;
realHeight
:
any
;
maxHeightAllowed
:
number
=
320
;
expandable
:
boolean
=
false
;
@
ContentChild
(
ReadMoreButtonComponent
,
{
'
static
'
:
false
})
button
;
@
Input
()
maxHeightAllowed
:
number
;
constructor
(
private
element
:
ElementRef
,
private
cd
:
ChangeDetectorRef
)
{
this
.
_element
=
element
.
nativeElement
;
}
ngAfterViewInit
()
{
this
.
realHeight
=
this
.
_element
.
clientHeight
;
if
(
this
.
button
&&
!
this
.
button
.
content
)
this
.
button
.
content
=
this
;
if
(
this
.
realHeight
>
this
.
maxHeightAllowed
)
{
this
.
_element
.
style
.
maxHeight
=
this
.
maxHeightAllowed
+
'
px
'
;
this
.
_element
.
style
.
position
=
'
relative
'
;
setTimeout
(()
=>
{
this
.
expandable
=
true
;
this
.
detectChanges
();
},
1
);
if
(
!
this
.
maxHeightAllowed
)
{
this
.
maxHeightAllowed
=
320
;
}
setTimeout
(()
=>
{
this
.
realHeight
=
this
.
_element
.
clientHeight
;
if
(
this
.
button
&&
!
this
.
button
.
content
)
{
this
.
button
.
content
=
this
;
}
if
(
this
.
realHeight
>
this
.
maxHeightAllowed
)
{
this
.
_element
.
style
.
maxHeight
=
this
.
maxHeightAllowed
+
'
px
'
;
this
.
_element
.
style
.
position
=
'
relative
'
;
setTimeout
(()
=>
{
this
.
expandable
=
true
;
this
.
detectChanges
();
},
1
);
}
},
1
);
}
expand
()
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.html
View file @
44e3c610
...
...
@@ -143,21 +143,29 @@
<a
i18n=
"@@MINDS__CARDS__entity__BOOSTED_LABEL_ONCHAIN"
[hidden]=
"!entity.boosted_onchain"
[routerLink]=
"['/token']"
>
Boosted Onchain
</a>
</div>
</a>
</div>
</div>
<!-- MESSAGE -->
<div
class=
"m-mediaModal__message mdl-card__supporting-text"
m-read-more
*ngIf=
"hasMessage"
[maxHeightAllowed]=
"136"
>
<span
class=
"m-mature-message-content"
[innerHtml]=
"entity.message | tags"
>
</span>
<m-read-more--button></m-read-more--button>
</div>
<!-- ACTION BUTTONS -->
<div
class=
"m-mediaModal__actionButtonsWrapper"
>
<div
class=
"m-mediaModal__actionButtonsRow m-action-tabs"
>
<m-wire-button
*ngIf=
"session.getLoggedInUser().guid != entity.owner_guid"
[object]=
"entity"
(done)=
"wireSubmitted($event)"
></m-wire-button>
<minds-button-thumbs-up
[object]=
"entity"
></minds-button-thumbs-up>
<minds-button-thumbs-down
[object]=
"entity"
></minds-button-thumbs-down>
<minds-button-remind
[object]=
"entity"
></minds-button-remind>
</div>
<div
class=
"m-mediaModal__actionButtonsRow m-action-tabs"
>
<m-wire-button
*ngIf=
"session.getLoggedInUser().guid != entity.owner_guid"
[object]=
"entity"
(done)=
"wireSubmitted($event)"
></m-wire-button>
<minds-button-thumbs-up
[object]=
"entity"
></minds-button-thumbs-up>
<minds-button-thumbs-down
[object]=
"entity"
></minds-button-thumbs-down>
<minds-button-remind
[object]=
"entity"
></minds-button-remind>
</div>
</div>
<!-- COMMENTS -->
<div
class=
"m-mediaModal__comments"
*ngIf=
"entity.guid"
>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.scss
View file @
44e3c610
...
...
@@ -489,6 +489,10 @@ m-overlay-modal {
}
}
.m-mediaModal__message
a
{
text-decoration
:
none
;
}
.m-mediaModal__actionButtonsWrapper
{
.m-mediaModal__actionButtonsRow
{
display
:
flex
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/media/modal/modal.component.ts
View file @
44e3c610
...
...
@@ -49,6 +49,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
isFullscreen
:
boolean
=
false
;
isVideo
:
boolean
=
false
;
// Otherwise it's an image
aspectRatio
:
number
;
modalWidth
:
number
;
stageWidth
:
number
;
stageHeight
:
number
;
...
...
@@ -68,6 +69,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
boosted
:
boolean
=
false
;
ownerIconTime
:
string
=
''
;
permalinkGuid
:
string
=
''
;
hasMessage
:
boolean
=
true
;
// Used for backdrop click detection hack
isOpen
:
boolean
=
false
;
...
...
@@ -98,7 +100,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
ngOnInit
()
{
// Prevent dismissal of modal when it's just been opened
this
.
isOpenTimeout
=
setTimeout
(()
=>
this
.
isOpen
=
true
,
5
0
);
this
.
isOpenTimeout
=
setTimeout
(()
=>
this
.
isOpen
=
true
,
2
0
);
this
.
boosted
=
this
.
entity
.
boosted
||
this
.
entity
.
p2p_boosted
;
...
...
@@ -111,8 +113,11 @@ export class MediaModalComponent implements OnInit, OnDestroy {
}
}
else
{
this
.
title
=
this
.
entity
.
title
;
this
.
hasMessage
=
false
;
}
this
.
entity
.
message
=
this
.
hasMessage
?
this
.
title
:
null
;
// Set ownerIconTime
const
session
=
this
.
session
.
getLoggedInUser
();
if
(
session
&&
session
.
guid
===
this
.
entity
.
ownerObj
.
guid
)
{
...
...
@@ -171,7 +176,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
this
.
thumbnail
=
this
.
entity
.
custom_data
.
thumbnail_src
;
// Not currently used
}
this
.
entity
.
aspectRatio
=
this
.
entity
.
width
/
this
.
entity
.
height
;
this
.
aspectRatio
=
this
.
entity
.
width
/
this
.
entity
.
height
;
this
.
calculateDimensions
();
// ! TEMP
...
...
@@ -282,7 +287,7 @@ export class MediaModalComponent implements OnInit, OnDestroy {
if
(
widthDiff
>=
1
)
{
// What mediaHeight would be if it shrunk proportionally to difference in width
const
mediaHeightPreview
=
Math
.
round
((
this
.
mediaWidth
-
widthDiff
)
/
this
.
entity
.
aspectRatio
);
const
mediaHeightPreview
=
Math
.
round
((
this
.
mediaWidth
-
widthDiff
)
/
this
.
aspectRatio
);
// Shrink media if mediaHeight is still above min
if
(
mediaHeightPreview
>
this
.
minStageHeight
)
{
...
...
@@ -298,10 +303,10 @@ export class MediaModalComponent implements OnInit, OnDestroy {
}
scaleHeight
()
{
return
Math
.
round
(
this
.
mediaWidth
/
this
.
entity
.
aspectRatio
);
return
Math
.
round
(
this
.
mediaWidth
/
this
.
aspectRatio
);
}
scaleWidth
()
{
return
Math
.
round
(
this
.
mediaHeight
*
this
.
entity
.
aspectRatio
);
return
Math
.
round
(
this
.
mediaHeight
*
this
.
aspectRatio
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment