| 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 ?> |
| 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 |
| 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 | }); |
| 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'); |