freescout/freescout-dist/resources/views/vendor/translation-manager/index.blade.php

135 lines
12 KiB
PHP
Raw Normal View History

2023-12-22 19:40:32 +00:00
@extends('layouts.app')
@section('title', __('Translate'))
@section('content')
@php
include(base_path().DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'translation-manager'.DIRECTORY_SEPARATOR.'content.php');
@endphp
@endsection
@section('stylesheets')
{!! Minify::stylesheet(\Eventy::filter('stylesheets', array('/js/bootstrap3-editable/css/bootstrap-editable.css'))) !!}
@endsection
@section('javascripts')
{!! Minify::javascript(\Eventy::filter('javascripts', array('/js/bootstrap3-editable/js/bootstrap-editable.min.js'))) !!}
@endsection
@section('javascript')
@parent
//https://github.com/rails/jquery-ujs/blob/master/src/rails.js
(function(e,t){if(e.rails!==t){e.error("jquery-ujs has already been loaded!")}var n;var r=e(document);e.rails=n={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",buttonClickSelector:"button[data-remote], button[data-confirm]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]",linkDisableSelector:"a[data-disable-with]",buttonDisableSelector:"button[data-remote][data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");if(n)t.setRequestHeader("X-CSRF-Token",n)},refreshCSRFTokens:function(){var t=e("meta[name=csrf-token]").attr("content");var n=e("meta[name=csrf-param]").attr("content");e('form input[name="'+n+'"]').val(t)},fire:function(t,n,r){var i=e.Event(n);t.trigger(i,r);return i.result!==false},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(r){var i,s,o,u,a,f,l,c;if(n.fire(r,"ajax:before")){u=r.data("cross-domain");a=u===t?null:u;f=r.data("with-credentials")||null;l=r.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType;if(r.is("form")){i=r.attr("method");s=r.attr("action");o=r.serializeArray();var h=r.data("ujs:submit-button");if(h){o.push(h);r.data("ujs:submit-button",null)}}else if(r.is(n.inputChangeSelector)){i=r.data("method");s=r.data("url");o=r.serialize();if(r.data("params"))o=o+"&"+r.data("params")}else if(r.is(n.buttonClickSelector)){i=r.data("method")||"get";s=r.data("url");o=r.serialize();if(r.data("params"))o=o+"&"+r.data("params")}else{i=r.data("method");s=n.href(r);o=r.data("params")||null}c={type:i||"GET",data:o,dataType:l,beforeSend:function(e,i){if(i.dataType===t){e.setRequestHeader("accept","*/*;q=0.5, "+i.accepts.script)}if(n.fire(r,"ajax:beforeSend",[e,i])){r.trigger("ajax:send",e)}else{return false}},success:function(e,t,n){r.trigger("ajax:success",[e,t,n])},complete:function(e,t){r.trigger("ajax:complete",[e,t])},error:function(e,t,n){r.trigger("ajax:error",[e,t,n])},crossDomain:a};if(f){c.xhrFields={withCredentials:f}}if(s){c.url=s}return n.ajax(c)}else{return false}},handleMethod:function(r){var i=n.href(r),s=r.data("method"),o=r.attr("target"),u=e("meta[name=csrf-token]").attr("content"),a=e("meta[name=csrf-param]").attr("content"),f=e('<form method="post" action="'+i+'"></form>'),l='<input name="_method" value="'+s+'" type="hidden" />';if(a!==t&&u!==t){l+='<input name="'+a+'" value="'+u+'" type="hidden" />'}if(o){f.attr("target",o)}f.hide().append(l).appendTo("body");f.submit()},formElements:function(t,n){return t.is("form")?e(t[0].elements).filter(n):t.find(n)},disableFormElements:function(t){n.formElements(t,n.disableSelector).each(function(){n.disableFormElement(e(this))})},disableFormElement:function(e){var t=e.is("button")?"html":"val";e.data("ujs:enable-with",e[t]());e[t](e.data("disable-with"));e.prop("disabled",true)},enableFormElements:function(t){n.formElements(t,n.enableSelector).each(function(){n.enableFormElement(e(this))})},enableFormElement:function(e){var t=e.is("button")?"html":"val";if(e.data("ujs:enable-with"))e[t](e.data("ujs:enable-with"));e.prop("disabled",false)},allowAction:function(e){var t=e.data("confirm"),r=false,i;if(!t){return true}if(n.fire(e,"confirm")){r=n.confirm(t);i=n.fire(e,"confirm:complete",[r])}return r&&i},blankInputs:function(t,n,r){var i=e(),s,o,u=n||"input,textarea",a=t.find(u);a.each(function(){s=e(this);o=s.is("input[type=checkbox],input[type=radio]")?s.is(":checked"):s.val();if(!o===!r){if(s.is("input[type=radio]")&&a.filter('input[ty
jQuery(document).ready(function($){
$.ajaxSetup({
beforeSend: function(xhr, settings) {
console.log('beforesend');
settings.data += "&_token=<?php echo csrf_token() ?>";
}
});
$('.editable').editable().on('hidden', function(e, reason){
var locale = $(this).data('locale');
if(reason === 'save'){
$(this).removeClass('status-0').addClass('status-1');
}
if(reason === 'save' || reason === 'nochange') {
var $next = $(this).closest('tr').next().find('.editable.locale-'+locale);
setTimeout(function() {
$next.editable('show');
}, 300);
}
});
$('.group-select').on('change', function(){
var locale = $('#locale').val();
var group = $(this).val();
if (group) {
url = '<?php echo action('\Barryvdh\TranslationManager\Controller@getView') ?>/'+$(this).val();
} else {
url = '<?php echo action('\Barryvdh\TranslationManager\Controller@getIndex') ?>';
}
if (locale) {
url = url + '?locale='+locale;
}
window.location.href = url;
});
$('.group-locale-select').on('change', function(){
var group = $('#group').val();
if (group) {
url = '<?php echo action('\Barryvdh\TranslationManager\Controller@getView') ?>/'+group;
} else {
url = '<?php echo action('\Barryvdh\TranslationManager\Controller@getIndex') ?>';
}
url = url + '?locale='+$(this).val();
window.location.href = url;
});
$("a.delete-key").click(function(event){
event.preventDefault();
var row = $(this).closest('tr');
var url = $(this).attr('href');
var id = row.attr('id');
$.post( url, {id: id}, function(){
row.remove();
} );
});
$('.form-import').on('ajax:success', function (e, data) {
$('div.success-import strong.counter').text(data.counter);
$('div.success-import').slideDown();
/*setTimeout(function(){
window.location.reload();
}, 3000);*/
});
$('.form-find').on('ajax:success', function (e, data) {
$('div.success-find strong.counter').text(data.counter);
$('div.success-find').slideDown();
setTimeout(function(){
window.location.reload();
}, 5000);
});
$('.form-publish').on('ajax:success', function (e, data) {
$('div.success-publish').slideDown();
});
$('.form-publish-all').on('ajax:success', function (e, data) {
$('div.success-publish-all').slideDown();
});
$('.form-send-translations').on('ajax:success', function (e, data) {
if (typeof(data.error_msg) != "undefined") {
$('#error-send-general').hide();
$('#error-send-custom').text(data.error_msg).show();
$('div.error-send-translations').slideDown();
$('div.success-send-translations').slideUp();
} else {
$('div.success-send-translations').slideDown();
$('div.error-send-translations').slideUp();
}
});
$('.form-send-translations').on('ajax:error', function (e, data) {
$('#error-send-general').show();
$('#error-send-custom').hide();
$('div.error-send-translations').slideDown();
});
$('.form-remove-unpublished').on('ajax:success', function (e, data) {
$('div.success-remove-unpublished').slideDown();
});
$('.form-download-trigger').click(function(e) {
if (confirm('This will publish translations and download them as ZIP archive.')) {
return true;
} else {
e.preventDefault();
}
});
})
@endsection