Ajax branch/tag switch for tree view

This commit is contained in:
Dmitriy Zaporozhets 2012-01-29 21:30:03 +02:00
parent 97e9774336
commit ae5faf0fd3
11 changed files with 151 additions and 110 deletions

View file

@ -1,12 +1,19 @@
%ul.breadcrumb
%li
= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form left", :remote => true do
= select_tag "ref", grouped_options_refs, :onchange => "$(this.form).trigger('submit');", :class => "project-refs-select"
= hidden_field_tag :destination, "tree"
= hidden_field_tag :path, params[:path]
%li
= link_to tree_project_ref_path(@project, @ref, :path => nil), :remote => true do
= @project.code
- tree.breadcrumbs(6) do |link|
\/
%li= link
%span.tree_progress
.clear
%div.tree_progress
= image_tag "ajax-loader.gif"
#tree-content-holder
- if tree.is_blob?
= render :partial => "refs/tree_file", :locals => { :name => tree.name, :content => tree.data, :file => tree }
@ -42,12 +49,20 @@
- else
= simple_format(content.data)
- if params[:path]
- history_path = tree_file_project_ref_path(@project, @ref, params[:path])
- else
- history_path = tree_project_ref_path(@project, @ref)
:javascript
$(function(){
$('select#branch').selectmenu({style:'popup', width:200});
$('select#tag').selectmenu({style:'popup', width:200});
$('.project-refs-select').chosen();
history.pushState({ path: this.path }, '', "#{history_path}")
});
- if params[:path] && request.xhr?
:javascript
$(window).unbind('popstate');