Author: sevein
Date: Thu Dec  2 01:54:26 2010
New Revision: 52

Log:
Show input field when links are clicked.

Modified:
   trunk/templates/report.html

Modified: trunk/templates/report.html
==============================================================================
--- trunk/templates/report.html Thu Dec  2 01:28:00 2010        (r51)
+++ trunk/templates/report.html Thu Dec  2 01:54:26 2010        (r52)
@@ -19,22 +19,55 @@
            event.preventDefault();
          });
 
-       $('#report tbody tr').hover(function ()
-        {
-          $(this).toggleClass('hover');
-        });
+       $('#report tbody tr')
+         .mouseover(function ()
+           {
+             $(this).addClass('hover');
+           })
+         .mouseout(function ()
+           {
+             $(this).removeClass('hover');
+           });
 
        $('select[name=filter_distribution], 
input[name=filter_staff]').change(function ()
-        {
-          $('form').submit();
-        });
+         {
+           $('form').submit();
+         });
 
        $('label')
          .css('cursor', 'pointer')
          .click(function ()
-          {
-            $(this).prev().trigger('click').trigger('change');
-          });
+           {
+             $(this).prev().trigger('click').trigger('change');
+           });
+
+       $('td.address a').live('click', function (event)
+         {
+           // Prevent default behavior
+           event.preventDefault();
+
+           $this = $(this);
+           $parent = $this.parent();
+
+           // Stora original data from the link
+           $parent.data('hostname', $this.text());
+           $parent.data('href', $this.attr('href'));
+
+           // Replace with input
+           $this.replaceWith('<input type="text" value="' + $this.attr('href') 
+ '" readonly="readonly" size="26" />');
+
+           // jQuery.replaceWith() returns the old DOM element
+           $this = $parent.children('input')
+
+           // Focus and select text
+           .focus().select()
+
+           // Handler that returns the link when foucsout event is triggered
+           .focusout(function ()
+             {
+               $this.replaceWith('<a href="' + $parent.data('href') + '">' + 
$parent.data('hostname') + '</a>');
+             });
+         });
     });
 
   </script>
@@ -76,7 +109,7 @@
             {% endif %}
           </td>
           <td>{{ item.get_full_version }}</td>
-          <td><a href="{{ item.address }}" title="{{ item.address }}">{{ 
item.get_hostname }}</a></td>
+          <td class="address"><a href="{{ item.address }}" title="{{ 
item.address }}">{{ item.get_hostname }}</a></td>
           <td class="method">
             {% if item.httpmeta_useragent %} 
               <abbr title="{{ item.httpmeta_useragent }}">

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to