Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/autogit.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ public function commit($message)
public function pull()
{
$this->execute("pull {$this->remoteName} {$this->remoteBranch} 2>&1");
kirby()->cache()->flush();
}

public function push()
{
$this->execute("push {$this->remoteName} {$this->remoteBranch} 2>&1");
}

public function getStatus()
{
return $this->execute("status 2>&1")[1];
}

public function hasRemote($remoteName = null)
{
$remoteName = $remoteName ? $remoteName : $this->remoteName;
Expand Down
13 changes: 5 additions & 8 deletions widgets/autogit/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
margin-top: .5em;
text-align: center; }

.autogit-status {
display: none; }

.autogit-warning {
color: #b3000a; }

Expand Down Expand Up @@ -57,7 +54,7 @@
<i class="icon icon-left fa fa-cloud-download"></i>
Get latest changes
</button>
<div class="autogit-status"></div>
<div class="autogit-status"><?= autogit()->getStatus() ?></div>
<?php else : ?>
<div class="autogit-warning">
Could not detect remote repository <strong><?php echo c::get('autogit.remote.name') ?></strong>.
Expand Down Expand Up @@ -87,22 +84,22 @@
$.post(panelURL + '/autogit/' + $button.data('action'))
.done(function (res) {
$button.find('.icon').replaceWith($successIcon)
$status.text(res.message).show(600)
$status.text(res.message).show(0)
})
.fail(function (res) {
$button.find('.icon').replaceWith($errorIcon)
$button.removeClass('btn-positive').addClass('btn-negative')
$status.text(res.responseJSON.message).show(600)
$status.text(res.responseJSON.message).show(0)
})
.always(function () {
setTimeout(function () {
$button.find('.icon').replaceWith($defaultIcon)
$button.removeClass('btn-negative').addClass('btn-positive')
$otherButton.prop('disabled', false)
$status.hide(600, function () {
$status.hide(0, function () {
$(this).text('')
})
}, 6000)
}, 10000)
})
})
</script>