added hide button for changes
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 3 Jun 2010 10:52:42 +0000 (12:52 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 3 Jun 2010 10:52:42 +0000 (12:52 +0200)
public/mojo_facets.css
templates/changes/index.html.ep

index f267455..7d07948 100644 (file)
@@ -163,3 +163,14 @@ a.facet {
        color: #666;
        text-decoration: none;
 }
+
+/* /changes */
+.change_box {
+       border: 3px dashed #f84;
+}
+
+.change_viewed a {
+       color: #888;
+       text-decoration: line-through;
+}
+
index 8c96987..630e5ae 100644 (file)
@@ -38,7 +38,24 @@ $(document).ready( function(){
 
        $('a.view').live( 'click', function() {
                console.debug(this.href);
-               $(this).parent().load( this.href + ' form' ).css({ 'border': '3px dashed #f84' });
+               var e = $(this).parent();
+               var link_html = e.html();
+               $.ajax({
+                       url: this.href,
+                       success: function(data){
+                               var form = $(data).filter('form');
+                               console.debug('ajax',e,form);
+                               e.html( form.html() )
+                               .addClass( 'change_box' )
+                               .append(
+                                       $('<input type=button value=hide>').click( function() {
+console.debug(this,link_html);
+                                       e.html( link_html ).removeClass( 'change_box' ).addClass( 'change_viewed' );
+                                       })
+                               )
+                               ;
+                       }
+               })
                return false;
        });