rosa-build/app/views/projects/pull_requests/_nav_tabs.html.haml

23 lines
793 B
Plaintext

%ul.nav.nav-tabs#pull_tabs
%li
%a{"data-toggle" => "tab", :href => "#discussion"}=t 'pull_requests.tabs.discussion'
-if @stats
%li
%a{"data-toggle" => "tab", :href => "#diff"}="#{t'pull_requests.tabs.diff'} (#{@stats.count})"
-if @commits
%li
- commits_message = @commits.count.to_s
- commits_message << '+' if @total_commits > @commits.count
%a{"data-toggle" => "tab", :href => "#commits"}="#{t'pull_requests.tabs.commits'} (#{commits_message})"
:javascript
$(document).ready(function() {
var tab = 'discussion';
if(document.location.href.match(/(.*)#diff(.*)/)) {
tab = 'diff';
} else if(document.location.href.match(/(.*)#commits(.*)/)) {
tab = 'commits';
};
$('#pull_tabs a[href="#'+tab+'"]').tab('show');
});