Commit 93dd06fc2d81869a95dc24df004027ba489b3ec0

Authored by Patrick Helm
1 parent 5ac5f586

Fix issue when switching branch when BLOB is shown

Fix blob-switching for AJAX-Requests

Reorder
app/controllers/refs_controller.rb
... ... @@ -13,6 +13,8 @@ class RefsController < ProjectResourceController
13 13 format.html do
14 14 new_path = if params[:destination] == "tree"
15 15 project_tree_path(@project, (@ref + "/" + params[:path]))
  16 + elsif params[:destination] == "blob"
  17 + project_blob_path(@project, (@ref + "/" + params[:path]))
16 18 elsif params[:destination] == "graph"
17 19 project_graph_path(@project, @ref)
18 20 else
... ...
app/views/blob/show.html.haml
1 1 %div.tree-ref-holder
2   - = render 'shared/ref_switcher', destination: 'tree', path: @path
  2 + = render 'shared/ref_switcher', destination: 'blob', path: @path
3 3 %div#tree-holder.tree-holder
4 4 = render 'blob', blob: @blob
... ...
app/views/blob/show.js.haml
... ... @@ -3,6 +3,7 @@
3 3 $("#tree-holder").html("#{escape_javascript(render(partial: "blob", locals: {blob: @blob}))}");
4 4 $("#tree-content-holder").show("slide", { direction: "right" }, 400);
5 5 $('.project-refs-form #path').val("#{@path}");
  6 + $(".project-refs-form #destination").val("blob");
6 7  
7 8 // Load last commit log for each file in tree
8 9 $('#tree-slider').waitForImages(function() {
... ...
app/views/tree/show.js.haml
... ... @@ -3,6 +3,7 @@
3 3 $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {tree: @tree}))}");
4 4 $("#tree-content-holder").show("slide", { direction: "right" }, 400);
5 5 $('.project-refs-form #path').val("#{@path}");
  6 + $(".project-refs-form #destination").val("tree");
6 7  
7 8 // Load last commit log for each file in tree
8 9 $('#tree-slider').waitForImages(function() {
... ...