mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-02-02 21:00:10 +01:00
implementation of the setting to enable secure deletion of pages (#1752)
This commit is contained in:
@@ -26,6 +26,7 @@ session:
|
||||
timeout: 1800
|
||||
warnings:
|
||||
delete_page: true
|
||||
secure_delete: false
|
||||
edit_mode: normal
|
||||
frontend_preview_target: inline
|
||||
show_github_msg: true
|
||||
|
||||
@@ -243,6 +243,18 @@ form:
|
||||
type: bool
|
||||
help: Ask the user confirmation when deleting a page
|
||||
|
||||
warnings.secure_delete:
|
||||
type: toggle
|
||||
label: Secure Delete
|
||||
highlight: 1
|
||||
default: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
help: Shows the user a field to enter the word DELETE and enable the confirm delete button.
|
||||
|
||||
hide_page_types:
|
||||
type: array
|
||||
label: Hide page types in Admin
|
||||
|
||||
@@ -43,10 +43,12 @@ PLUGIN_ADMIN:
|
||||
EXPERT: "Expert"
|
||||
EXPAND_ALL: "Expand All"
|
||||
COLLAPSE_ALL: "Collapse All"
|
||||
SECURE_DELETE_DESC: "Type DELETE and confirm"
|
||||
ERROR: "Error"
|
||||
CLOSE: "Close"
|
||||
CANCEL: "Cancel"
|
||||
CONTINUE: "Continue"
|
||||
CONFIRM: "Confirm"
|
||||
MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_TITLE: "Confirmation Required"
|
||||
MODAL_CHANGED_DETECTED_TITLE: "Changes Detected"
|
||||
MODAL_CHANGED_DETECTED_DESC: "You have unsaved changes. Are you sure you want to leave without saving?"
|
||||
|
||||
@@ -43,10 +43,12 @@ PLUGIN_ADMIN:
|
||||
EXPERT: "Esperto"
|
||||
EXPAND_ALL: "Expandir Tudo"
|
||||
COLLAPSE_ALL: "Recolher Tudo"
|
||||
SECURE_DELETE_DESC: "Digite DELETE e confirme"
|
||||
ERROR: "Erro"
|
||||
CLOSE: "Fechar"
|
||||
CANCEL: "Cancelar"
|
||||
CONTINUE: "Continuar"
|
||||
CONFIRM: "Confirmar"
|
||||
MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_TITLE: "Confirmação Requerida"
|
||||
MODAL_CHANGED_DETECTED_TITLE: "Alterações Detectadas"
|
||||
MODAL_CHANGED_DETECTED_DESC: "Você tem alterações não salvas. Tem certeza que deseja sair sem salvar?"
|
||||
|
||||
4
themes/grav/css-compiled/fonts.css
vendored
4
themes/grav/css-compiled/fonts.css
vendored
@@ -1,3 +1 @@
|
||||
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500|Inconsolata:400,700|&subset=latin-ext");body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input{font-family:"Roboto","Helvetica","Tahoma","Geneva","Arial",sans-serif}h1,h2,h3,h4,.form-tabs>label,.label{font-family:"Josefin Slab","Helvetica","Tahoma","Geneva","Arial",sans-serif}code,kbd,pre,samp,body .CodeMirror{font-family:"Inconsolata","Monaco","Consolas","Lucida Console",monospace !important}
|
||||
|
||||
/*# sourceMappingURL=fonts.css.map */
|
||||
@import"https://fonts.googleapis.com/css?family=Roboto:300,400,500|Inconsolata:400,700|&subset=latin-ext";body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input{font-family:"Roboto","Helvetica","Tahoma","Geneva","Arial",sans-serif}h1,h2,h3,h4,.form-tabs>label,.label{font-family:"Josefin Slab","Helvetica","Tahoma","Geneva","Arial",sans-serif}code,kbd,pre,samp,body .CodeMirror{font-family:"Inconsolata","Monaco","Consolas","Lucida Console",monospace !important}/*# sourceMappingURL=fonts.css.map */
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"fonts.css","sources":["fonts.scss","configuration/fonts/_support.scss"],"sourcesContent":["$fonts-header: 'Josefin Slab' !default;\n$fonts-default: 'Roboto' !default;\n$fonts-mono: 'Inconsolata' !default;\n\n$font-definitions: (\n Josefin+Slab: 400,\n Roboto: '300,400,500',\n Inconsolata: '400,700'\n);\n\n@import \"configuration/fonts/support\";\n","@function str-replace($string, $search, $replace: '') {\n $index: str-index($string, $search);\n\n @if $index {\n @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);\n }\n\n @return $string;\n}\n\n@function admin-font-faces($fonts) {\n $url: \"https://fonts.googleapis.com/css?family=\";\n $nb: 0;\n\n @each $fontname, $weights in $fonts {\n\n @if $fontname == $fonts-default or\n $fontname == $fonts-header or\n $fontname == $fonts-mono {\n\n $nb: $nb + 1;\n $nb-word: 0;\n\n $fontname: str-replace(\"#{$fontname}\", \" \", \"+\");\n\n $url: $url + $fontname;\n\n @if $weights != null {\n $url: $url + \":\" + $weights;\n }\n\n @if $nb < 3 {\n $url: $url + \"|\";\n }\n }\n }\n\n @return $url + \"&subset=latin-ext\";\n}\n\n@mixin body-fonts($font) {\n body, h5, h6,\n .badge, .note, .grav-mdeditor-preview,\n input, select, textarea, button, .selectize-input {\n font-family: \"#{$font}\", \"Helvetica\", \"Tahoma\", \"Geneva\", \"Arial\", sans-serif;\n }\n}\n\n@mixin header-fonts($font) {\n h1, h2, h3, h4,\n .form-tabs > label, .label {\n font-family: \"#{$font}\", \"Helvetica\", \"Tahoma\", \"Geneva\", \"Arial\", sans-serif;\n }\n}\n\n@mixin mono-fonts($font) {\n code, kbd, pre, samp,\n body .CodeMirror {\n font-family: \"#{$font}\", \"Monaco\", \"Consolas\", \"Lucida Console\", monospace !important;\n }\n}\n$font-url: admin-font-faces($font-definitions);\n\n@import url(\"#{$font-url}\");\n\n@include body-fonts($fonts-default);\n\n@include header-fonts($fonts-header);\n\n@include mono-fonts($fonts-mono);\n\n\n\n\n\n"],"names":[],"mappings":"AC+DA,OAAO,CAAC,uGAAI,CAtBR,AAAA,IAAI,CAAE,EAAE,CAAE,EAAE,CACZ,MAAM,CAAE,KAAK,CAAE,sBAAsB,CACrC,KAAK,CAAE,MAAM,CAAE,QAAQ,CAAE,MAAM,CAAE,gBAAgB,AAAC,CAC9C,WAAW,CAAE,QAAU,CAAE,WAAW,CAAE,QAAQ,CAAE,QAAQ,CAAE,OAAO,CAAE,UAAU,CAChF,AAID,AAAA,EAAE,CAAE,EAAE,CAAE,EAAE,CAAE,EAAE,CACd,UAAU,CAAG,KAAK,CAAE,MAAM,AAAC,CACvB,WAAW,CAAE,cAAU,CAAE,WAAW,CAAE,QAAQ,CAAE,QAAQ,CAAE,OAAO,CAAE,UAAU,CAChF,AAID,AAAA,IAAI,CAAE,GAAG,CAAE,GAAG,CAAE,IAAI,CACpB,IAAI,CAAC,WAAW,AAAC,CACb,WAAW,CAAE,aAAU,CAAE,QAAQ,CAAE,UAAU,CAAE,gBAAgB,CAAE,SAAS,CAAC,UAAU,CACxF"}
|
||||
{"version":3,"sourceRoot":"","sources":["../scss/configuration/fonts/_support.scss"],"names":[],"mappings":"AA+DQ,0GAtBJ,6FAGI,sEAKJ,oCAEI,4EAKJ,mCAEI","file":"fonts.css"}
|
||||
4
themes/grav/css-compiled/nucleus.css
vendored
4
themes/grav/css-compiled/nucleus.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
themes/grav/css-compiled/preset.css
vendored
4
themes/grav/css-compiled/preset.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
themes/grav/css-compiled/simple-fonts.css
vendored
4
themes/grav/css-compiled/simple-fonts.css
vendored
@@ -1,3 +1 @@
|
||||
body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input,h1,h2,h3,h4,#admin-menu li,.form-tabs>label,.label,body .CodeMirror pre{font-family:"Helvetica Neue", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif}code,kbd,pre,samp,.mono{font-family:"Monaco", "Consolas", "Lucida Console", monospace}
|
||||
|
||||
/*# sourceMappingURL=simple-fonts.css.map */
|
||||
body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input,h1,h2,h3,h4,#admin-menu li,.form-tabs>label,.label,body .CodeMirror pre{font-family:"Helvetica Neue","Helvetica","Tahoma","Geneva","Arial",sans-serif}code,kbd,pre,samp,.mono{font-family:"Monaco","Consolas","Lucida Console",monospace}/*# sourceMappingURL=simple-fonts.css.map */
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"simple-fonts.css","sources":["simple-fonts.scss"],"sourcesContent":["body, h5, h6,\n.badge, .note, .grav-mdeditor-preview,\ninput, select, textarea, button, .selectize-input,\nh1, h2, h3, h4,\n#admin-menu li, .form-tabs > label, .label,\nbody .CodeMirror pre {\n font-family: \"Helvetica Neue\", \"Helvetica\", \"Tahoma\", \"Geneva\", \"Arial\", sans-serif;\n}\ncode, kbd, pre, samp, .mono {\n font-family: \"Monaco\", \"Consolas\", \"Lucida Console\", monospace;\n}\n"],"names":[],"mappings":"AAAA,AAAA,IAAI,CAAE,EAAE,CAAE,EAAE,CACZ,MAAM,CAAE,KAAK,CAAE,sBAAsB,CACrC,KAAK,CAAE,MAAM,CAAE,QAAQ,CAAE,MAAM,CAAE,gBAAgB,CACjD,EAAE,CAAE,EAAE,CAAE,EAAE,CAAE,EAAE,CACd,WAAW,CAAC,EAAE,CAAE,UAAU,CAAG,KAAK,CAAE,MAAM,CAC1C,IAAI,CAAC,WAAW,CAAC,GAAG,AAAC,CACjB,WAAW,CAAE,sEAAsE,CACtF,AACD,AAAA,IAAI,CAAE,GAAG,CAAE,GAAG,CAAE,IAAI,CAAE,KAAK,AAAE,CACzB,WAAW,CAAE,iDAAiD,CACjE"}
|
||||
{"version":3,"sourceRoot":"","sources":["../scss/simple-fonts.scss"],"names":[],"mappings":"AAAA,qKAMI,8EAEJ,wBACI","file":"simple-fonts.css"}
|
||||
6
themes/grav/css-compiled/template.css
vendored
6
themes/grav/css-compiled/template.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -24,7 +24,10 @@
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
|
||||
&:disabled {
|
||||
opacity: .6;
|
||||
cursor: no-drop;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
|
||||
{% set modular = context.modular ? 'modular_' : '' %}
|
||||
{% set warn = config.plugins.admin.warnings.delete_page %}
|
||||
{% set secure_delete = config.plugins.admin.warnings.secure_delete %}
|
||||
{% set admin_lang = admin.session.admin_lang ?: 'en' %}
|
||||
{% set page_lang = context.language %}
|
||||
{% set type = 'page' %}
|
||||
@@ -405,10 +406,19 @@
|
||||
<p class="bigger">
|
||||
{{ "PLUGIN_ADMIN.MODAL_DELETE_PAGE_CONFIRMATION_REQUIRED_DESC"|tu }}
|
||||
</p>
|
||||
{% if secure_delete %}
|
||||
<p class="form-secure-delete">
|
||||
<input id="secure-delete-field" autofocus type="text" placeholder="{{ "PLUGIN_ADMIN.SECURE_DELETE_DESC"|tu }}" />
|
||||
</p>
|
||||
{% endif %}
|
||||
<br>
|
||||
<div class="button-bar">
|
||||
<button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
|
||||
<a class="button disable-after-click" data-delete-action href="#"><i class="fa fa-fw fa-check"></i> {{ "PLUGIN_ADMIN.CONTINUE"|tu }}</a>
|
||||
{% if secure_delete %}
|
||||
<button id="secure-delete-btn" disabled="true" class="button danger disable-after-click" data-delete-action><i class="fa fa-fw fa-check"></i> {{ "PLUGIN_ADMIN.CONFIRM"|tu }}</button>
|
||||
{% else %}
|
||||
<a class="button danger disable-after-click" data-delete-action href="#"><i class="fa fa-fw fa-check"></i> {{ "PLUGIN_ADMIN.CONTINUE"|tu }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -421,5 +431,18 @@
|
||||
{{ parent() }}
|
||||
<script>
|
||||
$('.admin-pages .form-tabs .tabs-nav').css('margin-right', ($('#admin-topbar').width() + 20) + 'px');
|
||||
{% if secure_delete %}
|
||||
$('#secure-delete-field').keyup(function () {
|
||||
var inputValue = $(this).val();
|
||||
if (inputValue == 'DELETE') {
|
||||
$('#secure-delete-btn').attr('disabled', false);
|
||||
}else{
|
||||
$('#secure-delete-btn').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
$(document).on('closing', '.remodal', function () {
|
||||
$('#secure-delete-field').val('');
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user