summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--website/templates/canned_responses.html100
1 files changed, 79 insertions, 21 deletions
diff --git a/website/templates/canned_responses.html b/website/templates/canned_responses.html
index d5d206d..ad08ae0 100644
--- a/website/templates/canned_responses.html
+++ b/website/templates/canned_responses.html
@@ -2,50 +2,108 @@
<head>
<style>
blockquote {
- margin: 1em;
- padding: 1ex;
- background-color: #EEE;
+ margin: 1em;
+ padding: 1ex;
+ background-color: #EEE;
}
ul#list {
- list-style-type: none;
- padding: 0;
- margin: 0;
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
}
ul#list li {
}
+
+ td.evaltext {
+ }
+
+ td.evalform {
+ vertical-align: top;
+ }
+
+ textarea#reply {
+ }
</style>
<script src="jquery-2.2.3.min.js"></script>
<script src="canned_responses.js"></script>
</head>
<body>
- <form id="evalform">
- Submitter's name:
- <input type="text" name="submitter_name" id="submitter_name"><br/>
+ <table class="eval">
+ <tr>
+ <td class="evalform">
+ <form id="evalform">
+ Submitter's name:
+ <input type="text" name="submitter_name" id="submitter_name"
+ onchange="javascript:update_text(this);"><br/>
+
+ Project Name:
+ <input type="text" name="projname" id="projname"
+ onchange="javascript:update_text(this);"><br/>
- Project Name:
- <input type="text" name="projname" id="projname"><br/>
+ Savannah Request Number:
+ <input type="text" name="regnum" id="regnum"
+ onchange="javascript:update_text(this);"><br/>
- Savannah Request Number:
- <input type="text" name="regnum" id="regnum"><br/>
+ <br/>
+ <ul id="list">
+ </ul>
+ </form>
+ </td>
- <br/>
- <ul id="list">
- </ul>
- </form>
+ <td class="evaltext">
+ Suggested Reply:
+ <br/>
+ <textarea name="reply" id="reply" cols="50" rows="50"></textarea>
+ </td>
+
+ </tr>
+ </table>
<script>
+ function update_text()
+ {
+ var user_name = $("#submitter_name").val().trim();
+ var project_name = $("#projname").val().trim();
+ var reg_num = $("#regnum").val().trim();
+
+ var s = "" ;
+ if (user_name) {
+ s = "Hello " + user_name + ",\n\n";
+ } else {
+ s = "Hello,\n\n" ;
+ }
+
+ var regurl = (reg_num)?("http://savannah.gnu.org/task/?"+reg_num):"(missing URL)";
+
+
+ gnu_sv_eval_canned_responses.forEach(function(x){
+ var id = "#cb_" + x.id ;
+ var checked = $(id).is(':checked');
+ if (checked) {
+ s = s + x.long + "\n" ;
+ }
+ });
+
+ s = s.replace("%projname%",project_name);
+ s = s.replace("%regurl%",regurl);
+
+ $("#reply").val(s);
+ }
+
$(document).ready(function(){
var ol = $("#list");
gnu_sv_eval_canned_responses.forEach(function(x){
- var html = "<li><label>" +
- '<input type="checkbox" name="cb_' + x.id + '" id="cb_' + x.id + '">' +
- x.short +
- '</label></li>';
+ var html = "<li><label>" +
+ '<input type="checkbox" name="cb_' + x.id +
+ '" id="cb_' + x.id +
+ '" onchange="javascript:update_text(this);">' +
+ x.short +
+ '</label></li>';
ol.append(html);
});