forked from qd-today/qd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
261 additions
and
51 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<table class="table table-hover"> | ||
<thead> | ||
<tr> | ||
<th style="text-align:center" title="仓库名">仓库名</th> | ||
<th style="text-align:center" title="仓库分支">仓库分支</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for repo in repos %} | ||
<tr> | ||
<td style="text-align:center"> | ||
<a href="{{ repo.repourl }}" target="_blank" rel="noopener noreferrer">{{ repo.reponame }}</a> | ||
</td> | ||
<td style="text-align:center">{{ repo.repobranch }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<form method="POST" action="/subscribe/unsubscribe_repos/{{userid}}/"> | ||
<h2 class="text-center">退订仓库</h2> | ||
<hr> | ||
<div id="run-result"></div> | ||
<script> | ||
var selectedrepos = {}; | ||
debugger | ||
if (typeof (sessionStorage.selectedrepo) != "undefined") { | ||
selectedrepos = JSON.parse(sessionStorage['selectedrepo']) | ||
NProgress.start(); | ||
NProgress.inc(); | ||
$.ajax("/subscribe/{{user.id}}/get_reposinfo", { | ||
type: 'POST', | ||
data: selectedrepos, | ||
}) | ||
.done(function (data) { | ||
$('#repotable').html(data).show() | ||
}) | ||
.fail(function (jxhr) { | ||
$('#run-result').html('<h1 class="alert alert-danger text-center">设置失败</h1><div class="well"></div>').show().find('div').text(jxhr.responseText); | ||
}) | ||
.always(function () { NProgress.done(); }) | ||
} else { | ||
$('#run-result').html('<h1 class="alert alert-danger text-center">FAIL</h1><div class="well"></div>').show().find('div').text('请选择要退订的仓库'); | ||
} | ||
</script> | ||
{% if current_user %} | ||
<div id="repotable"></div> | ||
<div class="text-right"> | ||
<button id="unsubscribe" name="unsubscribe" type="button" data-loading-text="loading..." | ||
class="btn btn-primary">退订</button> | ||
</div> | ||
<script> | ||
$(function () { | ||
$('#unsubscribe').on('click', function () { | ||
NProgress.start(); | ||
data = { | ||
selectedrepos: JSON.stringify(selectedrepos) | ||
} | ||
var $this = $(this); | ||
$this.button('loading'); | ||
NProgress.inc(); | ||
$.ajax("/subscribe/unsubscribe_repos/{{user.id}}/", { | ||
type: 'POST', | ||
data: data, | ||
}) | ||
.done(function (data) { | ||
$('#run-result').html(data).show() | ||
}) | ||
.fail(function (jxhr) { | ||
$('#run-result').html('<h1 class="alert alert-danger text-center">设置失败</h1><div class="well"></div>').show().find('div').text(jxhr.responseText); | ||
}) | ||
.always(function () { | ||
$this.button('reset'); | ||
NProgress.inc(); | ||
if (typeof (sessionStorage.selectedrepo) != "undefined") { | ||
sessionStorage.removeItem('selectedrepo') | ||
} | ||
}); | ||
NProgress.done(); | ||
return false; | ||
}); | ||
$('#modal_load').on('hide.bs.modal', | ||
function () { | ||
location.reload(); | ||
}) | ||
}); | ||
</script> | ||
{% endif %} | ||
</form> |
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