Allowing custom templates inside notification note
This commit is contained in:
parent
820b2efd88
commit
6fef754651
@ -25,7 +25,7 @@
|
|||||||
position: relative
|
position: relative
|
||||||
|
|
||||||
&:not(.hide-dismiss)
|
&:not(.hide-dismiss)
|
||||||
padding-right: 40px
|
padding-right: 50px
|
||||||
|
|
||||||
.note-dismiss
|
.note-dismiss
|
||||||
display: block
|
display: block
|
||||||
@ -46,9 +46,17 @@
|
|||||||
position: absolute
|
position: absolute
|
||||||
text-align: center
|
text-align: center
|
||||||
top: 50%
|
top: 50%
|
||||||
transform(translateY(-50%))
|
transform(translateY(-50%) rotate(0deg))
|
||||||
|
transform-origin(50% 50%)
|
||||||
|
transition(transform 0.3s ease)
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
background: rgba(0, 0, 0, 0.1)
|
||||||
|
|
||||||
|
i
|
||||||
|
transform(translateY(-50%) rotate(180deg))
|
||||||
|
|
||||||
&.in
|
&.in
|
||||||
max-height: auto
|
max-height: auto
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|||||||
@ -2,7 +2,13 @@
|
|||||||
<div class="notification-note {{this.class}}">
|
<div class="notification-note {{this.class}}">
|
||||||
<div class="note-container">
|
<div class="note-container">
|
||||||
<div class="note-body alert alert-{{choose this.style 'info'}} {{#if hideDismiss}}hide-dismiss{{/if}}">
|
<div class="note-body alert alert-{{choose this.style 'info'}} {{#if hideDismiss}}hide-dismiss{{/if}}">
|
||||||
<div class="note-text">{{this.text}}</div>
|
<div class="note-content">
|
||||||
|
{{#if this.template}}
|
||||||
|
{{>Template.dynamic template=this.template data=(choose this.templateData this)}}
|
||||||
|
{{else}}
|
||||||
|
{{this.text}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
<div class="note-dismiss">
|
<div class="note-dismiss">
|
||||||
<i class="fa fa-times"></i>
|
<i class="fa fa-times"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Notifications.dismiss = id => {
|
|||||||
Notifications.clear = () => Array.from(Notifications.views.keys()).forEach(Notifications.dismiss);
|
Notifications.clear = () => Array.from(Notifications.views.keys()).forEach(Notifications.dismiss);
|
||||||
|
|
||||||
// Display a notification note
|
// Display a notification note
|
||||||
Notifications.show = ({ template, promise, text, style, timeout=5000 }) => {
|
Notifications.show = ({ template, data, text, style, timeout=5000, promise }) => {
|
||||||
// Check if the given template exists
|
// Check if the given template exists
|
||||||
const templateObject = Template[template];
|
const templateObject = Template[template];
|
||||||
if (template && !templateObject) {
|
if (template && !templateObject) {
|
||||||
@ -52,6 +52,8 @@ Notifications.show = ({ template, promise, text, style, timeout=5000 }) => {
|
|||||||
|
|
||||||
let notificationPromise;
|
let notificationPromise;
|
||||||
let templateData = {
|
let templateData = {
|
||||||
|
template,
|
||||||
|
data,
|
||||||
text,
|
text,
|
||||||
style,
|
style,
|
||||||
timeout,
|
timeout,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user