From 93dd06fc2d81869a95dc24df004027ba489b3ec0 Mon Sep 17 00:00:00 2001 From: Patrick Helm Date: Tue, 23 Apr 2013 00:28:30 +0200 Subject: [PATCH] Fix issue when switching branch when BLOB is shown --- app/controllers/refs_controller.rb | 2 ++ app/views/blob/show.html.haml | 2 +- app/views/blob/show.js.haml | 1 + app/views/tree/show.js.haml | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index e116bc3..188feb7 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -13,6 +13,8 @@ class RefsController < ProjectResourceController format.html do new_path = if params[:destination] == "tree" project_tree_path(@project, (@ref + "/" + params[:path])) + elsif params[:destination] == "blob" + project_blob_path(@project, (@ref + "/" + params[:path])) elsif params[:destination] == "graph" project_graph_path(@project, @ref) else diff --git a/app/views/blob/show.html.haml b/app/views/blob/show.html.haml index d1ca0e0..d96595b 100644 --- a/app/views/blob/show.html.haml +++ b/app/views/blob/show.html.haml @@ -1,4 +1,4 @@ %div.tree-ref-holder - = render 'shared/ref_switcher', destination: 'tree', path: @path + = render 'shared/ref_switcher', destination: 'blob', path: @path %div#tree-holder.tree-holder = render 'blob', blob: @blob diff --git a/app/views/blob/show.js.haml b/app/views/blob/show.js.haml index 804107f..0b76661 100644 --- a/app/views/blob/show.js.haml +++ b/app/views/blob/show.js.haml @@ -3,6 +3,7 @@ $("#tree-holder").html("#{escape_javascript(render(partial: "blob", locals: {blob: @blob}))}"); $("#tree-content-holder").show("slide", { direction: "right" }, 400); $('.project-refs-form #path').val("#{@path}"); + $(".project-refs-form #destination").val("blob"); // Load last commit log for each file in tree $('#tree-slider').waitForImages(function() { diff --git a/app/views/tree/show.js.haml b/app/views/tree/show.js.haml index a01d491..1e08688 100644 --- a/app/views/tree/show.js.haml +++ b/app/views/tree/show.js.haml @@ -3,6 +3,7 @@ $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {tree: @tree}))}"); $("#tree-content-holder").show("slide", { direction: "right" }, 400); $('.project-refs-form #path').val("#{@path}"); + $(".project-refs-form #destination").val("tree"); // Load last commit log for each file in tree $('#tree-slider').waitForImages(function() { -- libgit2 0.21.2