mediatheque
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
.index-status {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.index-status span {
|
||||
padding: 0.3rem 0.7rem;
|
||||
border-radius: 4px;
|
||||
line-height: 1.7;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
}
|
||||
.index-status .error {
|
||||
background: #ddd;
|
||||
color: #c00;
|
||||
}
|
||||
.index-status .success {
|
||||
border: 1px solid #ddd;
|
||||
color: #999;
|
||||
}
|
||||
#admin-main .admin-block .index-status .button.critical {
|
||||
background: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#admin-main .admin-block .index-status .button.reindex {
|
||||
background: #0079BA;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tntsearch-error-details {
|
||||
padding: .2rem .5rem;
|
||||
margin: 1rem 0;
|
||||
border-radius: 3px;
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
((function($) {
|
||||
$(document).ready(function() {
|
||||
var Request, Toastr = null;
|
||||
if (typeof Grav !== 'undefined' && Grav && Grav.default && Grav.default.Utils) {
|
||||
Request = Grav.default.Utils.request;
|
||||
Toastr = Grav.default.Utils.toastr;
|
||||
}
|
||||
var indexer = $('#tntsearch-index, #admin-nav-quick-tray .tntsearch-reindex'),
|
||||
current = null, currentTray = null;
|
||||
if (!indexer.length) { return; }
|
||||
|
||||
indexer.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var target = $(e.target),
|
||||
isTray = target.closest('#admin-nav-quick-tray').length,
|
||||
status = indexer.siblings('.tntsearch-status'),
|
||||
errorDetails = indexer.siblings('.tntsearch-error-details');
|
||||
current = status.clone(true);
|
||||
|
||||
console.log(isTray);
|
||||
if (isTray) {
|
||||
target = target.is('i') ? target.parent() : target;
|
||||
currentTray = target.find('i').attr('class');
|
||||
target.find('i').attr('class', 'fa fa-fw fa-circle-o-notch fa-spin');
|
||||
}
|
||||
|
||||
errorDetails
|
||||
.hide()
|
||||
.empty();
|
||||
|
||||
status
|
||||
.removeClass('error success')
|
||||
.empty()
|
||||
.html('<i class="fa fa-circle-o-notch fa-spin" />');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: GravAdmin.config.base_url_relative + '.json/task' + GravAdmin.config.param_sep + 'reindexTNTSearch',
|
||||
data: { 'admin-nonce': GravAdmin.config.admin_nonce }
|
||||
}).done(function(done) {
|
||||
if (done.status === 'success') {
|
||||
indexer.removeClass('critical').addClass('reindex');
|
||||
status.removeClass('error').addClass('success');
|
||||
Toastr.success(done.message);
|
||||
} else {
|
||||
indexer.removeClass('reindex').addClass('critical');
|
||||
status.removeClass('success').addClass('error');
|
||||
var error = done.message;
|
||||
if (done.details) {
|
||||
error += '<br />' + done.details;
|
||||
errorDetails
|
||||
.text(done.details)
|
||||
.show();
|
||||
|
||||
status.replaceWith(current);
|
||||
}
|
||||
|
||||
Toastr.error(error);
|
||||
}
|
||||
|
||||
status.html(done.message);
|
||||
}).fail(function(error) {
|
||||
if (error.responseJSON && error.responseJSON.error) {
|
||||
indexer.removeClass('reindex').addClass('critical');
|
||||
errorDetails
|
||||
.text(error.responseJSON.error.message)
|
||||
.show();
|
||||
|
||||
status.replaceWith(current);
|
||||
}
|
||||
}).always(function() {
|
||||
target.find('i').attr('class', currentTray);
|
||||
current = null;
|
||||
currentTray = null;
|
||||
});
|
||||
})
|
||||
});
|
||||
})(jQuery));
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 755 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
@@ -0,0 +1,71 @@
|
||||
.tntsearch-form .form-input {
|
||||
height: 2.4rem;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
|
||||
#tntsearch-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tntsearch-clear {
|
||||
border-radius: 100%;
|
||||
padding: 0 1rem;
|
||||
line-height: 1;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
font-size: 2rem;
|
||||
top: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tntsearch-field-inpage {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tntsearch-dropdown ~ .tntsearch-results {
|
||||
position: relative;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tntsearch-dropdown ~ .tntsearch-results .row {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 400px;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 20px rgba(0,0,0, 0.1);
|
||||
padding: 10px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.tntsearch-results .info {
|
||||
color: #999;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.tntsearch-results .title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.tntsearch-results .route {
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.tntsearch-results .row > p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.tntsearch-results em {
|
||||
font-style: normal;
|
||||
background-color: #ffff33;
|
||||
}
|
||||
|
||||
.tntsearch-powered-by {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.tntsearch-dropdown ~ .tntsearch-powered-by {
|
||||
display: none;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user