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

feat(admin-plugin): update templates for api delivery #211

This commit is contained in:
Awilum
2020-02-02 13:24:34 +03:00
parent 5276952488
commit d86289c5a4
3 changed files with 27 additions and 8 deletions

View File

@@ -33,7 +33,7 @@
</div>
<div class="form-group">
<label for="type" class="form-control-title">{{ tr('admin_state') }}</label>
<select class="js-example-basic-single form-control" name="state">
<select class="js-select form-control" name="state">
<option value="enabled" selected="selected">{{ tr('admin_enabled') }}</option>
<option value="disabled">{{ tr('admin_disabled') }}</option>
</select>

View File

@@ -14,7 +14,7 @@
<div class="form-group">
<label for="title" class="form-control-title">{{ tr('admin_title') }}</label>
<input type="text" id="title" name="title" value="{{ api_token_data.title }}" class="form-control" required="required" data-parsley-minlength="1" data-parsley-error-message="{{ tr('admin_error_title_empty_input') }}" data-parsley-required="true">
<small class="opacity-50 block mt-1">{{ tr('admin_help_text_for_tokens_label') }}</small>
<small>{{ tr('admin_help_text_for_tokens_label') }}</small>
</div>
<div class="form-group">
<label for="title" class="form-control-title">{{ tr('admin_api_calls_limit') }}</label>
@@ -29,16 +29,16 @@
data-parsley-minlength="1"
data-parsley-type="integer"
data-parsley-error-message="{{ tr('admin_error_api_calls_empty_input') }}">
<small class="opacity-50 block mt-1">{{ tr('admin_help_text_for_api_calls_limit_label') }}</small>
<small>{{ tr('admin_help_text_for_api_calls_limit_label') }}</small>
</div>
<div class="form-group">
<label for="icon" class="form-control-title">{{ tr('admin_icon') }}</label>
<input type="text" id="fieldsetIcon" name="icon" value="{{ api_token_data.icon }}" class="form-control" required="required" data-parsley-required="true" data-parsley-minlength="1" data-parsley-error-message="{{ tr('admin_error_icon_empty_input') }}">
<small class="opacity-50 block mt-1">{{ tr('admin_help_text_for_api_token_icon', {':link': '<a href="https://fontawesome.com/icons?d=gallery&m=free" target="_blank">fontawesome</a>'})|raw }}</small>
<small>{{ tr('admin_help_text_for_api_token_icon', {':link': '<a href="https://fontawesome.com/icons?d=gallery&m=free" target="_blank">fontawesome</a>'})|raw }}</small>
</div>
<div class="form-group">
<label for="type" class="form-control-title">{{ tr('admin_state') }}</label>
<select class="form-control" name="state">
<select class="form-control js-select" name="state">
<option value="enabled" {% if api_token_data.state == 'enabled' %} selected="selected" {% endif %}>{{ tr('admin_enabled') }}</option>
<option value="disabled" {% if api_token_data.state == 'disabled' %} selected="selected" {% endif %} ">{{ tr('admin_disabled') }}</option>
</select>
@@ -49,4 +49,4 @@
</div>
</div>
</form>
{% endblock %}
{% endblock %}

View File

@@ -46,8 +46,7 @@
{{ tr('admin_edit') }}
</a>
<div class="dropdown__divider"></div>
<a class="dropdown__item" href="javascript:;" onclick="event.preventDefault();
document.getElementById('delete-api-token-id-{{ token.dirname }}').submit();">
<a class="dropdown__item" href="javascript:;" onclick="event.preventDefault(); deleteDeliveryToken('{{ token.dirname }}', {{ loop.index0 }});">
<i class="icon icon--white mr-3">{{ icon('fas fa-trash-alt') }}</i>
{{ tr('admin_delete') }}
</a>
@@ -71,4 +70,24 @@
</div>
</div>
{% endif %}
{% endblock %}
{% block tail_js %}
<script>
function deleteDeliveryToken(id, row_num) {
dropdown[row_num].hide();
swal({
title: "{{ tr('admin_cofirmation_required') }}",
text: "{{ tr('admin_cofirmation_required_for_delivery_token') }}",
buttons: [
"{{ tr('admin_cancel') }}", "{{ tr('admin_yes_iam_sure')|raw }}"
],
closeModal: true
}).then((willDelete) => {
if (willDelete) {
document.getElementById('delete-api-token-id-' + id).submit();
}
});
}
</script>
{% endblock %}