mirror of
https://github.com/flextype/flextype.git
synced 2025-08-12 16:14:16 +02:00
Admin Panel - Slim Integration - next round of integration
This commit is contained in:
@@ -119,5 +119,190 @@
|
||||
</div> <!-- .content -->
|
||||
|
||||
</div>
|
||||
|
||||
{% if registry.settings.locale == 'en_US' %}
|
||||
{% set locale = 'en' %}
|
||||
{% else %}
|
||||
{% set locale = registry.settings.locale %}
|
||||
{% endif %}
|
||||
|
||||
{% if registry.settings.locale != 'en_US' %}
|
||||
{% set admin_trumbowyg_build = base_url() ~ '/site/plugins/admin/assets/dist/langs/trumbowyg/langs/' ~ registry.settings.locale ~ '.min.js' %}
|
||||
{% do assets_add('js', admin_trumbowyg_build, 'admin', 10) %}
|
||||
{% endif %}
|
||||
|
||||
{% set admin_build = base_url() ~ '/site/plugins/admin/assets/dist/js/admin-build.min.js' %}
|
||||
|
||||
{% do assets_add('js', admin_build, 'admin', 1) %}
|
||||
|
||||
{% for assets_admin in assets_get('js', 'admin') %}
|
||||
{% for assets_by_priorities in assets_admin %}
|
||||
<script type="text/javascript" src="{{ assets_by_priorities.asset }}"></script>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
new ClipboardJS('.js-clipboard-btn');
|
||||
bsCustomFileInput.init();
|
||||
|
||||
Messenger.options = {
|
||||
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
|
||||
theme: 'flat'
|
||||
}
|
||||
|
||||
if (typeof $.flextype == 'undefined') $.flextype = {};
|
||||
|
||||
$.flextype.plugins = {
|
||||
|
||||
init: function() {
|
||||
this.changeStatusProcess();
|
||||
},
|
||||
|
||||
changeStatus: function(plugin, status, token) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
data: "plugin_change_status=1&plugin="+plugin+"&status="+status+"&csrf_name="+$('form input[name="csrf_name"]').val()+"&csrf_value="+$('form input[name="csrf_value"]').val(),
|
||||
url: $('form input[name="url"]').val()
|
||||
});
|
||||
},
|
||||
|
||||
changeStatusProcess: function() {
|
||||
$(".js-switch").click(function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$.flextype.plugins.changeStatus($(this).data("plugin"), "true", $(this).data("token"));
|
||||
} else {
|
||||
$.flextype.plugins.changeStatus($(this).data("plugin"), "false", $(this).data("token"));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$.trumbowyg.svgPath = '{{base_url()}}/site/plugins/admin/assets/dist/fonts/trumbowyg/icons.svg';
|
||||
|
||||
$('.js-html-editor').trumbowyg({
|
||||
btnsDef: {
|
||||
// Customizables dropdowns
|
||||
image: {
|
||||
dropdown: ['insertImage', 'noembed'],
|
||||
ico: 'insertImage'
|
||||
}
|
||||
},
|
||||
btns: [
|
||||
['undo', 'redo'], // Only supported in Blink browsers
|
||||
['formatting'],
|
||||
['strong', 'em', 'del'],
|
||||
['link'],
|
||||
['image'],
|
||||
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
|
||||
['unorderedList', 'orderedList'],
|
||||
['table'],
|
||||
['removeformat'],
|
||||
['fullscreen']
|
||||
],
|
||||
lang: '{{ locale }}',
|
||||
autogrow: false,
|
||||
removeformatPasted: true
|
||||
});
|
||||
|
||||
$.flextype.plugins.init();
|
||||
|
||||
$('.js-save-form-submit').click(function() {
|
||||
$("#form" ).submit();
|
||||
});
|
||||
|
||||
$('.navbar-toggler').click(function () {
|
||||
$('.sidebar').addClass('show-sidebar');
|
||||
$('.sidebar-off-canvas').addClass('show-sidebar-off-canvas');
|
||||
});
|
||||
|
||||
$('.sidebar-off-canvas').click(function () {
|
||||
$('.sidebar').removeClass('show-sidebar');
|
||||
$('.sidebar-off-canvas').removeClass('show-sidebar-off-canvas');
|
||||
});
|
||||
|
||||
$('.js-plugins-info').click(function () {
|
||||
$('#pluginInfoModal').modal();
|
||||
$('.js-plugin-name-placeholder').html($(this).attr('data-name'));
|
||||
$('.js-plugin-version-placeholder').html($(this).attr('data-version'));
|
||||
$('.js-plugin-description-placeholder').html($(this).attr('data-description'));
|
||||
$('.js-plugin-author-name-placeholder').html($(this).attr('data-author-name'));
|
||||
$('.js-plugin-author-email-placeholder').html($(this).attr('data-author-email'));
|
||||
$('.js-plugin-author-url-placeholder').html($(this).attr('data-author-url'));
|
||||
$('.js-plugin-homepage-placeholder').html($(this).attr('data-homepage'));
|
||||
$('.js-plugin-bugs-placeholder').html($(this).attr('data-bugs'));
|
||||
$('.js-plugin-license-placeholder').html($(this).attr('data-license'));
|
||||
});
|
||||
|
||||
$('.js-snippets-info').click(function () {
|
||||
$('#snippetsInfoModal').modal();
|
||||
$('.js-snippets-snippet-placeholder').html($(this).attr('data-name'));
|
||||
$('.js-snippets-php-placeholder').html($(this).attr('data-name'));
|
||||
});
|
||||
|
||||
$('.js-entries-image-preview').click(function () {
|
||||
$('#entriesImagePreview').modal();
|
||||
$('.js-entry-image-preview-placeholder').css('background-image', 'url(' + $(this).attr('data-image-url') + ')');
|
||||
$('.js-entry-image-url-placeholder').val($(this).attr('data-image-url'));
|
||||
$('.js-entry-image-delete-url-placeholder').attr('href', $(this).attr('data-image-delete-url'));
|
||||
});
|
||||
|
||||
$('.js-settings-entry-modal').click(function () {
|
||||
$('#settingsEntryModal').modal();
|
||||
});
|
||||
|
||||
$.validate({});
|
||||
|
||||
{% if params.fieldset or params.menu or params.snippet or params.source or params.template %}
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("codeMirrorEditor"), {
|
||||
lineNumbers: true,
|
||||
{% if params.fieldset or params.menu %}
|
||||
indentUnit: 2,
|
||||
tabSize: 2,
|
||||
{% else %}
|
||||
tabSize: 4,
|
||||
indentUnit: 4,
|
||||
{% endif %}
|
||||
{% if params.fieldset or params.menu %}
|
||||
mode: "yaml",
|
||||
{% else %}
|
||||
mode: "application/x-httpd-php",
|
||||
{% endif %}
|
||||
indentWithTabs: false,
|
||||
{% if registry.settings.admin_panel.theme == light %}
|
||||
theme: "elegant",
|
||||
{% elseif registry.settings.admin_panel.theme == dark %}
|
||||
theme: "monokai",
|
||||
{% endif %}
|
||||
styleActiveLine: true,
|
||||
});
|
||||
|
||||
editor.addKeyMap({
|
||||
"Tab": function (cm) {
|
||||
if (cm.somethingSelected()) {
|
||||
var sel = editor.getSelection("\n");
|
||||
// Indent only if there are multiple lines selected, or if the selection spans a full line
|
||||
if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) {
|
||||
cm.indentSelection("add");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cm.options.indentWithTabs)
|
||||
cm.execCommand("insertTab");
|
||||
else
|
||||
cm.execCommand("insertSoftTab");
|
||||
},
|
||||
"Shift-Tab": function (cm) {
|
||||
cm.indentSelection("subtract");
|
||||
}
|
||||
});
|
||||
{% endif %}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use Flextype\Component\Http\Http;
|
||||
use Flextype\Component\Form\Form;
|
||||
use Flextype\Component\Token\Token;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
Themes::view('admin/views/partials/head')
|
||||
->assign('main_panel_class', 'width-full')
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
|
||||
<div class="row">
|
||||
<div class="col-4 float-center">
|
||||
<h3 class="h3 auth-header text-center"><?php echo __('admin_login'); ?></h3>
|
||||
<div class="form-group">
|
||||
<label><?php echo __('admin_username'); ?></label>
|
||||
<input type="text" name="username" value="" class="form-control" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label><?php echo __('admin_password'); ?></label>
|
||||
<input type="password" name="password" value="" class="form-control" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" name="login" value="<?php echo __('admin_login'); ?>" class="btn btn-black btn-block">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
Themes::view('admin/views/partials/content-end')->display();
|
||||
Themes::view('admin/views/partials/footer')->display();
|
||||
?>
|
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Registry\Registry;
|
||||
use Flextype\Component\Http\Http;
|
||||
use Flextype\Component\Form\Form;
|
||||
use Flextype\Component\Token\Token;
|
||||
use function Flextype\Component\I18n\__;
|
||||
|
||||
Themes::view('admin/views/partials/head')
|
||||
->assign('main_panel_class', 'width-full')
|
||||
->display();
|
||||
Themes::view('admin/views/partials/content-start')->display();
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
|
||||
<div class="row">
|
||||
<div class="col-4 float-center">
|
||||
<h3 class="h3 auth-header text-center"><?php echo __('admin_create_new_user'); ?></h3>
|
||||
<div class="form-group">
|
||||
<label><?php echo __('admin_username'); ?></label>
|
||||
<input type="text" name="username" value="" class="form-control" placeholder="lowercase chars only, e.g. admin" pattern="^[a-z0-9_-]{3,16}$" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email"><?php echo __('admin_email'); ?></label>
|
||||
<input type="text" name="email" value="" class="form-control" placeholder="valid email address" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password"><?php echo __('admin_password'); ?></label>
|
||||
<input type="password" name="password" value="" class="form-control" placeholder="complex string at least 8 chars long" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" name="registration" value="<?php echo __('admin_create_user'); ?>" class="btn btn-black btn-block">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
Themes::view('admin/views/partials/content-end')->display();
|
||||
Themes::view('admin/views/partials/footer')->display();
|
||||
?>
|
@@ -0,0 +1,76 @@
|
||||
{% extends "plugins/admin/views/partials/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form>
|
||||
<input type="hidden" name="url" value="{{ base_url() }}/admin/plugins/change_status">
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
</form>
|
||||
|
||||
<table class="table no-margin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ tr('admin_name') }}</th>
|
||||
<th></th>
|
||||
<th width="90" class="text-right">{{ tr('admin_status') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key, plugin in plugins_list %}
|
||||
<tr>
|
||||
<td>{{ plugin.name }}</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:;" class="btn js-plugins-info" data-toggle="modal" data-target="#pluginInfoModal"
|
||||
data-name="{{ plugin.name }}"
|
||||
data-version="{{ plugin.version }}"
|
||||
data-description="{{ plugin.description }}"
|
||||
data-author-name="{{ plugin.author.name }}"
|
||||
data-author-email="{{ plugin.author.email }}"
|
||||
data-author-url="{{ plugin.author.url }}"
|
||||
data-homepage="{{ plugin.homepage }}"
|
||||
data-bugs="{{ plugin.bugs }}"
|
||||
data-license="{{ plugin.license }}"
|
||||
>{{ tr('admin_info') }}</a>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="form-group no-margin">
|
||||
<span class="switch switch-sm">
|
||||
<input id="switch-sm-{{ plugin.name }}" type="checkbox" class="switch js-switch" data-plugin="{{ key }}"
|
||||
{% if plugin.enabled %}checked{% endif %}
|
||||
{% if key == 'admin' or key == '' %}disabled{% endif %}>
|
||||
<label for="switch-sm-{{ plugin.name }}"></label>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="pluginInfoModal" tabindex="-1" role="dialog" aria-labelledby="pluginInfoModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="pluginInfoModalLabel">{{ tr('admin_info') }}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><b>{{ tr('admin_name') }}: </b><span class="js-plugin-name-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_version') }}: </b><span class="js-plugin-version-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_description') }}: </b><span class="js-plugin-description-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_author_name') }}: </b><span class="js-plugin-author-name-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_author_email') }}: </b><span class="js-plugin-author-email-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_author_url') }}: </b><span class="js-plugin-author-url-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_homepage') }}: </b><span class="js-plugin-homepage-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_bugs') }}: </b><span class="js-plugin-bugs-placeholder"></span></p>
|
||||
<p><b>{{ tr('admin_license') }}: </b><span class="js-plugin-license-placeholder"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
24
site/plugins/admin/views/templates/users/login.html
Normal file
24
site/plugins/admin/views/templates/users/login.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "plugins/admin/views/partials/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||
<div class="row">
|
||||
<div class="col-4 float-center">
|
||||
<h3 class="h3 auth-header text-center">{{ tr('admin_login') }}</h3>
|
||||
<div class="form-group">
|
||||
<label>{{ tr('admin_username') }}</label>
|
||||
<input type="text" name="username" value="" class="form-control" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{ tr('admin_password') }}</label>
|
||||
<input type="password" name="password" value="" class="form-control" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" name="login" value="{{ tr('admin_login') }}" class="btn btn-black btn-block">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user