FEATURE: add working confirm dialog

This commit is contained in:
Michal Kváček
2016-09-13 03:51:50 +02:00
parent ea5aa8d873
commit 8476d5fbd7
5 changed files with 67 additions and 36 deletions
+11 -2
View File
@@ -9520,11 +9520,11 @@ pre code {
border-bottom-width: 2px; border-bottom-width: 2px;
} }
.table-striped tbody tr:nth-of-type(odd) { .table-striped tbody tr:nth-of-type(odd), .rows-striped .row:nth-of-type(odd) {
background-color: #F9F9F9; background-color: #F9F9F9;
} }
.table-hover tbody tr:hover { .table-hover tbody tr:hover, .rows-striped .row:hover {
background-color: #F5F5F5; background-color: #F5F5F5;
} }
@@ -14370,4 +14370,13 @@ img {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
}
.bold {
font-weight: bold;
}
.p-tb-15 {
padding-top: 15px;
padding-bottom: 15px;
} }
+37 -21
View File
@@ -1346,7 +1346,6 @@ $ (function () {
}); });
$ (function () { $ (function () {
$ ("body").addClass ("loaded"); $ ("body").addClass ("loaded");
@@ -1364,7 +1363,6 @@ $ (function () {
} }
}); });
/** /**
* Makes slug from input string * Makes slug from input string
* *
@@ -1401,24 +1399,45 @@ function slugify(text, trimSpaces) {
// bind some custom methods // bind some custom methods
$ (document).ready (function () { $ (document).ready (function () {
$ ('.confirm').click (function () { var previousTitle, previousMessage;
var confirmMessage = $ (this).data ('confirm-message');
// set some default message $ ('.confirm').click (function (e) {
if (typeof confirmMessage == 'undefined') {
confirmMessage = 'Really?';
}
return confirm (confirmMessage); var titleElement = $ ('#confirmation-title');
var messageElement = $ ('#confirmation-message');
previousTitle = titleElement.text ();
previousMessage = messageElement.text ();
var confirmTitle = $ (this).data ('title');
var confirmMessage = $ (this).data ('message');
var href = $ (this).attr ('href');
$ ('#confirm-button').attr ('href', href);
if (confirmTitle)
titleElement.text (confirmTitle);
if (confirmMessage)
messageElement.text (confirmMessage);
$ ('#confirm-modal').modal ('show');
e.preventDefault ();
}); });
$('#lockUrl').change(function () { $ ('#confirm-modal').on ('hidden.bs.modal', function () {
$ ('#confirmation-title').text (previousTitle);
$ ('#confirmation-message').text (previousMessage);
});
$ ('#lockUrl').change (function () {
$ ('.slug-source').keyup (); $ ('.slug-source').keyup ();
}); });
$ ('.slug-target').keyup (function () { $ ('.slug-target').keyup (function () {
$ (this).val (slugify ($ (this).val (), false)); $ (this).val (slugify ($ (this).val (), false));
$('#lockUrl').prop('checked', true); $ ('#lockUrl').prop ('checked', true);
}); });
$ ('.slug-source').keyup (function () { $ ('.slug-source').keyup (function () {
@@ -1430,22 +1449,19 @@ $ (document).ready (function () {
target.val (slugify (source.val (), true)); target.val (slugify (source.val (), true));
}); });
$(function () { $ (function () {
$('[data-toggle="tooltip"]').tooltip() $ ('[data-toggle="tooltip"]').tooltip ()
}) });
// find if any error occured and mark tab with that error // find if any error occured and mark tab with that error
$('.has-error').each(function () { $ ('.has-error').each (function () {
var error = $(this); var error = $ (this);
var tabCard = error.closest('.tab-pane'); var tabCard = error.closest ('.tab-pane');
$("#"+tabCard.prop('id')+"-tab").addClass('tab-with-error'); $ ("#" + tabCard.prop ('id') + "-tab").addClass ('tab-with-error');
}); });
}); });
/*********************************************** /***********************************************
* NProgress Settings * NProgress Settings
***********************************************/ ***********************************************/
+5 -1
View File
@@ -2,5 +2,9 @@
return [ return [
'admin' => 'Administration', 'admin' => 'Administration',
'logout' => 'Log out', 'logout' => 'Log out',
'logoutSuccessfull' => 'Logout was successfull.' 'logoutSuccessfull' => 'Logout was successfull.',
'yes' => 'Yes',
'no' => 'No',
'confirmationTitle' => 'Really?',
'confirmation' => 'Do you really want to perform this action?',
]; ];
+13 -11
View File
@@ -53,27 +53,29 @@
<div class="modal fade" id="confirm-modal"> <div class="modal fade" id="confirm-modal">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title"><i class="fa fa-warning"></i> Alert</h4> </div> <h4 class="modal-title">
<i class="fa fa-warning"></i>
<span id="confirmation-title">@lang('admin/common.confirmationTitle')</span>
</h4>
</div>
<div class="modal-body"> <div class="modal-body">
<p>Are you sure want to do this?</p> <p id="confirmation-message">@lang('admin/common.confirmation')</p>
</div>
<div class="modal-footer">
<a id="confirm-button" class="btn btn-primary">@lang('admin/common.yes')</a>
<button id="cancel-modal-button" type="button" class="btn btn-secondary" data-dismiss="modal">@lang('admin/common.no')</button>
</div> </div>
<div class="modal-footer"> <button type="button" class="btn btn-primary" data-dismiss="modal">Yes</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">No</button> </div>
</div> </div>
<!-- /.modal-content --> <!-- /.modal-content -->
</div> </div>
<!-- /.modal-dialog --> <!-- /.modal-dialog -->
</div> </div>
<div class="ref" id="ref">
<div class="color-primary"></div>
<div class="chart">
<div class="color-primary"></div>
<div class="color-secondary"></div>
</div>
</div>
<script src="{{asset('resources/assets/admin/js')}}/vendor.js"></script> <script src="{{asset('resources/assets/admin/js')}}/vendor.js"></script>
<script src="{{asset('resources/assets/admin/js')}}/app.js"></script> <script src="{{asset('resources/assets/admin/js')}}/app.js"></script>
@yield('javascripts') @yield('javascripts')
@@ -156,7 +156,7 @@
<div class="footer-block author"> <div class="footer-block author">
<ul> <ul>
<li> <li>
&copy; {{date('Y')}} <a href="https://binarity.cz">binarity s.r.o.</a> &copy; {{date('Y')}} <a href="https://www.binarity.cz">binarity s.r.o.</a>
</li> </li>
<li> <li>
<a href="https://github.com/modularcode">ModularCode</a> <a href="https://github.com/modularcode">ModularCode</a>