1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-30 00:10:31 +02:00

Flextype Box Plugin: Admin #125 #117

- Snippets Controller/Views implementation
This commit is contained in:
Awilum
2019-05-29 01:00:41 +03:00
parent 9fd6f8c86e
commit 45c9834244
4 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
<form method="post" id="form">
{{ csrf() }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="id">{{ tr('admin_name') }}</label>
<input type="text" id="id" name="id" value="" class="form-control" required="required" data-validation="length required" data-validation-length="min1" data-validation-error-msg="{{ tr('admin_error_name_empty_input') }}">
</div>
<div class="form-group">
<input type="submit" id="createSnippet" name="create_snippet" value="{{ tr('admin_create') }}" class="btn btn-black">
</div>
</div>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,16 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
<form method="post" id="form">
{{ csrf() }}
<input type="hidden" name="action" value="save-form">
<input type="hidden" name="id" value="{{ id }}">
<div class="row">
<div class="col-12">
<div class="form-group">
<textarea id="codeMirrorEditor" style="min-height:500px;" name="data" rows="8" cols="80" class="form-control">{{ data }}</textarea>
</div>
</div>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,50 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
{% if snippets_list|length > 0 %}
<table class="table no-margin">
<thead>
<tr>
<th>{{ tr('admin_name') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% if snippets_list|length > 0 %}
{% for id in snippets_list %}
<tr>
<td>
<a href="{{ path_for('admin.snippets.edit') }}?id={{ id }}">{{ id }}</a>
</td>
<td class="text-right">
<div class="btn-group">
<a class="btn btn-default" href="{{ path_for('admin.snippets.edit') }}?id={{ id }}">{{ tr('admin_edit') }}</a>
<button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="{{ path_for('admin.snippets.rename') }}?id={{ id }}">{{ tr('admin_rename') }}</a>
<a class="dropdown-item" href="javascript:;"
onclick="event.preventDefault();
document.getElementById('duplicate-snippet-id-{{ id }}').submit();">{{ tr('admin_duplicate') }}</a>
</div>
</div>
<form id="duplicate-snippet-id-{{ id }}" action="{{ path_for('admin.snippets.duplicateProcess') }}" method="POST" style="display: none;">
{{ csrf() }}
<input type="hidden" name="snippet-id" value="{{ id }}">
</form>
<form id="delete-snippet-id-{{ id }}" action="{{ path_for('admin.snippets.deleteProcess') }}" method="POST" style="display: none;">
{{ csrf() }}
<input type="hidden" name="snippet-id" value="{{ id }}">
</form>
<a class="btn btn-default" href="javascript:;"
onclick="event.preventDefault();
document.getElementById('delete-snippet-id-{{ id }}').submit();">{{ tr('admin_delete') }}</a>
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,20 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
<form method="post" id="form">
{{ csrf() }}
<input type="hidden" name="id_current" value="{{ id_current }}">
<input type="hidden" name="type_current" value="{{ type_current }}">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="id">{{ tr('admin_name') }}</label>
<input type="text" id="id" name="id" value="{{ id_current }}" class="form-control" required="required" data-validation="length required" data-validation-length="min1" data-validation-error-msg="{{ tr('admin_error_name_empty_input') }}">
</div>
<div class="form-group">
<input type="submit" id="renameTemplate" name="rename_template" value="{{ tr('admin_save') }}" class="btn btn-black">
</div>
</div>
</div>
</form>
{% endblock %}