To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Show
Ignore:
Timestamp:
04/30/10 14:14:49 (2 years ago)
Author:
johnnyoffline
Message:

history browser tweak

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/trunk/modules/a/templates/historySuccess.php

    r1040 r1105  
    6666<script type="text/javascript" charset="utf-8"> 
    6767  $(function() { 
    68                 $('.a-history-browser .a-history-browser-view-more').show(); 
     68                $('#a-history-browser-view-more').show(); 
    6969  }); 
    7070</script> 
     
    7272<script type="text/javascript" charset="utf-8"> 
    7373  $(function() { 
    74                 $('.a-history-browser .a-history-browser-view-more').hide(); 
     74                $('#a-history-browser-view-more').hide().before('&nbsp;'); 
    7575  }); 
    7676</script> 
     
    7979 
    8080<script type="text/javascript" charset="utf-8"> 
     81        $(document).ready(function() { 
    8182 
    82         // Stuff to do as soon as the DOM is ready; 
    83         $('.a-history-browser-view-more').mousedown(function(){ 
    84                 $(this).children('img').fadeIn('fast'); 
    85         }) 
     83                $('.a-history-browser-view-more').mousedown(function(){ 
     84                        $(this).children('img').fadeIn('fast'); 
     85                }) 
    8686 
    87         $('.a-history-item').click(function() { 
     87                $('.a-history-item').click(function() { 
    8888 
    89                 $('.a-history-browser').hide(); 
     89                        $('.a-history-browser').hide(); 
    9090                 
    91           var params = $(this).data('params'); 
     91                  var params = $(this).data('params'); 
    9292         
    93                 var targetArea = "#"+$(this).parent().attr('rel');                                                                                      // this finds the associated area that the history browser is displaying 
    94                 var historyBtn = $(targetArea+ ' .a-area-controls a.a-history');                                // this grabs the history button 
    95                 var cancelBtn = $('#a-history-cancel-button');  // this grabs the cancel button for this area 
    96                 var revertBtn = $('#a-history-revert-button');  // this grabs the history revert button for this area 
     93                        var targetArea = "#"+$(this).parent().attr('rel');                                                              <?php // this finds the associated area that the history browser is displaying ?> 
     94                        var historyBtn = $(targetArea+ ' .a-area-controls a.a-history');        <?php // this grabs the history button ?> 
     95                        var cancelBtn = $('#a-history-cancel-button');                                                                          <?php // this grabs the cancel button for this area ?> 
     96                        var revertBtn = $('#a-history-revert-button');                                                                          <?php // this grabs the history revert button for this area ?> 
    9797                 
    98                 $(historyBtn).siblings('.a-history-options').show(); 
     98                        $(historyBtn).siblings('.a-history-options').show(); 
    9999 
    100           $.post( //User clicks to PREVIEW revision 
    101             <?php echo json_encode(url_for('a/revert')) ?>, 
    102             params.preview, 
    103             function(result) 
    104             { 
    105                                 $('#a-slots-<?php echo "$id-$name" ?>').html(result); 
    106                                 $(targetArea).addClass('previewing-history'); 
    107                                 historyBtn.addClass('a-disabled');                               
    108                                 // $(targetArea+' .a-controls-item').siblings('.cancel, .history').css('display', 'block'); // turn off all controls initially                           
    109                                 // $(targetArea+' .a-controls-item.cancel').addClass('cancel-history');                          
    110                                 // $(targetArea+' .a-history-options').css('display','inline'); 
    111                                 $('.a-page-overlay').hide(); 
    112                                 aUI(targetArea); 
    113             } 
    114           ); 
    115  
    116                 // Assign behaviors to the revert and cancel buttons when THIS history item is clicked 
    117                 revertBtn.click(function(){ 
    118                   $.post( // User clicks Save As Current Revision Button 
     100                  $.post( //User clicks to PREVIEW revision 
    119101                    <?php echo json_encode(url_for('a/revert')) ?>, 
    120                     params.revert, 
     102                    params.preview, 
    121103                    function(result) 
    122104                    { 
    123                                         $('#a-slots-<?php echo "$id-$name" ?>').html(result);                    
    124                                         historyBtn.removeClass('a-disabled');                                            
    125                                         aCloseHistory(); 
    126                                         aUI(targetArea, 'history-revert'); 
    127                         } 
    128                         );       
     105                                        $('#a-slots-<?php echo "$id-$name" ?>').html(result); 
     106                                        $(targetArea).addClass('previewing-history'); 
     107                                        historyBtn.addClass('a-disabled');                               
     108                                        $('.a-page-overlay').hide(); 
     109                                        aUI(targetArea); 
     110                    } 
     111                  ); 
     112 
     113                        // Assign behaviors to the revert and cancel buttons when THIS history item is clicked 
     114                        revertBtn.click(function(){ 
     115                          $.post( // User clicks Save As Current Revision Button 
     116                            <?php echo json_encode(url_for('a/revert')) ?>, 
     117                            params.revert, 
     118                            function(result) 
     119                            { 
     120                                                $('#a-slots-<?php echo "$id-$name" ?>').html(result);                    
     121                                                historyBtn.removeClass('a-disabled');                                            
     122                                                aCloseHistory(); 
     123                                                aUI(targetArea, 'history-revert'); 
     124                                } 
     125                                );       
     126                        }); 
     127                                                 
     128                        cancelBtn.click(function(){  
     129                          $.post( // User clicks CANCEL 
     130                            <?php echo json_encode(url_for('a/revert')) ?>, 
     131                            params.cancel, 
     132                            function(result) 
     133                            { 
     134                                $('#a-slots-<?php echo "$id-$name" ?>').html(result); 
     135                                                historyBtn.removeClass('a-disabled');                                                            
     136                                                aCloseHistory(); 
     137                                                aUI(targetArea); 
     138                                } 
     139                                ); 
     140                        }); 
    129141                }); 
    130                                                  
    131                 cancelBtn.click(function(){  
    132                   $.post( // User clicks CANCEL 
    133                     <?php echo json_encode(url_for('a/revert')) ?>, 
    134                     params.cancel, 
    135                     function(result) 
    136                     { 
    137                         $('#a-slots-<?php echo "$id-$name" ?>').html(result); 
    138                                         historyBtn.removeClass('a-disabled');                                                            
    139                                         aCloseHistory(); 
    140                                         aUI(targetArea); 
    141                         } 
    142                         ); 
     142 
     143                $('.a-history-item').hover(function(){ 
     144                        $(this).css('cursor','pointer'); 
     145                },function(){ 
     146                        $(this).css('cursor','default');                 
    143147                }); 
    144         }); 
    145148 
    146         $('.a-history-item').hover(function(){ 
    147                 $(this).css('cursor','pointer'); 
    148         },function(){ 
    149                 $(this).css('cursor','default');                 
    150         }); 
    151  
     149}); 
    152150</script>