Revisions: First pass an implementing a new UI/UX for reviewing the revisions of posts. See #23497 props adamsilverstein for the initial patch.
This implements a new revisions ui using Backbone and preserves all the old methods of "integration" so the change should be transparent to plugins using revisi ons with CPTs. This is the first pass and so there are a number of things still to be resolved, more details in the ticket. Feedback welcomed. git-svn-id: http://core.svn.wordpress.org/trunk@23506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -59,6 +59,15 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
*/
|
||||
var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
|
||||
|
||||
/**
|
||||
* Should we show the split view or not
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
* @since 3.6.0
|
||||
*/
|
||||
var $_show_split_view = true;
|
||||
|
||||
/**
|
||||
* Constructor - Call parent constructor with params array.
|
||||
*
|
||||
@@ -70,6 +79,8 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
*/
|
||||
function __construct( $params = array() ) {
|
||||
parent::__construct( $params );
|
||||
if ( isset( $params[ 'show_split_view' ] ) )
|
||||
$this->_show_split_view = $params[ 'show_split_view' ];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +109,8 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
* @return string
|
||||
*/
|
||||
function addedLine( $line ) {
|
||||
return "<td>+</td><td class='diff-addedline'>{$line}</td>";
|
||||
return "<td class='diff-addedline'>{$line}</td>";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +120,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
* @return string
|
||||
*/
|
||||
function deletedLine( $line ) {
|
||||
return "<td>-</td><td class='diff-deletedline'>{$line}</td>";
|
||||
return "<td class='diff-deletedline'>{$line}</td>";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +130,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
* @return string
|
||||
*/
|
||||
function contextLine( $line ) {
|
||||
return "<td> </td><td class='diff-context'>{$line}</td>";
|
||||
return "<td class='diff-context'>{$line}</td>";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +139,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
* @return string
|
||||
*/
|
||||
function emptyLine() {
|
||||
return '<td colspan="2"> </td>';
|
||||
return '<td> </td>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,8 +154,12 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
$r = '';
|
||||
foreach ($lines as $line) {
|
||||
if ( $encode )
|
||||
$line = htmlspecialchars( $line );
|
||||
$r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
|
||||
$line = wp_kses_post( $line );
|
||||
if ( $this->_show_split_view ) {
|
||||
$r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
|
||||
} else {
|
||||
$r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
@@ -160,8 +176,13 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
$r = '';
|
||||
foreach ($lines as $line) {
|
||||
if ( $encode )
|
||||
$line = htmlspecialchars( $line );
|
||||
$r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
|
||||
$line = wp_kses_post( $line );
|
||||
if ( $this->_show_split_view ) {
|
||||
$r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n";
|
||||
} else {
|
||||
$r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
|
||||
}
|
||||
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
@@ -178,9 +199,12 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
$r = '';
|
||||
foreach ($lines as $line) {
|
||||
if ( $encode )
|
||||
$line = htmlspecialchars( $line );
|
||||
$r .= '<tr>' .
|
||||
$this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
|
||||
$line = wp_kses_post( $line );
|
||||
if ( $this->_show_split_view ) {
|
||||
$r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line ) . "</tr>\n";
|
||||
} else {
|
||||
$r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
@@ -264,7 +288,11 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
||||
} elseif ( $final_rows[$row] < 0 ) { // Final is blank. This is really a deleted row.
|
||||
$r .= $this->_deleted( array($orig_line), false );
|
||||
} else { // A true changed row.
|
||||
$r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n";
|
||||
if ( $this->_show_split_view ) {
|
||||
$r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->emptyLine() . $this->addedLine( $final_line ) . "</tr>\n";
|
||||
} else {
|
||||
$r .= '<tr>' . $this->deletedLine( $orig_line ) . "</tr><tr>" . $this->addedLine( $final_line ) . "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user