Commit 6505cd5ec95987b585a08294b53b5b1c2a5e38fc

Authored by Sato Hiroyuki
1 parent 3a4c1c5c

Add "Show only selected branch" checkbox

app/views/graph/_head.html.haml
@@ -4,6 +4,14 @@ @@ -4,6 +4,14 @@
4 .clearfix 4 .clearfix
5 .pull-left 5 .pull-left
6 = render partial: 'shared/ref_switcher', locals: {destination: 'graph'} 6 = render partial: 'shared/ref_switcher', locals: {destination: 'graph'}
  7 + .pull-left
  8 + = form_tag project_graph_path(@project, @id), method: :get do |f|
  9 + .control-group
  10 + = label_tag :filter_ref, "Show only selected ref", class: 'control-label light'
  11 + .controls
  12 + = check_box_tag :filter_ref, 1, @options[:filter_ref]
  13 + - @options.each do |key, value|
  14 + = hidden_field_tag(key, value, id: nil) unless key == "filter_ref"
7 15
8 .search.pull-right 16 .search.pull-right
9 = form_tag project_graph_path(@project, @id), method: :get do |f| 17 = form_tag project_graph_path(@project, @id), method: :get do |f|
app/views/graph/show.html.haml
@@ -7,6 +7,9 @@ @@ -7,6 +7,9 @@
7 7
8 :javascript 8 :javascript
9 var branch_graph; 9 var branch_graph;
  10 + $("#filter_ref").click(function() {
  11 + $(this).closest('form').submit();
  12 + });
10 branch_graph = new BranchGraph($("#holder"), { 13 branch_graph = new BranchGraph($("#holder"), {
11 url: '#{project_graph_path(@project, @ref, @options.merge(format: :json))}', 14 url: '#{project_graph_path(@project, @ref, @options.merge(format: :json))}',
12 commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', 15 commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',