diff --git a/app/views/commits/_head.html.haml b/app/views/commits/_head.html.haml
index cdee391..86a65f8 100644
--- a/app/views/commits/_head.html.haml
+++ b/app/views/commits/_head.html.haml
@@ -3,8 +3,8 @@
%li{class: "#{'active' if current_page?(project_commits_path(@project)) }"}
= link_to project_commits_path(@project) do
Commits
- %li{class: "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
- = link_to compare_project_commits_path(@project) do
+ %li{class: "#{'active' if current_controller?(:compare)}"}
+ = link_to project_compare_index_path(@project) do
Compare
%li{class: "#{branches_tab_class}"}
= link_to project_repository_path(@project) do
diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml
new file mode 100644
index 0000000..07f1c81
--- /dev/null
+++ b/app/views/compare/_form.html.haml
@@ -0,0 +1,32 @@
+%div
+ %p.slead
+ Fill input field with commit id like
+ %code.label_branch 4eedf23
+ or branch/tag name like
+ %code.label_branch master
+ and press compare button for commits list, code diff.
+
+ %br
+
+ = form_tag project_compare_index_path(@project), method: :post do
+ .clearfix
+ = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
+ = "..."
+ = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
+ - if @refs_are_same
+ .alert
+ %span Refs are the same
+ .actions
+ = submit_tag "Compare", class: "btn primary wide commits-compare-btn"
+
+:javascript
+ $(function() {
+ var availableTags = #{@project.ref_names.to_json};
+
+ $("#from, #to").autocomplete({
+ source: availableTags,
+ minLength: 1
+ });
+
+ disableButtonIfEmptyField('#to', '.commits-compare-btn');
+ });
diff --git a/app/views/compare/_head.html.haml b/app/views/compare/_head.html.haml
deleted file mode 100644
index cdee391..0000000
--- a/app/views/compare/_head.html.haml
+++ /dev/null
@@ -1,23 +0,0 @@
-%ul.nav.nav-tabs
- %li= render partial: 'shared/ref_switcher', locals: {destination: 'commits'}
- %li{class: "#{'active' if current_page?(project_commits_path(@project)) }"}
- = link_to project_commits_path(@project) do
- Commits
- %li{class: "#{'active' if current_page?(compare_project_commits_path(@project)) }"}
- = link_to compare_project_commits_path(@project) do
- Compare
- %li{class: "#{branches_tab_class}"}
- = link_to project_repository_path(@project) do
- Branches
- %span.badge= @project.repo.branch_count
-
- %li{class: "#{'active' if current_page?(tags_project_repository_path(@project)) }"}
- = link_to tags_project_repository_path(@project) do
- Tags
- %span.badge= @project.repo.tag_count
-
- - if current_page?(project_commits_path(@project)) && current_user.private_token
- %li.right
- %span.rss-icon
- = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do
- = image_tag "rss_ui.png", title: "feed"
diff --git a/app/views/compare/index.html.haml b/app/views/compare/index.html.haml
new file mode 100644
index 0000000..6c9a5fd
--- /dev/null
+++ b/app/views/compare/index.html.haml
@@ -0,0 +1,7 @@
+= render "commits/head"
+
+%h3.page_title
+ Compare View
+%hr
+
+= render "form"
diff --git a/app/views/compare/show.html.haml b/app/views/compare/show.html.haml
index db15ba5..528c8b4 100644
--- a/app/views/compare/show.html.haml
+++ b/app/views/compare/show.html.haml
@@ -1,29 +1,10 @@
-= render "head"
+= render "commits/head"
%h3.page_title
Compare View
%hr
-%div
- %p.slead
- Fill input field with commit id like
- %code.label_branch 4eedf23
- or branch/tag name like
- %code.label_branch master
- and press compare button for commits list, code diff.
-
- %br
-
- = form_tag compare_project_commits_path(@project), method: :get do
- .clearfix
- = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge"
- = "..."
- = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge"
- - if @refs_are_same
- .alert
- %span Refs are the same
- .actions
- = submit_tag "Compare", class: "btn primary wide commits-compare-btn"
+= render "form"
- if @commits.present?
%div.ui-box
@@ -33,21 +14,3 @@
- unless @diffs.empty?
%h4 Diff
= render "commits/diffs", diffs: @diffs
-
-:javascript
- $(function() {
- var availableTags = #{@project.ref_names.to_json};
-
- $("#from").autocomplete({
- source: availableTags,
- minLength: 1
- });
-
- $("#to").autocomplete({
- source: availableTags,
- minLength: 1
- });
-
- disableButtonIfEmptyField('#to', '.commits-compare-btn');
- });
-
diff --git a/app/views/events/_event_push.html.haml b/app/views/events/_event_push.html.haml
index c0be9cf..19ac926 100644
--- a/app/views/events/_event_push.html.haml
+++ b/app/views/events/_event_push.html.haml
@@ -21,6 +21,6 @@
%li.commits-stat
- if event.commits_count > 2
%span ... and #{event.commits_count - 2} more commits.
- = link_to compare_project_commits_path(event.project, from: event.parent_commit.id, to: event.last_commit.id) do
+ = link_to project_compare_path(event.project, from: event.parent_commit.id, to: event.last_commit.id) do
%strong Compare → #{event.parent_commit.id[0..7]}...#{event.last_commit.id[0..7]}
.clearfix
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index a1a8efd..8efedfa 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -139,7 +139,7 @@ module SharedPaths
end
Given 'I visit compare refs page' do
- visit compare_project_commits_path(@project)
+ visit project_compare_index_path(@project)
end
Given 'I visit project commits page' do
--
libgit2 0.21.2