Commit 16c3925927ebabaca3598e1c804856b952321003
1 parent
6aa34c0e
Exists in
master
and in
4 other branches
Determine network height based on window size
Showing
3 changed files
with
22 additions
and
15 deletions
Show diff stats
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +class Network | ||
2 | + constructor: (opts) -> | ||
3 | + $("#filter_ref").click -> | ||
4 | + $(this).closest('form').submit() | ||
5 | + | ||
6 | + branch_graph = new BranchGraph($(".network-graph"), opts) | ||
7 | + | ||
8 | + vph = $(window).height() - 250 | ||
9 | + $('.network-graph').css 'height': (vph + 'px') | ||
10 | + | ||
11 | +@Network = Network |
app/assets/stylesheets/sections/graph.scss
1 | -.graph_holder { | 1 | +.project-network { |
2 | border: 1px solid #aaa; | 2 | border: 1px solid #aaa; |
3 | padding: 1px; | 3 | padding: 1px; |
4 | 4 | ||
5 | - | ||
6 | - h4 { | ||
7 | - margin: 0; | 5 | + .tip { |
6 | + color: #888; | ||
7 | + font-size: 14px; | ||
8 | padding: 10px; | 8 | padding: 10px; |
9 | border-bottom: 1px solid #bbb; | 9 | border-bottom: 1px solid #bbb; |
10 | @include bg-gray-gradient; | 10 | @include bg-gray-gradient; |
11 | } | 11 | } |
12 | 12 | ||
13 | - .graph { | 13 | + .network-graph { |
14 | background: #f1f1f1; | 14 | background: #f1f1f1; |
15 | height: 500px; | 15 | height: 500px; |
16 | overflow-y: scroll; | 16 | overflow-y: scroll; |
app/views/projects/network/show.html.haml
1 | = render "head" | 1 | = render "head" |
2 | -.graph_holder | ||
3 | - %h4 | ||
4 | - %small You can move around the graph by using the arrow keys. | ||
5 | - #holder.graph | 2 | +.project-network |
3 | + .tip | ||
4 | + You can move around the graph by using the arrow keys. | ||
5 | + .network-graph | ||
6 | .loading.loading-gray | 6 | .loading.loading-gray |
7 | 7 | ||
8 | :javascript | 8 | :javascript |
9 | - var branch_graph; | ||
10 | - $("#filter_ref").click(function() { | ||
11 | - $(this).closest('form').submit(); | ||
12 | - }); | ||
13 | - branch_graph = new BranchGraph($("#holder"), { | 9 | + new Network({ |
14 | url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}', | 10 | url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}', |
15 | commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', | 11 | commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', |
16 | ref: '#{@ref}', | 12 | ref: '#{@ref}', |
17 | commit_id: '#{@commit.id}' | 13 | commit_id: '#{@commit.id}' |
18 | - }); | 14 | + }) |