summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Sápiras2011-01-07 14:37:39 +0000
committerGuillaume (ioguix) de Rorthais2011-01-07 14:37:39 +0000
commit75796ce9239a19e4e421d5fc7648013e91910543 (patch)
tree6e2b5e7aea8b20cde4c029979334dbcb0d00da8f
parent774f179dbd007fa254d16d8ff28afec120e371a1 (diff)
Highlight referencing fields on hovering FK values when browsing table data
-rw-r--r--js/display.js16
-rw-r--r--themes/global.css3
2 files changed, 17 insertions, 2 deletions
diff --git a/js/display.js b/js/display.js
index f9180c67..bac28ecb 100644
--- a/js/display.js
+++ b/js/display.js
@@ -6,7 +6,7 @@ $(document).ready(function() {
$('#fkcontainer').append('<div id="root" />');
jQuery.ppa = {
- root: $('#root'),
+ root: $('#root')
};
$("a.fk").live('click', function (event) {
@@ -55,6 +55,15 @@ $(document).ready(function() {
/* creating the data div */
newdiv = $('<div class="fk '+divclass+'">').html(answer);
+ /* highlight referencing fields */
+ newdiv.data('ref', this).data('refclass', $(this).attr('class').split(' ')[1])
+ .mouseenter(function (event) {
+ $(this).data('ref').closest('tr').find('a.'+$(this).data('refclass')).closest('div').addClass('highlight');
+ })
+ .mouseleave(function (event) {
+ $(this).data('ref').closest('tr').find('a.'+$(this).data('refclass')).closest('div').removeClass('highlight');
+ });
+
/* appending it to the level-1 div */
pdiv.append(newdiv);
},
@@ -72,7 +81,10 @@ $(document).ready(function() {
});
$(".fk_delete").live('click', function (event) {
- $(this).closest('div').remove();
+ with($(this).closest('div')) {
+ data('ref').closest('tr').find('a.'+data('refclass')).closest('div').removeClass('highlight');
+ remove();
+ }
return false; // do not refresh the page
});
});
diff --git a/themes/global.css b/themes/global.css
index 106e208b..6e62f0f5 100644
--- a/themes/global.css
+++ b/themes/global.css
@@ -102,6 +102,9 @@ div#fkcontainer {
div.fk_value {
display:inline-block;
}
+.highlight {
+ background-color: #FFFF00;
+}
/** Syntax highlighting **/
.comment {color: #008080}
.keyword {color: #FF8000}