OSDN Git Service

Fix issue when switching branch when BLOB is shown
authorPatrick Helm <deradon87@gmail.com>
Mon, 22 Apr 2013 22:28:30 +0000 (00:28 +0200)
committerPatrick Helm <deradon87@gmail.com>
Mon, 22 Apr 2013 22:59:09 +0000 (00:59 +0200)
Fix blob-switching for AJAX-Requests

Reorder

app/controllers/refs_controller.rb
app/views/blob/show.html.haml
app/views/blob/show.js.haml
app/views/tree/show.js.haml

index e116bc3..188feb7 100644 (file)
@@ -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
index d1ca0e0..d96595b 100644 (file)
@@ -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
index 804107f..0b76661 100644 (file)
@@ -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() {
index a01d491..1e08688 100644 (file)
@@ -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() {