mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 21:46:22 +05:30
Add clear index button
This commit is contained in:
parent
529cb62ae5
commit
e9589b1dc2
3 changed files with 46 additions and 7 deletions
|
|
@ -55,3 +55,5 @@ echo '<a href="' . site_url() .'admin/search">Back to search index</a>';
|
|||
|
||||
// Redir
|
||||
echo '<script language="javascript">window.location.href = "' .site_url() . 'admin/search"</script>';
|
||||
|
||||
?>
|
||||
|
|
@ -54,6 +54,26 @@
|
|||
<?php endif; ?>
|
||||
<input type="hidden" name="search_index" value="<?php print_r(htmlspecialchars(json_encode($search_index)));?>">
|
||||
</form>
|
||||
<?php } else {
|
||||
echo count(get_blog_posts()) . ' published posts has been indexed!';
|
||||
} ?>
|
||||
<?php } else {?>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
var data = 'content/data/search.json';
|
||||
$("#clearButton").click(function(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url();?>admin/search',
|
||||
dataType: 'json',
|
||||
data: {'json': data},
|
||||
success: function (response) {
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<p><?php echo count(get_blog_posts()); ?> published posts has been indexed!</p>
|
||||
<p><button class="btn btn-primary" id="clearButton">Clear Search Index</button></p>
|
||||
<?php } ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue