From 9b0db537990b803f4641b77b9d448b40f325f2a5 Mon Sep 17 00:00:00 2001 From: Taka Date: Sun, 3 Nov 2019 09:52:06 +0000 Subject: [PATCH] Added extra information to the COUNT-REMAINING extras template. --- .../extras/count-remaining.j2 | 20 +++++++++++++++++++ .../webapp/static/css/tabs-extras.css | 6 ++++++ vasl_templates/webapp/static/extras.js | 11 +++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/vasl_templates/webapp/data/default-template-pack/extras/count-remaining.j2 b/vasl_templates/webapp/data/default-template-pack/extras/count-remaining.j2 index 8e83fb7..ded8237 100644 --- a/vasl_templates/webapp/data/default-template-pack/extras/count-remaining.j2 +++ b/vasl_templates/webapp/data/default-template-pack/extras/count-remaining.j2 @@ -3,6 +3,26 @@ + diff --git a/vasl_templates/webapp/static/css/tabs-extras.css b/vasl_templates/webapp/static/css/tabs-extras.css index 02322c1..4e6eb16 100644 --- a/vasl_templates/webapp/static/css/tabs-extras.css +++ b/vasl_templates/webapp/static/css/tabs-extras.css @@ -20,3 +20,9 @@ #tabs-extras .right-panel table { margin-top: 1em ; } #tabs-extras .right-panel td.caption { font-weight: bold ; padding-right: 0.25em ; } #tabs-extras .right-panel .snippet-control { margin-top: 0.5em ; } + +#tabs-extras .right-panel .footer { margin-top: 1em ; font-size: 80% ; font-style: italic ; color: #444 ; } +#tabs-extras .right-panel .footer table { margin: 0 ; } +#tabs-extras .right-panel .footer td { vertical-align: top ; } +#tabs-extras .right-panel .footer td.key, td.val { padding: 0.2em 0.5em; border: 1px dotted #ccc ; } +#tabs-extras .right-panel .footer td.key { background: #f8f8f8 ; font-weight: bold ; } diff --git a/vasl_templates/webapp/static/extras.js b/vasl_templates/webapp/static/extras.js index 4fffe18..c73d796 100644 --- a/vasl_templates/webapp/static/extras.js +++ b/vasl_templates/webapp/static/extras.js @@ -107,6 +107,9 @@ function _show_extra_template( template_id ) buf.push( "" ) ; } buf.push( "" ) ; + if ( template_info.footer ) { + buf.push( "" ) ; + } buf.push( "" ) ; var $form = $( buf.join("") ) ; $form.find( "select" ).select2( { @@ -130,13 +133,15 @@ function _parse_extra_template( template_id, template ) // extract the main details var result = { template_id: template_id, name: template_id } ; function extract_val( key ) { - var match = template.match( new RegExp( "" ) ) ; + var ch = (key === "footer") ? "[^]" : "." ; // FUDGE! Allow multi-line values for "footer" :-/ + var match = template.match( new RegExp( "" ) ) ; if ( match ) - result[key] = match[1] ; + result[key] = match[1].trim() ; } extract_val( "name" ) ; extract_val( "caption" ) ; extract_val( "description" ) ; + extract_val( "footer" ) ; // extract the template parameters result.params = [] ; @@ -203,7 +208,7 @@ function fixup_template_parameters( template ) } // remove all our special comments, except for the snippet ID - regex = /\n*/g ; + regex = /\n*/g ; // nb: we use "[^]" to match newline as well matches = [] ; while( (match = regex.exec( template )) !== null ) { if ( match[1] !== "id" )