mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
[dir view] grid view: bugfix & improvement
This commit is contained in:
@@ -163,7 +163,7 @@ ol { padding-left:2em; }
|
|||||||
dl { margin:1.5em 0; }
|
dl { margin:1.5em 0; }
|
||||||
dt { color:#666; margin:24px 0 2px; }
|
dt { color:#666; margin:24px 0 2px; }
|
||||||
dd { margin-bottom:.8em; color:#222; }
|
dd { margin-bottom:.8em; color:#222; }
|
||||||
a { color:#eb8205; text-decoration:none; font-weight:bold; }
|
a { color:#eb8205; text-decoration:none; font-weight:bold; outline:none; }
|
||||||
a.normal {font-weight: normal;}
|
a.normal {font-weight: normal;}
|
||||||
a:hover { color: #ff9933; text-decoration: underline; }
|
a:hover { color: #ff9933; text-decoration: underline; }
|
||||||
img { border:none; }
|
img { border:none; }
|
||||||
@@ -3422,7 +3422,6 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
margin-right:15px;
|
margin-right:15px;
|
||||||
color:#8a8a8a;
|
color:#8a8a8a;
|
||||||
font-size:22px;
|
font-size:22px;
|
||||||
outline:none; /* removing the dotted outline for FireFox */
|
|
||||||
}
|
}
|
||||||
.repo-op .op-link:hover {
|
.repo-op .op-link:hover {
|
||||||
color:#eb8205;
|
color:#eb8205;
|
||||||
@@ -3874,6 +3873,9 @@ img.thumbnail {
|
|||||||
bottom:0px;
|
bottom:0px;
|
||||||
right:10px;
|
right:10px;
|
||||||
}
|
}
|
||||||
|
.grid-item-op { /* the context menu */
|
||||||
|
box-shadow: 0 2px 2px #aaa;
|
||||||
|
}
|
||||||
#dir-view .grid-item {
|
#dir-view .grid-item {
|
||||||
padding:10px 20px; /* use less padding */
|
padding:10px 20px; /* use less padding */
|
||||||
}
|
}
|
||||||
|
@@ -141,22 +141,15 @@ define([
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// stop default event when clicking the right mouse button in grid view
|
// for 'grid view': click to hide the contextmenu of '.grid-item'
|
||||||
$('.grid-view').bind("contextmenu", function(e) {
|
|
||||||
if (e && e.preventDefault) {
|
|
||||||
e.preventDefault();
|
|
||||||
} else {
|
|
||||||
window.event.returnValue = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// remove 'grid-item-op' popup
|
|
||||||
$(document).click(function(e) {
|
$(document).click(function(e) {
|
||||||
var target = e.target || event.srcElement;
|
var target = e.target || event.srcElement;
|
||||||
var $popup = $('.grid-item-op');
|
var $popup = $('.grid-item-op');
|
||||||
if ($popup.length > 0 &&
|
if ($popup.length > 0 &&
|
||||||
!$popup.is(target) &&
|
!$popup.is(target) &&
|
||||||
!$popup.find('*').is(target)) {
|
!$popup.find('*').is(target) &&
|
||||||
|
!$popup.closest('.grid-item').is(target) &&
|
||||||
|
!$popup.closest('.grid-item').find('*').is(target)) {
|
||||||
$popup.remove();
|
$popup.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -77,8 +77,8 @@ define([
|
|||||||
events: {
|
events: {
|
||||||
'mouseenter': 'highlight',
|
'mouseenter': 'highlight',
|
||||||
'mouseleave': 'rmHighlight',
|
'mouseleave': 'rmHighlight',
|
||||||
'contextmenu .img-link': 'showPopupMenu',
|
'click': 'closeMenu',
|
||||||
'contextmenu .text-link': 'showPopupMenu'
|
'contextmenu': 'showPopupMenu'
|
||||||
},
|
},
|
||||||
|
|
||||||
highlight: function() {
|
highlight: function() {
|
||||||
@@ -91,7 +91,10 @@ define([
|
|||||||
this.$('.text-link').removeClass('hl');
|
this.$('.text-link').removeClass('hl');
|
||||||
},
|
},
|
||||||
|
|
||||||
showPopupMenu: function(event) {
|
showPopupMenu: function(e) {
|
||||||
|
// make sure there is only 1 menu popup
|
||||||
|
$('.grid-item-op', this.dirView.$dirent_grid).remove();
|
||||||
|
|
||||||
var dir = this.dir;
|
var dir = this.dir;
|
||||||
var template;
|
var template;
|
||||||
|
|
||||||
@@ -120,8 +123,8 @@ define([
|
|||||||
var el_pos = this.$el.offset();
|
var el_pos = this.$el.offset();
|
||||||
this.$('.grid-item-op').css({
|
this.$('.grid-item-op').css({
|
||||||
'position': 'absolute',
|
'position': 'absolute',
|
||||||
'left': event.pageX - el_pos.left,
|
'left': e.pageX - el_pos.left,
|
||||||
'top': event.pageY - el_pos.top
|
'top': e.pageY - el_pos.top
|
||||||
});
|
});
|
||||||
|
|
||||||
// Using _.bind(function, object) to make that whenever the function is
|
// Using _.bind(function, object) to make that whenever the function is
|
||||||
|
Reference in New Issue
Block a user