notify-events: use send button, split css and js

This commit is contained in:
Milan
2022-01-29 13:43:11 +01:00
parent 45290f9daf
commit f6d3139f03
5 changed files with 63 additions and 60 deletions

View File

@@ -0,0 +1,36 @@
.mailHeader{
background:#ccc;
}
.mailSubject{
}
.mailBody{
white-space:pre;
}
.done{
background:#cfc;
}
table#events td:nth-of-type(1){
width:15em;
}
table#events td:nth-of-type(2){
width:60em;
}
td.action, input.action{
width:5em;
}
form input{
width:50em;
}
form textarea{
width:50em;
height:14em;
}

View File

@@ -0,0 +1,18 @@
function register_buttons() {
$("#forms form").on('click', 'button', function( event ) {
event.preventDefault();
var form = $(this).closest('form');
$.post("notify-events.cgi", form.serialize())
.done( function(data) {
var content = $(data).find("#content");
$('#result').html(content);
var formId = form.attr('id');
$('#'+formId+" .mailHeader").addClass("done");
});
});
}
$(document).ready(function() {
register_buttons();
});

View File

@@ -0,0 +1,3 @@
msgid "button_send"
msgstr "Senden"

View File

@@ -0,0 +1,3 @@
msgid "button_send"
msgstr "Send"

View File

@@ -4,45 +4,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><TMPL_VAR .doc.title></title>
<script src="js/page-leave-handler.js" type="text/javascript"></script>
<style>
.mailHeader{
background:#ccc;
}
.mailSubject{
}
.mailBody{
white-space:pre;
}
.done{
background:#cfc;
}
table#events td:nth-of-type(1){
width:15em;
}
table#events td:nth-of-type(2){
width:60em;
}
td.action, input.action{
width:5em;
}
form input{
width:50em;
}
form textarea{
width:50em;
height:14em;
}
</style>
<script src="js/notify-events.js" type="text/javascript"></script>
<link type="text/css" href="css/notify-events.css" rel="stylesheet"/>
<script>
var region='<TMPL_VAR loc.region escape=js>';
var event_id='<TMPL_VAR event_id escape=js>';
@@ -55,26 +18,6 @@
}
);
</TMPL_IF>
$(document).ready(
function(){
$("#forms form").submit(
function( event ) {
event.preventDefault();
var $form = $( this );
var posting = $.post("notify-events.cgi", $form.serialize());
posting.done(
function( data ) {
var content = $( data ).find( "#content" );
$('#result').html(content);
var formId=$form.attr('id');
$('#'+formId+" .mailHeader").addClass("done");
}
);
}
);
}
);
</script>
</head>
@@ -106,7 +49,7 @@
<TMPL_ELSE>
<td class="action"><input class="button" type="submit" name="action" value="send"></td>
<td class="action"><button type="submit"><TMPL_VAR .loc.button_send></button></td>
</tr>
<TMPL_IF mail.Subject>