Jeroen De Dauw has submitted this change and it was merged. Change subject: (Bug 31880) add column class (based on dataValue typeId) ......................................................................
(Bug 31880) add column class (based on dataValue typeId) Depending on the datavalue type a class attribute (_str, _dat, _num etc.) is amended which can be used to adjust in-table formatting. The class attribute is concatenated string of smwtype + typeId (e.g smwtype_dat, smwtype_num) dataValue typeID is language independant and is also available via the SMWApi which means a similar approach can be applied (see [1]). For example: <td class="Has-event-end smwtype_dat">5 March 2013 05:00:00</td> [1] https://gerrit.wikimedia.org/r/#/c/53544 Change-Id: I361c93b95240e0719929de12901ce63d7e5978f6 --- M includes/queryprinters/SMW_QP_Table.php 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Jeroen De Dauw: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/queryprinters/SMW_QP_Table.php b/includes/queryprinters/SMW_QP_Table.php index 714d649..f3d1b9f 100644 --- a/includes/queryprinters/SMW_QP_Table.php +++ b/includes/queryprinters/SMW_QP_Table.php @@ -133,6 +133,7 @@ if ( count( $dataValues ) > 0 ) { $sortkey = $dataValues[0]->getDataItem()->getSortKey(); + $dataValueType = $dataValues[0]->getTypeID(); if ( is_numeric( $sortkey ) ) { $attribs['data-sort-value'] = $sortkey; @@ -143,7 +144,7 @@ if ( in_array( $alignment, array( 'right', 'left', 'center' ) ) ) { $attribs['style'] = "text-align:' . $alignment . ';"; } - $attribs['class'] = $columnClass; + $attribs['class'] = $columnClass . ( $dataValueType !== '' ? ' smwtype' . $dataValueType : '' ); $content = $this->getCellContent( $dataValues, -- To view, visit https://gerrit.wikimedia.org/r/53520 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I361c93b95240e0719929de12901ce63d7e5978f6 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Mwjames <jamesin.hongkon...@gmail.com> Gerrit-Reviewer: Foxtrott <s7ep...@gmail.com> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Mwjames <jamesin.hongkon...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits