summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSato Hiroyuki <sathiroyuki@gmail.com>2013-02-05 12:46:31 +0900
committerSato Hiroyuki <sathiroyuki@gmail.com>2013-02-05 19:08:09 +0900
commit8ff5cf9cd5193b7135f53de3b62dd50bcbbfc2dc (patch)
treeb28ca30035b43c4294dc58bb3ec0a5980e948f8e
parent81cc1cb87b2056b11640c9887bd40674c9d7925e (diff)
downloadgitlab-ce-8ff5cf9cd5193b7135f53de3b62dd50bcbbfc2dc.tar.gz
Add search box for the commit.
-rw-r--r--app/controllers/graph_controller.rb10
-rw-r--r--app/views/graph/_head.html.haml9
-rw-r--r--app/views/graph/show.html.haml9
3 files changed, 22 insertions, 6 deletions
diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb
index c4d745e9ccd..c370433e500 100644
--- a/app/controllers/graph_controller.rb
+++ b/app/controllers/graph_controller.rb
@@ -7,6 +7,16 @@ class GraphController < ProjectResourceController
before_filter :require_non_empty_project
def show
+ if params.has_key?(:q) && params[:q].blank?
+ redirect_to project_graph_path(@project, params[:id])
+ return
+ end
+
+ if params.has_key?(:q)
+ @q = params[:q]
+ @commit = @project.repository.commit(@q) || @commit
+ end
+
respond_to do |format|
format.html
format.json do
diff --git a/app/views/graph/_head.html.haml b/app/views/graph/_head.html.haml
new file mode 100644
index 00000000000..7e1b46446af
--- /dev/null
+++ b/app/views/graph/_head.html.haml
@@ -0,0 +1,9 @@
+%ul.nav.nav-tabs
+ %li
+ = render partial: 'shared/ref_switcher', locals: {destination: 'graph', path: @path}
+ %li.pull-right.search
+ = form_tag project_graph_path(@project, params[:id]), method: :get, class: 'navbar-form' do |f|
+ = label_tag :search , "Looking for commit:"
+ = text_field_tag :q, @q, placeholder: "Input SHA", class: "search-input"
+
+%h3.page_title Project Network Graph
diff --git a/app/views/graph/show.html.haml b/app/views/graph/show.html.haml
index 4ca75d68f8c..e45aca1ddcb 100644
--- a/app/views/graph/show.html.haml
+++ b/app/views/graph/show.html.haml
@@ -1,7 +1,4 @@
-%h3.page_title Project Network Graph
-%br
-= render partial: 'shared/ref_switcher', locals: {destination: 'graph', path: @path}
-%br
+= render "head"
.graph_holder
%h4
%small You can move around the graph by using the arrow keys.
@@ -12,9 +9,9 @@
var branch_graph;
$(function(){
branch_graph = new BranchGraph($("#holder"), {
- url: '#{project_graph_path(@project, @ref, format: :json)}',
+ url: '#{project_graph_path(@project, @ref, q: @q, format: :json)}',
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',
ref: '#{@ref}',
- commit_id: '#{@commit && @commit.id}'
+ commit_id: '#{@commit.id}'
});
});