Merge "Add urlencode for URL encoding of lang values"
[lhc/web/wiklou.git] / includes / changes / ChangesList.php
index 92a3d3f..5aa693d 100644 (file)
@@ -177,6 +177,8 @@ class ChangesList extends ContextSource {
                } else {
                        $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns' .
                                $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
+                       $classes[] = Sanitizer::escapeClass( self::CSS_CLASS_PREFIX . 'ns-' .
+                               $rc->mAttribs['rc_namespace'] );
                }
 
                // Indicate watched status on the line to allow for more
@@ -739,4 +741,26 @@ class ChangesList extends ContextSource {
                        && intval( $rcObj->getAttribute( 'rc_this_oldid' ) ) === 0;
        }
 
+       /**
+        * Get recommended data attributes for a change line.
+        * @param RecentChange $rc
+        * @return string[] attribute name => value
+        */
+       protected function getDataAttributes( RecentChange $rc ) {
+               $type = $rc->getAttribute( 'rc_source' );
+               switch ( $type ) {
+                       case RecentChange::SRC_EDIT:
+                       case RecentChange::SRC_NEW:
+                               return [
+                                       'data-mw-revid' => $rc->mAttribs['rc_this_oldid'],
+                               ];
+                       case RecentChange::SRC_LOG:
+                               return [
+                                       'data-mw-logid' => $rc->mAttribs['rc_logid'],
+                                       'data-mw-logaction' => $rc->mAttribs['rc_log_type'] . '/' . $rc->mAttribs['rc_log_action'],
+                               ];
+                       default:
+                               return [];
+               }
+       }
 }