summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-06-29 21:55:22 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-06-29 21:55:22 +0300
commit2def1c7217556388763dfb860f76e16f9af58571 (patch)
treefdefb8e3b06d0789cbf3063999f006d484edb883 /app/assets
parentb110c6bc869d49089dc00abef53849765653d49b (diff)
downloadgitlab-ce-2def1c7217556388763dfb860f76e16f9af58571.tar.gz
Merge Request -> show. Refactored. f5 support for diff
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/merge_requests.js55
-rw-r--r--app/assets/stylesheets/sections/merge_requests.scss10
2 files changed, 58 insertions, 7 deletions
diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js
index 8df090cfa37..50092ae78b8 100644
--- a/app/assets/javascripts/merge_requests.js
+++ b/app/assets/javascripts/merge_requests.js
@@ -8,36 +8,77 @@ var MergeRequest = {
var self = this;
self.opts = opts;
+ self.initTabs();
+ self.initMergeWidget();
+
+ $(".mr_show_all_commits").bind("click", function() {
+ self.showAllCommits();
+ });
+
+ $(".line_note_link, .line_note_reply_link").live("click", function(e) {
+ var form = $(".per_line_form");
+ $(this).parent().parent().after(form);
+ form.find("#note_line_code").val($(this).attr("line_code"));
+ form.show();
+ return false;
+ });
+ },
+
+ initMergeWidget:
+ function() {
+ var self = this;
self.showState(self.opts.current_state);
+
if($(".automerge_widget").length && self.opts.check_enable){
$.get(opts.url_to_automerge_check, function(data){
self.showState(data.state);
}, "json");
}
+ },
- $(".nav-tabs a").live("click", function() {
- $(".nav-tabs a").parent().removeClass("active");
+ initTabs:
+ function() {
+ $(".mr_nav_tabs a").live("click", function() {
+ $(".mr_nav_tabs a").parent().removeClass("active");
$(this).parent().addClass("active");
});
- $(".nav-tabs a.merge-notes-tab").live("click", function(e) {
+ var current_tab;
+ if(this.opts.action == "diffs") {
+ current_tab = $(".mr_nav_tabs .merge-diffs-tab");
+ } else {
+ current_tab = $(".mr_nav_tabs .merge-notes-tab");
+ }
+ current_tab.parent().addClass("active");
+
+ this.initNotesTab();
+ this.initDiffTab();
+ },
+
+ initNotesTab:
+ function() {
+ $(".mr_nav_tabs a.merge-notes-tab").live("click", function(e) {
$(".merge-request-diffs").hide();
$(".merge_request_notes").show();
+ var mr_path = $(".merge-notes-tab").attr("data-url");
+ history.pushState({ path: mr_path }, '', mr_path);
e.preventDefault();
});
+ },
- $(".nav-tabs a.merge-diffs-tab").live("click", function(e) {
+ initDiffTab:
+ function() {
+ $(".mr_nav_tabs a.merge-diffs-tab").live("click", function(e) {
if(!MergeRequest.diffs_loaded) {
MergeRequest.loadDiff();
}
$(".merge_request_notes").hide();
$(".merge-request-diffs").show();
+ var mr_diff_path = $(".merge-diffs-tab").attr("data-url");
+ history.pushState({ path: mr_diff_path }, '', mr_diff_path);
e.preventDefault();
});
- $(".mr_show_all_commits").bind("click", function() {
- MergeRequest.showAllCommits();
- })
},
showState:
diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss
index de1ecf722e1..ad496238a13 100644
--- a/app/assets/stylesheets/sections/merge_requests.scss
+++ b/app/assets/stylesheets/sections/merge_requests.scss
@@ -72,3 +72,13 @@
@extend .primary;
}
}
+
+.mr_nav_tabs {
+ li {
+ a {
+ font-weight:bold;
+ padding:8px 20px;
+ text-align:center;
+ }
+ }
+}