Skip to content

Commit

Permalink
Merge pull request #438 from jan-stanek/fileinput
Browse files Browse the repository at this point in the history
aktualizace fileinput
  • Loading branch information
Jan Staněk authored Nov 15, 2017
2 parents 32a24cc + 39c5618 commit fd5b0f7
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 81 deletions.
4 changes: 2 additions & 2 deletions app/config/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ webloader:
- libs/bootstrap-confirmation/bootstrap-confirmation.min.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/fileinput.min.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/themes/fa/theme.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/locales/cz.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/locales/cs.js
- libs/ublaboo-datagrid/happy.min.js
- libs/ublaboo-datagrid/datagrid.js
# - %appDir%/../vendor/ublaboo/datagrid/assets/dist/datagrid.min.js
Expand All @@ -321,7 +321,7 @@ webloader:
- libs/bootstrap-confirmation/bootstrap-confirmation.min.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/fileinput.min.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/themes/fa/theme.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/locales/cz.js
- %appDir%/../vendor/kartik-v/bootstrap-fileinput/js/locales/cs.js
- libs/ublaboo-datagrid/happy.min.js
- libs/ublaboo-datagrid/datagrid.js
# - %appDir%/../vendor/ublaboo/datagrid/assets/dist/datagrid.min.js
Expand Down
159 changes: 80 additions & 79 deletions www/js/main.js
Original file line number Diff line number Diff line change
@@ -1,106 +1,107 @@
var ALERT_DURATION = 5000;

$(function () {
$.nette.ext('initScripts', {
complete: function () {
init();
}
});
$.nette.ext('initScripts', {
complete: function () {
init();
}
});

$.nette.init();
$.nette.init();

init();
init();
});

function init() {
animateAlerts();
initSelects();
initFileInputs();
initConfirms();
initDateTimePicker();
animateAlerts();
initSelects();
initFileInputs();
initConfirms();
initDateTimePicker();

$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="tooltip"]').tooltip();

$('form#frm-applicationContent-applicationForm').submit(function(){
$(this).find(':input[type=submit]').prop('disabled', true);
});
$('form#frm-applicationContent-applicationForm').submit(function () {
$(this).find(':input[type=submit]').prop('disabled', true);
});
}

function animateAlerts() {
$('.alert:not(.alert-forever)').animate({
opacity: 1.0
}, ALERT_DURATION).slideUp(1000);
$('.alert:not(.alert-forever)').animate({
opacity: 1.0
}, ALERT_DURATION).slideUp(1000);
}

function initSelects() {
$('select')
.not('.datagrid .row-group-actions select')
.not('.datagrid .col-per-page select')
.not('.modal-body select')
.add('select[multiple]')
.selectpicker({
noneSelectedText: 'Nic není vybráno',
noneResultsText: 'Žádné výsledky {0}',
countSelectedText: 'Označeno {0} z {1}',
maxOptionsText: [
'Limit překročen ({n} {var} max)',
'Limit skupiny překročen ({n} {var} max)',
['položek', 'položka']
],
selectAllText: 'Vše',
deselectAllText: 'Nic',
multipleSeparator: ', ',
selectedTextFormat: 'count > 3',
actionsBox: true,
iconBase: 'fa',
tickIcon: 'fa-check'
});
$('select')
.not('.datagrid .row-group-actions select')
.not('.datagrid .col-per-page select')
.not('.modal-body select')
.add('select[multiple]')
.selectpicker({
noneSelectedText: 'Nic není vybráno',
noneResultsText: 'Žádné výsledky {0}',
countSelectedText: 'Označeno {0} z {1}',
maxOptionsText: [
'Limit překročen ({n} {var} max)',
'Limit skupiny překročen ({n} {var} max)',
['položek', 'položka']
],
selectAllText: 'Vše',
deselectAllText: 'Nic',
multipleSeparator: ', ',
selectedTextFormat: 'count > 3',
actionsBox: true,
iconBase: 'fa',
tickIcon: 'fa-check'
});
}

function initFileInputs() {
$('input[type="file"]').fileinput({
language: "cz",
theme: "fa",
browseLabel: "Vybrat",
showPreview: false,
showRemove: false,
showUpload: false,
showCancel: false,
browseClass: "btn btn-default"
});
$('input[type="file"]').fileinput({
language: "cs",
theme: "fa",
browseLabel: "Vybrat",
msgPlaceholder: "Vybrat soubor...",
showPreview: false,
showRemove: false,
showUpload: false,
showCancel: false,
browseClass: "btn btn-default"
});
}

function initConfirms() {
$('[data-toggle=confirmation]').confirmation({
rootSelector: '[data-toggle=confirmation]',
title: '',
singleton: 'true',
popout: 'true',
btnOkClass: 'btn btn-primary',
btnOkIcon: 'fa fa-check',
btnOkLabel: 'Ano',
btnCancelClass: 'btn btn-default',
btnCancelIcon: 'fa fa-times',
btnCancelLabel: 'Ne'
});
$('[data-toggle=confirmation]').confirmation({
rootSelector: '[data-toggle=confirmation]',
title: '',
singleton: 'true',
popout: 'true',
btnOkClass: 'btn btn-primary',
btnOkIcon: 'fa fa-check',
btnOkLabel: 'Ano',
btnCancelClass: 'btn btn-default',
btnCancelIcon: 'fa fa-times',
btnCancelLabel: 'Ne'
});
}

function initDateTimePicker() {
$('input.date, input.datetime-local').each(function (i, el) {
el = $(el);
el.get(0).type = 'text';
el.datetimepicker({
language: 'cs',
startDate: el.attr('min'),
endDate: el.attr('max'),
weekStart: 1,
minView: el.is('.date') ? 'month' : 'hour',
format: el.is('.date') ? 'd. m. yyyy' : 'd. m. yyyy hh:ii', // for seconds support use 'd. m. yyyy - hh:ii:ss'
autoclose: true,
fontAwesome: true,
todayBtn: true,
todayHighlight: true
$('input.date, input.datetime-local').each(function (i, el) {
el = $(el);
el.get(0).type = 'text';
el.datetimepicker({
language: 'cs',
startDate: el.attr('min'),
endDate: el.attr('max'),
weekStart: 1,
minView: el.is('.date') ? 'month' : 'hour',
format: el.is('.date') ? 'd. m. yyyy' : 'd. m. yyyy hh:ii', // for seconds support use 'd. m. yyyy - hh:ii:ss'
autoclose: true,
fontAwesome: true,
todayBtn: true,
todayHighlight: true
});
el.attr('value') && el.datetimepicker('setValue');
});
el.attr('value') && el.datetimepicker('setValue');
});
}

0 comments on commit fd5b0f7

Please sign in to comment.