parent
679d0d6d76
commit
cda5e66d7c
5 changed files with 26 additions and 19 deletions
|
@ -10,6 +10,7 @@
|
|||
//= require jquery.cookie
|
||||
//= require jquery.endless-scroll
|
||||
//= require jquery.highlight
|
||||
//= require jquery.history
|
||||
//= require jquery.waitforimages
|
||||
//= require jquery.atwho
|
||||
//= require bootstrap
|
||||
|
|
|
@ -8,9 +8,6 @@ $ ->
|
|||
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live "click", ->
|
||||
$("#tree-content-holder").hide("slide", { direction: "left" }, 150)
|
||||
|
||||
$('.project-refs-form').live
|
||||
"ajax:beforeSend": -> $("#tree-content-holder").hide("slide", { direction: "left" }, 150)
|
||||
|
||||
# Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
|
||||
$("#tree-slider .tree-item").live 'click', (e) ->
|
||||
$('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A")
|
||||
|
@ -19,3 +16,24 @@ $ ->
|
|||
$('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live
|
||||
"ajax:beforeSend": -> $('.tree_progress').addClass("loading")
|
||||
"ajax:complete": -> $('.tree_progress').removeClass("loading")
|
||||
|
||||
# Maintain forward/back history while browsing the file tree
|
||||
|
||||
((window) ->
|
||||
History = window.History
|
||||
$ = window.jQuery
|
||||
document = window.document
|
||||
|
||||
# Check to see if History.js is enabled for our Browser
|
||||
unless History.enabled
|
||||
return false
|
||||
|
||||
$ ->
|
||||
$('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live 'click', (e) ->
|
||||
History.pushState(null, null, $(@).attr('href'))
|
||||
return false
|
||||
|
||||
History.Adapter.bind window, 'statechange', ->
|
||||
state = History.getState()
|
||||
window.ajaxGet(state.url)
|
||||
)(window)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%ul.breadcrumb
|
||||
%li
|
||||
%span.arrow
|
||||
= link_to project_tree_path(@project, @ref), remote: true do
|
||||
= link_to project_tree_path(@project, @ref) do
|
||||
= @project.name
|
||||
- tree.breadcrumbs(6) do |link|
|
||||
\/
|
||||
|
@ -26,7 +26,7 @@
|
|||
%tr.tree-item
|
||||
%td.tree-item-file-name
|
||||
= image_tag "file_empty.png", size: '16x16'
|
||||
= link_to "..", tree.up_dir_path, remote: true
|
||||
= link_to "..", tree.up_dir_path
|
||||
%td
|
||||
%td
|
||||
|
||||
|
@ -44,22 +44,9 @@
|
|||
- else
|
||||
= raw GitHub::Markup.render(content.name, content.data)
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
history.pushState({ path: this.path }, '', "#{@history_path}");
|
||||
});
|
||||
|
||||
- unless tree.is_blob?
|
||||
:javascript
|
||||
// Load last commit log for each file in tree
|
||||
$(window).load(function(){
|
||||
ajaxGet('#{@logs_path}');
|
||||
});
|
||||
|
||||
- if @path.present? && request.xhr?
|
||||
:javascript
|
||||
$(window).unbind('popstate');
|
||||
$(window).bind('popstate', function() {
|
||||
if(location.pathname.search("tree") != -1) {
|
||||
$.ajax({type: "GET", url: location.pathname, dataType: "script"})}
|
||||
else { location.href = location.pathname;}});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%tr{ class: "tree-item #{tree_hex_class(tree_item)}" }
|
||||
%td.tree-item-file-name
|
||||
= tree_icon(type)
|
||||
%strong= link_to truncate(tree_item.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name)), remote: true
|
||||
%strong= link_to truncate(tree_item.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
|
||||
%td.tree_time_ago.cgray
|
||||
%span.log_loading.hide
|
||||
Loading commit data...
|
||||
|
|
1
vendor/assets/javascripts/jquery.history.js
vendored
Normal file
1
vendor/assets/javascripts/jquery.history.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue