2016-04-04 12:36:30 +00:00
<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">
2017-03-02 17:52:40 +00:00
<label for="editor_name" class="col-sm-2 control-label">HTML Editor</label>
2016-04-04 12:36:30 +00:00
<div class="col-sm-10">
2017-03-02 17:52:40 +00:00
<select class="form-control" id="editor_name" name="editor_name">
<option value=""> – – Select – – </option>
{{ # each editors }}
<option value=" {{ name }} "> {{ label }} </option>
{{ / each }}
</select>
2016-04-04 12:36:30 +00:00
</div>
</div>
2017-03-02 17:52:40 +00:00
<div id="editor-template">
<div>
<input type="hidden" name="text" value=" {{ text }} ">
<input type="hidden" name="html" value=" {{ html }} ">
2016-04-04 12:36:30 +00:00
</div>
</div>
<div class="form-group">
<label for="template-description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
2016-04-12 04:35:04 +00:00
<textarea class="form-control" id="template-description" name="description" rows="3" placeholder="Optional comments about this template"> {{ description }} </textarea>
2016-04-04 12:36:30 +00:00
<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>
2017-03-02 17:52:40 +00:00
<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>