92 lines
3.2 KiB
Handlebars
92 lines
3.2 KiB
Handlebars
<ol class="breadcrumb">
|
||
<li><a href="/">Home</a></li>
|
||
<li><a href="/templates/">Templates</a></li>
|
||
<li class="active">Create Template</li>
|
||
</ol>
|
||
|
||
<h2>Create Template</h2>
|
||
|
||
<hr>
|
||
|
||
<form class="form-horizontal" method="post" action="/templates/create">
|
||
<input type="hidden" name="_csrf" value="{{csrfToken}}">
|
||
|
||
<div class="form-group">
|
||
<label for="template-name" class="col-sm-2 control-label">Template name</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control input-lg" name="name" id="template-name" value="{{name}}" placeholder="Name for this template, eg. Newsletter">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="editor_name" class="col-sm-2 control-label">HTML Editor</label>
|
||
<div class="col-sm-10">
|
||
<select class="form-control" id="editor_name" name="editor_name">
|
||
<option value=""> –– Select –– </option>
|
||
{{#each editors}}
|
||
<option value="{{name}}">{{label}}</option>
|
||
{{/each}}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="editor-template">
|
||
<div>
|
||
<input type="hidden" name="text" value="{{text}}">
|
||
<input type="hidden" name="html" value="{{html}}">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="template-description" class="col-sm-2 control-label">Description</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" id="template-description" name="description" rows="3" placeholder="Optional comments about this template">{{description}}</textarea>
|
||
<span class="help-block">HTML is allowed</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<div class="col-sm-offset-2 col-sm-10">
|
||
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Create Template</button>
|
||
</div>
|
||
</div>
|
||
|
||
</form>
|
||
|
||
<div style="display: none">
|
||
{{#each editors}}
|
||
{{#if templates}}
|
||
<div class="form-group" id="{{name}}-template">
|
||
<label for="editor_data_{{name}}" class="col-sm-2 control-label">{{label}} Template</label>
|
||
<div class="col-sm-10">
|
||
<select class="form-control" id="editor_data_{{name}}" name="editor_data">
|
||
{{#each templates}}
|
||
<option value='{"template":"{{name}}"}'>{{label}}</option>
|
||
{{/each}}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
{{/if}}
|
||
{{/each}}
|
||
|
||
<div id="summernote-template">
|
||
<input type="hidden" name="text" value="{{text}}">
|
||
<input type="hidden" name="html" value="{{html}}">
|
||
</div>
|
||
|
||
<div id="codeeditor-template">
|
||
<input type="hidden" name="text" value="{{text}}">
|
||
<input type="hidden" name="html" value="{{html}}">
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
$('select#editor_name').on('change', function() {
|
||
var editor = this.value || 'summernote';
|
||
$('#editor-template').children().first().replaceWith(
|
||
$('#' + editor + '-template').clone()
|
||
);
|
||
});
|
||
});
|
||
</script>
|