FEATURE: add copying of templates
This commit is contained in:
@@ -15,5 +15,7 @@ return [
|
||||
'notWritable' => 'Cannot write to :file. Any submited changes in this file will <strong>not</strong> be saved!',
|
||||
'cannotWriteContent' => 'Cannot save template content, directory has unsufficient permissions. Meta information were saved.',
|
||||
'newTemplateName' => 'Template name used in Blade templates',
|
||||
'newTemplateNameSuffix' => 'copy'
|
||||
];
|
||||
'newTemplateNameSuffix' => 'copy',
|
||||
'copySuccessfull' => 'Template :name successfully created by copying from other template.',
|
||||
'copyFailed' => 'Cannot copy template into :name. Check write permissions to proper template path.'
|
||||
];
|
||||
|
||||
@@ -40,12 +40,20 @@
|
||||
var templateId = link.data ('template-id');
|
||||
var templateName = link.data ('template-name');
|
||||
|
||||
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_"+"@lang('admin/templates.newTemplateNameSuffix')");
|
||||
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')");
|
||||
|
||||
// no name given - give up
|
||||
if (newTemplateName == null) return;
|
||||
|
||||
$.ajax({
|
||||
'url': '{{route('templates.copy')}}}'
|
||||
// copy given template
|
||||
$.post ('{{route('templates.postCopy')}}', {
|
||||
templateId: templateId,
|
||||
newName: newTemplateName,
|
||||
_token: "{{csrf_token()}}"
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
location.reload ();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user