From b67deb522db4a1c069e8bf7e2fc5c7584393d11d Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 10 Jan 2013 14:34:53 +0800 Subject: [PATCH] [repo] fixed 'popup_tr' bug --- templates/repo.html | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/templates/repo.html b/templates/repo.html index 92ef339b29..ea50e03565 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -17,23 +17,22 @@

{{repo.props.name}}

- {% if path != '/' %} + {% if path == '/' %} + {% if user_perm %} + + {% endif %} + {% if is_repo_owner or request.user.is_staff %} + + {% endif %} + {% if user_perm == 'rw' %} + + {% endif %} + {% else %} {% endif %} - {% if path == '/' %} - {% if user_perm %} - - {% endif %} - {% if is_repo_owner or request.user.is_staff %} - - {% endif %} - {% if user_perm == 'rw' %} - - {% endif %} - {% endif %}
{% if user_perm == 'r' %} @@ -505,15 +504,15 @@ function opOnDirent() { var popup_tr = ''; // the tr which the shown popup belongs to $('#main-panel').removeClass('ovhd'); -$('.more-op-icon').click(function(e) { +$('.more-op-icon').click(function() { var hidden_op = $(this).next(); if ($(this).attr('data')) { // no popup if ($(this).position().left + $(this).width() + hidden_op.width() < $(this).parent().width()) { hidden_op.css({'left': $(this).position().left + $(this).width() + 5}); if ($(this).offset().top + hidden_op.height() <= $('#main').offset().top + $('#main').height()) { - hidden_op.css('top', 6); + hidden_op.css('top', 6); } else { - hidden_op.css('bottom', 2); + hidden_op.css('bottom', 2); } } else { hidden_op.css({'right':0}); @@ -526,25 +525,27 @@ $('.more-op-icon').click(function(e) { hidden_op.removeClass('hide'); $(this).attr('data',''); no_file_op_popup = false; - popup_tr = $(this).parents('tr'); + $('.dirent-op').data('popup_tr', $(this).parents('tr')); } else { hidden_op.addClass('hide'); $(this).attr('data','no-popup'); no_file_op_popup = true; - popup_tr = ''; + $('.dirent-op').data('popup_tr', ''); } }); $(document).click(function(e) { var target = e.target || event.srcElement; + var popup_tr = $('.dirent-op').data('popup_tr'); + if (!no_file_op_popup && !$('.more-op-icon, .hidden-op').is(target) && !$('.hidden-op').find('*').is(target)) { $('.hidden-op').addClass('hide'); $('.more-op-icon').attr('data', 'no-popup'); no_file_op_popup = true; - if (!popup_tr.find('*').is(target)) { popup_tr.removeClass('hl').find('.repo-file-op').addClass('vh'); // clicked place: the first tr, place out of the table + $('.dirent-op').data('popup_tr', ''); $('tr:gt(0)').each(function() { // when other tr is clicked if ($(this).find('*').is(target)) { $(this).addClass('hl').find('.repo-file-op').removeClass('vh');