email fixes, tweaks
This commit is contained in:
@@ -138,17 +138,15 @@ function emailModal(el, url) {
|
|||||||
email_modal_node.classList.add('is-open')
|
email_modal_node.classList.add('is-open')
|
||||||
body.appendChild(email_modal_node)
|
body.appendChild(email_modal_node)
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
selector:`#lineup-email-data-${data.get('event_lineup_id')} #email-editor`,
|
selector:`textarea#email-editor`,
|
||||||
content_css:"/css/application.css",
|
content_css:"/css/application.css",
|
||||||
plugins: 'image',
|
plugins: 'image',
|
||||||
menubar: false,
|
menubar: false,
|
||||||
toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | image',
|
toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | image',
|
||||||
paste_data_images: true,
|
paste_data_images: true,
|
||||||
statusbar:false})
|
statusbar:false})
|
||||||
// tinymce.activeEditor.setContent("Team,")
|
tinymce.remove();
|
||||||
// lineup_table_div.innerHTML = lineup_table
|
|
||||||
// email_modal.classList.add("is-open");
|
|
||||||
// email_modal.querySelector(".Modal-body").innerHTML = html;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,24 +384,11 @@ function initPage (){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailToLink(el, protocol='mailto') {
|
function mailToLink(el, protocol) {
|
||||||
console.log(el)
|
const {to, bcc} = el.dataset
|
||||||
console.log(el.dataset)
|
const subject = document.getElementById('email-subject').value
|
||||||
const {to, bcc, subject} = el.dataset
|
const email_body = document.getElementById('email-editor').value
|
||||||
const params = new URLSearchParams({
|
const url = `${protocol}://compose?recipient=${to}&bcc=${bcc}&subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(email_body)}`
|
||||||
bcc, subject: encodeURIComponent(subject),
|
|
||||||
})
|
|
||||||
const url = `${protocol}:${to}?${params}`
|
|
||||||
console.log(url)
|
|
||||||
// location.href=`mailto:${to}${params}`
|
|
||||||
const windowRef = window.open(url, '_blank');
|
|
||||||
windowRef.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sparkMailToLink(el) {
|
|
||||||
const protocol = 'readdle-spark'
|
|
||||||
const {to, bcc, subject} = el.dataset
|
|
||||||
const url = `${protocol}://compose?recipient=${to}&bcc=${bcc}&subject=${encodeURIComponent(subject)}`
|
|
||||||
console.log(url)
|
console.log(url)
|
||||||
// location.href=`mailto:${to}${params}`
|
// location.href=`mailto:${to}${params}`
|
||||||
const windowRef = window.open(url, '_blank');
|
const windowRef = window.open(url, '_blank');
|
||||||
|
|||||||
@@ -8,32 +8,37 @@
|
|||||||
<form>
|
<form>
|
||||||
<div class="FieldGroup">
|
<div class="FieldGroup">
|
||||||
<label class="FieldGroup-label">Subject</label>
|
<label class="FieldGroup-label">Subject</label>
|
||||||
<input class="Input" type="text" value="{{dateFormat event.startDate "ddd, MMM D, YYYY h:mm A" }}, {{ event.locationName }}, ({{#if (isAway event) }}@{{/if}}{{ event.opponentName }})">
|
<input class="Input" id="email-subject" type="text" value="{{dateFormat event.startDate "ddd, MMM D, YYYY h:mm A" }}, {{ event.locationName }}, ({{#if (isAway event) }}@{{/if}}{{ event.opponentName }})">
|
||||||
</div>
|
</div>
|
||||||
<div class="FieldGroup">
|
<div class="FieldGroup">
|
||||||
<label class="FieldGroup-label">Body</label>
|
<label class="FieldGroup-label">Body</label>
|
||||||
<textarea id="email-editor" class="Input"></textarea>
|
<textarea id="email-editor" class="Input"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="FieldGroup">
|
<div class="FieldGroup">
|
||||||
<label class="FieldGroup-label">Lineup</label>
|
<label class="FieldGroup-label">
|
||||||
|
Lineup
|
||||||
|
<button class="Button Button--smallSquare" role="button" type="button" onclick="copyEmailTable(this)">
|
||||||
|
{{{embeddedSvgFromPath "/bootstrap-icons/clipboard-fill.svg"}}}
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
<div class="lineup-email lineup-table">{{>email_table}}</div>
|
<div class="lineup-email lineup-table">{{>email_table}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="FieldGroup">
|
|
||||||
<button class="Button" role="button" type="button" onclick="copyEmailTable(this)">
|
</form>
|
||||||
{{{embeddedSvgFromPath "/bootstrap-icons/clipboard-fill.svg"}}}
|
</div>
|
||||||
{{{embeddedSvgFromPath "/bootstrap-icons/table.svg"}}}
|
<div class="Modal-footer">
|
||||||
Copy Table
|
<button class="Button" role="button" type="button" onclick="mailToLink(this, 'readdle-spark');",
|
||||||
</button>
|
|
||||||
<button class="Button" role="button" type="button" onclick="sparkMailToLink(this);",
|
|
||||||
data-to="{{user.email}}"
|
data-to="{{user.email}}"
|
||||||
data-bcc="{{joinMemberEmailAddresses (filterNonPlayers members)}}"
|
data-bcc="{{joinMemberEmailAddresses (filterNonPlayers members)}}">
|
||||||
data-subject="{{dateFormat event.startDate "ddd, MMM D, YYYY h:mm A" }}, {{ event.locationName }}, ({{#if (isAway event) }}@{{/if}}{{ event.opponentName }})">
|
|
||||||
{{{embeddedSvgFromPath "/teamsnap-ui/assets/icons/mail.svg"}}}
|
{{{embeddedSvgFromPath "/teamsnap-ui/assets/icons/mail.svg"}}}
|
||||||
Spark Mail
|
Spark Mail
|
||||||
</button>
|
</button>
|
||||||
</div>
|
<button class="Button" role="button" type="button" onclick="mailToLink(this, 'mailto');",
|
||||||
</form>
|
data-to="{{user.email}}"
|
||||||
|
data-bcc="{{joinMemberEmailAddresses (filterNonPlayers members)}}">
|
||||||
|
{{{embeddedSvgFromPath "/teamsnap-ui/assets/icons/mail.svg"}}}
|
||||||
|
Mail
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<table>
|
<table class="lineup-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="title-cell" colSpan=3>
|
<th class="title-cell" colSpan=3>
|
||||||
|
|||||||
Reference in New Issue
Block a user