Last active
August 23, 2016 11:32
-
-
Save fritzmg/81acff5ed269f3281ee1 to your computer and use it in GitHub Desktop.
Contao RebuildIndex template with more feedback
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
<div id="tl_maintenance_index" class="maintenance_<?= $this->isActive ? 'active' : 'inactive' ?>"> | |
<h2 class="sub_headline_index"><?= $this->indexHeadline ?></h2> | |
<?php if ($this->indexMessage): ?> | |
<div class="tl_message"> | |
<p class="tl_error"><?= $this->indexMessage ?></p> | |
</div> | |
<?php endif; ?> | |
<?php if ($this->isRunning): ?> | |
<div id="tl_rebuild_index"> | |
<p id="index_loading"><?= $this->loading ?></p> | |
<p id="index_complete" style="display:none"><?= $this->complete ?></p> | |
<p style="margin-bottom:0"><?= $this->content ?></p> | |
</div> | |
<script> | |
window.addEvent('domready', function() { | |
var urls = $$('.page_url'), | |
complete = 0; | |
urls.each(function(el) { | |
el.getAttribute('data-url') && new Request({ | |
'url': el.getAttribute('data-url'), | |
onSuccess: function() { | |
el.addClass('tl_green'); | |
}, | |
onFailure: function(xhr) { | |
el.addClass('tl_red'); | |
el.set('text', el.get('text') + ' - ' + xhr.status ); | |
}, | |
onComplete: function() { | |
complete++; | |
if (complete == urls.length) { | |
$('index_loading').setStyle('display', 'none'); | |
$('index_complete').setStyle('display', 'block'); | |
} | |
} | |
}).get(); | |
}); | |
}); | |
</script> | |
<form action="<?= $this->action ?>" class="tl_form" method="get"> | |
<div class="tl_submit_container"> | |
<input type="hidden" name="do" value="maintenance"> | |
<input type="submit" id="index" class="tl_submit" value="<?= $this->indexContinue ?>"> | |
</div> | |
</form> | |
<?php else: ?> | |
<form action="<?= $this->action ?>" class="tl_form" method="get"> | |
<div class="tl_formbody_edit"> | |
<input type="hidden" name="act" value="index"> | |
<input type="hidden" name="do" value="maintenance"> | |
<input type="hidden" name="rt" value="<?= REQUEST_TOKEN ?>"> | |
<div class="tl_tbox"> | |
<h3><label for="ctrl_user"><?= $this->indexLabel ?></label></h3> | |
<select name="user" id="ctrl_user" class="tl_select"> | |
<?php foreach ($this->user as $id=>$name): ?> | |
<option value="<?= $id ?>"><?= $name ?></option> | |
<?php endforeach; ?> | |
</select> | |
<?php if ($this->indexHelp): ?> | |
<p class="tl_help tl_tip"><?= $this->indexHelp ?></p> | |
<?php endif; ?> | |
</div> | |
</div> | |
<div class="tl_submit_container"> | |
<input type="submit" id="index" class="tl_submit" value="<?= $this->indexSubmit ?>"> | |
</div> | |
</form> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment