-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #438 from jan-stanek/fileinput
aktualizace fileinput
- Loading branch information
Showing
2 changed files
with
82 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
} |