2011-12-13 09:07:52 +01:00
|
|
|
var MergeRequest = {
|
2011-12-13 19:40:45 +01:00
|
|
|
diffs_loaded: false,
|
2011-12-13 09:07:52 +01:00
|
|
|
commits_loaded: false,
|
|
|
|
|
|
|
|
init:
|
|
|
|
function() {
|
2012-01-26 23:13:19 +01:00
|
|
|
$(".tabs a").live("click", function() {
|
|
|
|
$(".tabs a").parent().removeClass("active");
|
|
|
|
$(this).parent().addClass("active");
|
2011-12-13 09:07:52 +01:00
|
|
|
});
|
|
|
|
|
2012-01-26 23:13:19 +01:00
|
|
|
$(".tabs a.merge-notes-tab").live("click", function() {
|
2011-12-13 19:40:45 +01:00
|
|
|
$(".merge-request-commits, .merge-request-diffs").hide();
|
|
|
|
$(".merge-request-notes").show();
|
|
|
|
});
|
|
|
|
|
2012-01-26 23:13:19 +01:00
|
|
|
$(".tabs a.merge-commits-tab").live("click", function() {
|
2011-12-13 19:40:45 +01:00
|
|
|
if(!MergeRequest.commits_loaded) {
|
2011-12-13 09:07:52 +01:00
|
|
|
MergeRequest.loadCommits();
|
|
|
|
}
|
2011-12-13 19:40:45 +01:00
|
|
|
$(".merge-request-notes, .merge-request-diffs").hide();
|
|
|
|
$(".merge-request-commits").show();
|
|
|
|
});
|
|
|
|
|
2012-01-26 23:13:19 +01:00
|
|
|
$(".tabs a.merge-diffs-tab").live("click", function() {
|
2011-12-13 19:40:45 +01:00
|
|
|
if(!MergeRequest.diffs_loaded) {
|
|
|
|
MergeRequest.loadDiff();
|
|
|
|
}
|
|
|
|
$(".merge-request-notes, .merge-request-commits").hide();
|
|
|
|
$(".merge-request-diffs").show();
|
2011-12-13 09:07:52 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
loadCommits:
|
|
|
|
function() {
|
|
|
|
$(".dashboard-loader").show();
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
2011-12-13 19:40:45 +01:00
|
|
|
url: $(".merge-commits-tab").attr("data-url"),
|
2011-12-13 09:07:52 +01:00
|
|
|
complete: function(){
|
|
|
|
MergeRequest.commits_loaded = true;
|
2011-12-13 19:40:45 +01:00
|
|
|
$(".merge-request-notes, .merge-request-diffs").hide();
|
2011-12-13 09:07:52 +01:00
|
|
|
$(".dashboard-loader").hide()},
|
|
|
|
dataType: "script"});
|
|
|
|
},
|
|
|
|
|
|
|
|
loadDiff:
|
|
|
|
function() {
|
2011-12-13 19:40:45 +01:00
|
|
|
$(".dashboard-loader").show();
|
|
|
|
$.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: $(".merge-diffs-tab").attr("data-url"),
|
|
|
|
complete: function(){
|
|
|
|
MergeRequest.diffs_loaded = true;
|
|
|
|
$(".merge-request-notes, .merge-request-commits").hide();
|
|
|
|
$(".dashboard-loader").hide()},
|
|
|
|
dataType: "script"});
|
2011-12-13 09:07:52 +01:00
|
|
|
}
|
|
|
|
}
|