It allows defining report templates and then create reports based on the templates. A template defines: - parameters - to be set in the report (currently only selection of campaigns, in the future to be extended to selection of lists/segments, and selection from pre-defined options) - data retrieval / processing code (in Javascript) - rendering template (in Handlebars) This main functionality is accompanied by a few minor tweaks here and there. Worth notice is the ability to use server-side ajax table s for multi-selection of campaigns. This is meant for reports that compare data across multiple campaigns. This could possibly be even used for some poor man's A/B testing. Note that the execution of custom JavaScript in the data retrieval / processing code and definition of custom Handlebars templates is a security issue. This should however be OK in the general case once proper user management with granular permissions is in. This is because definition of a report template is anyway such an expert task that it would normally be performed only by admin. Instantiation of reports based on report templates can be then done by any user because this should no longer be any security problem.
59 lines
2.9 KiB
Handlebars
59 lines
2.9 KiB
Handlebars
<div class="form-group">
|
|
<label for="name" class="col-sm-2 control-label">{{#translate}}Name{{/translate}}</label>
|
|
<div class="col-sm-10">
|
|
<input type="text" class="form-control input-lg" name="name" id="name" value="{{name}}" placeholder="{{#translate}}Template Name{{/translate}}" autofocus required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="description" class="col-sm-2 control-label">{{#translate}}Description{{/translate}}</label>
|
|
<div class="col-sm-10">
|
|
<textarea class="form-control" rows="3" name="description" id="description">{{description}}</textarea>
|
|
<span class="help-block">{{#translate}}HTML is allowed{{/translate}}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="mimeType" class="col-sm-2 control-label">{{#translate}}Type{{/translate}}</label>
|
|
<div class="col-sm-10">
|
|
<select name="mimeType" class="form-control">
|
|
{{#each mimeTypes}}
|
|
<option value="{{key}}" {{#if selected}} selected {{/if}}>{{value}}</option>
|
|
{{/each}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">{{#translate}}User selectable fields{{/translate}}</label>
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<div class="help-block" style="margin-top: -8px;">
|
|
<small>JSON specification of user selectable fields.</small>
|
|
</div>
|
|
<div class="code-editor-json" style="height: 250px; border: 1px solid #ccc;"></div>
|
|
<input type="hidden" name="userFields" value="{{userFields}}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">{{#translate}}Data processing code{{/translate}}</label>
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<div class="help-block" style="margin-top: -8px;">
|
|
<small>Write the body of the JavaScript function with signature <code>function(inputs, callback)</code> that returns an object to be rendered by the Handlebars template below.</small>
|
|
</div>
|
|
<div class="code-editor-javascript" style="height: 700px; border: 1px solid #ccc;"></div>
|
|
<input type="hidden" name="js" value="{{js}}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label">{{#translate}}Rendering template{{/translate}}</label>
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<div class="help-block" style="margin-top: -8px;">
|
|
<small>Use HTML with Handlebars syntax. See documentation <a href="http://handlebarsjs.com/">here</a>.</small>
|
|
</div>
|
|
<div class="code-editor-handlebars" style="height: 700px; border: 1px solid #ccc;"></div>
|
|
<input type="hidden" name="hbs" value="{{hbs}}">
|
|
</div>
|
|
</div>
|
|
|